dev-lang/nim: bump up to 0.19.0, bug #635032
authorSergei Trofimovich <slyfox@gentoo.org>
Wed, 26 Sep 2018 23:31:48 +0000 (00:31 +0100)
committerSergei Trofimovich <slyfox@gentoo.org>
Wed, 26 Sep 2018 23:32:22 +0000 (00:32 +0100)
While at it move installation to /usr/ prefix.

Reported-by: Jonas Stein
Closes: https://bugs.gentoo.org/635032
Package-Manager: Portage-2.3.50, Repoman-2.3.11

dev-lang/nim/Manifest
dev-lang/nim/files/nim-0.19.0-paths.patch [new file with mode: 0644]
dev-lang/nim/nim-0.19.0.ebuild [new file with mode: 0644]

index dfd023bda128689833f4b141061317937c4220c6..60b6c77f4b8b143c69d458ad92c0e3c5c172ab6a 100644 (file)
@@ -2,3 +2,4 @@ DIST nim-0.16.0.tar.xz 2907076 BLAKE2B 5f14bb2634da32deb810381edf817e3885382ffce
 DIST nim-0.17.0.tar.xz 25079320 BLAKE2B d01ade93ff299962aeea3dc9c90f0a8fe87acef8c2ee6d7d521d936c680aded0d8383221b7c11c3b2a8d6c28311c939456f271bbc90c1115acaae2c1987fa908 SHA512 90d709b39746fac5582b9df69d3eb9e3b7a39563a98f7a3002f00716b936e4e0d2be47d8b877878318692e6e2b85c08077dfcc20d9059573a1967402c244894b
 DIST nim-0.17.2.tar.xz 4083084 BLAKE2B c1a4134592bb6a57bfaf6174becb409e40075c77042964c639b39fe7b30f094bfc8d404d6e1e4e527a95333a8ee4597477f1052da1af58c3216042bb2f85c826 SHA512 7b4ed1eb1e9067ce72b76b95c43ec74eb38f04611776c174ba6a697254a9253fed61258712fb938f15e662bb3b0d36138194fc8fa89bbcb4d22888263e5e2880
 DIST nim-0.18.0.tar.xz 4412632 BLAKE2B f7286542daa4c3502f4edeb9d93e6a69169228a50248f1c5c02421cb8e70c0ab99bc84cc91b35a6227a4974345423eeb3b5ffecdb18e321b0a82eb8fd0879a16 SHA512 8f59cb4a8d44949cdd1154fb44df548005329da8255becf2f54083ce58323ff8d6cf7b2fdd86d4b1f446bd9f977e8eaf4b13c7ca6723da8a10c7b671954de772
+DIST nim-0.19.0.tar.xz 3321644 BLAKE2B e1de3b8a4c756315bcd110ddc62c03eb1a379403d8c102eb4d6d131cccabe3dccdfdac33d46037fd8b3b241d727acb42f5cb0b616a4079830ea3abf63089f90a SHA512 f7f3c8e0e9a6509b6404e21da4693ceb279112dd7a7c39edc7e717f21554442914c9cf7d811bb4034ff244e34d77dabf6e09b5e3e77c37314adf99cc0c3b2311
diff --git a/dev-lang/nim/files/nim-0.19.0-paths.patch b/dev-lang/nim/files/nim-0.19.0-paths.patch
new file mode 100644 (file)
index 0000000..71ccb14
--- /dev/null
@@ -0,0 +1,36 @@
+Default to <prefix>/usr/bin install.
+
+https://bugs.gentoo.org/635032
+--- a/tools/niminst/install.tmpl
++++ b/tools/niminst/install.tmpl
+@@ -28,13 +28,13 @@ if [ $# -eq 1 ] ; then
+       echo "sh deinstall.sh DIR"
+       exit 1
+       ;;
+-    "/usr/bin")
+-      bindir=/usr/bin
+-      configdir=/etc/?proj
+-      libdir=/usr/lib/?proj
+-      docdir=/usr/share/?proj/doc
+-      datadir=/usr/share/?proj/data
+-      nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
++    *)
++      bindir=$1/usr/bin
++      configdir=$1/etc/?proj
++      libdir=$1/usr/lib/?proj
++      docdir=$1/usr/share/?proj/doc
++      datadir=$1/usr/share/?proj/data
++      nimbleDir=$1"/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
+       ;;
+     "/usr/local/bin")
+       bindir=/usr/local/bin
+@@ -68,6 +68,9 @@ if [ $# -eq 1 ] ; then
+       ;;
+   esac
++  mkdir -p $bindir
++  mkdir -p $datadir
++
+   mkdir -p $libdir
+   mkdir -p $docdir
+   mkdir -p $configdir
diff --git a/dev-lang/nim/nim-0.19.0.ebuild b/dev-lang/nim/nim-0.19.0.ebuild
new file mode 100644 (file)
index 0000000..c86fab3
--- /dev/null
@@ -0,0 +1,79 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit bash-completion-r1 multiprocessing
+
+DESCRIPTION="compiled, garbage-collected systems programming language"
+HOMEPAGE="https://nim-lang.org/"
+SRC_URI="https://nim-lang.org/download/${P}.tar.xz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="doc +readline test"
+
+RESTRICT=test # need to sort out depends and numerous failures
+
+RDEPEND="
+       readline? ( sys-libs/readline:0= )
+"
+DEPEND="
+       ${DEPEND}
+       test? ( net-libs/nodejs )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-paths.patch
+)
+
+_run() {
+       echo "$@"
+       "$@" || die "'$*' failed"
+}
+
+nim_use_enable() {
+       [[ -z $2 ]] && die "usage: nim_use_enable <USE flag> <compiler flag>"
+       use $1 && echo "-d:$2"
+}
+
+src_compile() {
+       _run ./build.sh
+
+       _run ./bin/nim --parallelBuild:$(makeopts_jobs) c koch
+       _run ./koch boot --parallelBuild:$(makeopts_jobs) -d:release $(nim_use_enable readline useGnuReadline)
+       # build nimble and friends
+       # --stable to avoid pulling HEAD nimble
+       PATH="./bin:$PATH" _run ./koch --stable tools
+
+       if use doc; then
+               PATH="./bin:$PATH" _run ./koch web
+       fi
+}
+
+src_test() {
+       PATH="./bin:$PATH" _run ./koch test
+}
+
+src_install() {
+       PATH="./bin:$PATH" _run ./koch install "${ED%/}"
+       rm -r "${ED%/}/usr/share/nim/doc" || die "failed to remove 'doc'"
+
+       exeinto /usr/bin
+
+       local bin_exe
+       for bin_exe in bin/*; do
+               # './koch install' installs only 'nim' binary
+               # but not the rest
+               [[ ${bin_exe} == bin/nim ]] && continue
+               doexe "${bin_exe}"
+       done
+
+       if use doc; then
+               insinto /usr/share/doc/${PF}
+               dodoc doc/*.html
+       fi
+
+       newbashcomp tools/nim.bash-completion ${PN}
+}