aboutsummaryrefslogtreecommitdiffstats
path: root/testing/nim
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-05-24 00:03:30 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-06-07 23:36:21 +0200
commitafe7923c88c43e566e4529ef91f464b0eaedcd8c (patch)
treea76ddb1d356164d6e8c30ba0395c1f3e0aaf0ccb /testing/nim
parent51845850201a6e06d5d7154807ed9969fd8b6c9a (diff)
downloadaports-afe7923c88c43e566e4529ef91f464b0eaedcd8c.tar.bz2
aports-afe7923c88c43e566e4529ef91f464b0eaedcd8c.tar.xz
testing/nim: new aport
https://nim-lang.org/ A systems and applications programming language
Diffstat (limited to 'testing/nim')
-rw-r--r--testing/nim/APKBUILD78
-rw-r--r--testing/nim/nim-config-fix-paths.patch15
-rw-r--r--testing/nim/niminst-fix-paths.patch170
3 files changed, 263 insertions, 0 deletions
diff --git a/testing/nim/APKBUILD b/testing/nim/APKBUILD
new file mode 100644
index 0000000000..c52abc4f7b
--- /dev/null
+++ b/testing/nim/APKBUILD
@@ -0,0 +1,78 @@
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
+#
+# WARNING: Coroutines does not work and there may be more breakages!
+pkgname=nim
+pkgver=0.17.0
+pkgrel=0
+pkgdesc="A systems and applications programming language"
+url="https://nim-lang.org/"
+arch="all"
+license="MIT"
+checkdepends="sqlite-libs nodejs"
+subpackages="$pkgname-doc nimsuggest niminst"
+source="https://nim-lang.org/download/$pkgname-$pkgver.tar.xz
+ $pkgname-csources-$pkgver.tar.gz::https://github.com/nim-lang/csources/archive/v$pkgver.tar.gz
+ niminst-fix-paths.patch
+ nim-config-fix-paths.patch"
+builddir="$srcdir/$pkgname-$pkgver"
+
+prepare() {
+ mv "$srcdir"/csources-$pkgver "$builddir"/csources
+ default_prepare
+}
+
+build() {
+ cd "$builddir"/csources
+
+ msg2 "Building nim csources..."
+ ./build.sh
+
+ cd ..
+
+ msg2 "Building koch..."
+ ./bin/nim compile -d:release koch
+
+ msg2 "Building nim..."
+ ./koch boot -d:release
+
+ msg2 "Building nimsuggest..."
+ ./bin/nim compile -d:release nimsuggest/nimsuggest.nim
+}
+
+check() {
+ cd "$builddir"
+ # XXX: Some tests fail!
+ ./koch tests --pedantic --targets="c js" all || true
+}
+
+package() {
+ cd "$builddir"
+ DESTDIR="$pkgdir" ./koch install /usr/bin
+
+ cd "$pkgdir"
+ mkdir -p usr/include
+ local file; for file in usr/lib/nim/*.h; do
+ mv $file usr/include/
+ ln -s ../../include/${file##*/} usr/lib/nim/${file##*/}
+ done
+}
+
+nimsuggest() {
+ pkgdesc="idetools for the nim language"
+
+ install -D -m 755 "$builddir"/nimsuggest/nimsuggest \
+ "$subpkgdir"/usr/bin/nimsuggest
+}
+
+niminst() {
+ pkgdesc="A tool to generate an installer for a Nim program"
+
+ install -D -m 755 "$builddir"/tools/niminst/niminst \
+ "$subpkgdir"/usr/bin/niminst
+}
+
+sha512sums="90d709b39746fac5582b9df69d3eb9e3b7a39563a98f7a3002f00716b936e4e0d2be47d8b877878318692e6e2b85c08077dfcc20d9059573a1967402c244894b nim-0.17.0.tar.xz
+fbf64d347e25da48d5237eef35209774f0e542975465c5d2cd98878f10ea0ab62ad1404758131543b8cf634afabc90d85e9e59dec96eae9bb60fffb88d204d92 nim-csources-0.17.0.tar.gz
+4ab36c5d8772567ba09b536e3dd91ddcf253892056751318ccbfce7ac24f0a646bfcd94f5dadc823c9a8394bea9614fede20c1805638052ebdbe7b5bafba4f05 niminst-fix-paths.patch
+813eb4cb93b0e9f12cb7666bef65c583390008ec09bc850f43f621688dc809bc51c105898095a8ef6316fbef49ac657a7abc75d74ad7b8cb3919c8f1a721af02 nim-config-fix-paths.patch"
diff --git a/testing/nim/nim-config-fix-paths.patch b/testing/nim/nim-config-fix-paths.patch
new file mode 100644
index 0000000000..7f74d5f56e
--- /dev/null
+++ b/testing/nim/nim-config-fix-paths.patch
@@ -0,0 +1,15 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Tue, 23 Aug 2017 22:57:00 +0200
+Subject: [PATCH] Fix default nimblepath in nim.cfg
+
+--- a/config/nim.cfg
++++ b/config/nim.cfg
+@@ -41,7 +41,7 @@
+ @if nimbabel:
+ nimblepath="$home/.nimble/pkgs/"
+ @if not windows:
+- nimblepath="/opt/nimble/pkgs/"
++ nimblepath="/usr/share/nimble/pkgs/"
+ @else:
+ # TODO:
+ @end
diff --git a/testing/nim/niminst-fix-paths.patch b/testing/nim/niminst-fix-paths.patch
new file mode 100644
index 0000000000..1274220493
--- /dev/null
+++ b/testing/nim/niminst-fix-paths.patch
@@ -0,0 +1,170 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Tue, 23 Aug 2017 22:57:00 +0200
+Subject: [PATCH] Patch niminst's (de)install to be usable for distributions
+
+* Add support for DESTDIR variable (staged installs).
+* Change paths to be FHS/Alpine compliant.
+* Use "install" command instead of mkdir/cp/chmod.
+
++++ b/tools/niminst/install.tmpl
+--- a/tools/niminst/install.tmpl
+@@ -5,6 +5,8 @@
+
+ set -e
+
++: ${DESTDIR:=}
++
+ if [ $# -eq 1 ] ; then
+ # if c.cat[fcUnixBin].len > 0:
+ if test -f ?{c.cat[fcUnixBin][0].toUnix}
+@@ -26,43 +28,47 @@
+ echo " <some other dir> (treated similar to '/opt')"
+ echo "To deinstall, use the command:"
+ echo "sh deinstall.sh DIR"
++ echo ""
++ echo "You may also use environment variable DESTDIR for staged installs"
++ echo "(DESTDIR is prepended to each install target file). Note that this"
++ echo "is added by Alpine Linux, it's not supported by standard niminst."
+ exit 1
+ ;;
+ "/usr/bin")
+- bindir=/usr/bin
+- configdir=/etc
+- libdir=/usr/lib/?proj
+- docdir=/usr/share/?proj/doc
+- datadir=/usr/share/?proj/data
+- nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
++ bindir="$DESTDIR/usr/bin"
++ configdir="$DESTDIR/etc"
++ libdir="$DESTDIR/usr/lib/?proj"
++ docdir="$DESTDIR/usr/share/doc/?proj"
++ datadir="$DESTDIR/usr/share/?proj/data"
++ nimbleDir="$DESTDIR/usr/share/nimble/pkgs/?c.nimblePkgName-?c.version"
+ ;;
+ "/usr/local/bin")
+- bindir=/usr/local/bin
+- configdir=/etc
+- libdir=/usr/local/lib/?proj
+- docdir=/usr/local/share/?proj/doc
+- datadir=/usr/local/share/?proj/data
+- nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
++ bindir="$DESTDIR/usr/local/bin"
++ configdir="$DESTDIR/etc"
++ libdir="$DESTDIR/usr/local/lib/?proj"
++ docdir="$DESTDIR/usr/local/share/doc/?proj"
++ datadir="$DESTDIR/usr/local/share/?proj/data"
++ nimbleDir="$DESTDIR/usr/local/share/nimble/pkgs/?c.nimblePkgName-?c.version"
+ ;;
+ "/opt")
+- bindir="/opt/?proj/bin"
+- configdir="/opt/?proj/config"
+- libdir="/opt/?proj/lib"
+- docdir="/opt/?proj/doc"
+- datadir="/opt/?proj/data"
+- nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
+- mkdir -p /opt/?proj
++ bindir="$DESTDIR/opt/?proj/bin"
++ configdir="$DESTDIR/opt/?proj/config"
++ libdir="$DESTDIR/opt/?proj/lib"
++ docdir="$DESTDIR/opt/?proj/doc"
++ datadir="$DESTDIR/opt/?proj/data"
++ nimbleDir="$DESTDIR/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
++ mkdir -p $DESTDIR/opt/?proj
+ mkdir -p $bindir
+ mkdir -p $configdir
+ ;;
+ *)
+- bindir="$1/?proj/bin"
+- configdir="$1/?proj/config"
+- libdir="$1/?proj/lib"
+- docdir="$1/?proj/doc"
+- datadir="$1/?proj/data"
+- nimbleDir="$1/?proj"
+- mkdir -p $1/?proj
++ bindir="$DESTDIR$1/?proj/bin"
++ configdir="$DESTDIR$1/?proj/config"
++ libdir="$DESTDIR$1/?proj/lib"
++ docdir="$DESTDIR$1/?proj/doc"
++ datadir="$DESTDIR$1/?proj/data"
++ nimbleDir="$DESTDIR$1/?proj"
++ mkdir -p $DESTDIR$1/?proj
+ mkdir -p $bindir
+ mkdir -p $configdir
+ ;;
+@@ -89,35 +95,28 @@
+ #end for
+
+ #for f in items(c.cat[fcUnixBin]):
+- cp ?f.toUnix $bindir/?f.skipRoot.toUnix
+- chmod 755 $bindir/?f.skipRoot.toUnix
++ install -D -m 755 ?f.toUnix $bindir/?f.skipRoot.toUnix
+ #end for
+ #for f in items(c.cat[fcConfig]):
+- cp ?f.toUnix $configdir/?f.skipRoot.toUnix
+- chmod 644 $configdir/?f.skipRoot.toUnix
++ install -D -m 755 ?f.toUnix $configdir/?f.skipRoot.toUnix
+ #end for
+ #for f in items(c.cat[fcData]):
+ if [ -f ?f.toUnix ]; then
+- cp ?f.toUnix $datadir/?f.skipRoot.toUnix
+- chmod 644 $datadir/?f.skipRoot.toUnix
++ install -D -m 644 ?f.toUnix $datadir/?f.skipRoot.toUnix
+ fi
+ #end for
+ #for f in items(c.cat[fcDoc]):
+ if [ -f ?f.toUnix ]; then
+- cp ?f.toUnix $docdir/?f.skipRoot.toUnix
+- chmod 644 $docdir/?f.skipRoot.toUnix
++ install -D -m 644 ?f.toUnix $docdir/?f.skipRoot.toUnix
+ fi
+ #end for
+ #for f in items(c.cat[fcLib]):
+- cp ?f.toUnix $libdir/?f.skipRoot.toUnix
+- chmod 644 $libdir/?f.skipRoot.toUnix
++ install -D -m 644 ?f.toUnix $libdir/?f.skipRoot.toUnix
+ #end for
+ #for f in items(c.cat[fcNimble]):
+- cp ?f.toUnix $nimbleDir/?f.toUnix
+- chmod 644 $nimbleDir/?f.toUnix
++ install -D -m 644 ?f.toUnix $nimbleDir/?f.toUnix
+ #end for
+-cp ?{c.nimblePkgName}.nimble $nimbleDir/?{c.nimblePkgName}.nimble
+-chmod 644 $nimbleDir/?{c.nimblePkgName}.nimble
++install -D -m 644 ?{c.nimblePkgName}.nimble $nimbleDir/?{c.nimblePkgName}.nimble
+
+ echo "installation successful"
+ else
+@@ -130,5 +129,9 @@
+ echo " <some other dir> (treated similar to '/opt')"
+ echo "To deinstall, use the command:"
+ echo "sh deinstall.sh DIR"
++ echo ""
++ echo "You may also use environment variable DESTDIR for staged installs"
++ echo "(DESTDIR is prepended to each install target file). Note that this"
++ echo "is added by Alpine Linux, it's not supported by standard niminst."
+ exit 1
+ fi
+--- a/tools/niminst/deinstall.tmpl
++++ b/tools/niminst/deinstall.tmpl
+@@ -19,17 +19,17 @@
+ bindir=/usr/bin
+ configdir=/etc
+ libdir=/usr/lib/?proj
+- docdir=/usr/share/?proj/doc
++ docdir=/usr/share/doc/?proj
+ datadir=/usr/share/?proj/data
+- nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
++ nimbleDir="/usr/share/nimble/pkgs/?c.nimblePkgName-?c.version"
+ ;;
+ "/usr/local/bin")
+ bindir=/usr/local/bin
+ configdir=/etc
+ libdir=/usr/local/lib/?proj
+- docdir=/usr/local/share/?proj/doc
++ docdir=/usr/local/share/doc/?proj
+ datadir=/usr/local/share/?proj/data
+- nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
++ nimbleDir="/usr/share/nimble/pkgs/?c.nimblePkgName-?c.version"
+ ;;
+ "/opt")
+ bindir="/opt/?proj/bin"