diff options
Diffstat (limited to 'community/nim')
-rw-r--r-- | community/nim/APKBUILD | 131 | ||||
-rw-r--r-- | community/nim/nim-config-enable-ucontext.patch | 14 | ||||
-rw-r--r-- | community/nim/nim-config-fix-paths.patch | 18 | ||||
-rw-r--r-- | community/nim/nim-gdb-fix-posix-and-sysroot.patch | 28 | ||||
-rw-r--r-- | community/nim/niminst-fix-paths.patch | 53 |
5 files changed, 244 insertions, 0 deletions
diff --git a/community/nim/APKBUILD b/community/nim/APKBUILD new file mode 100644 index 00000000000..a60ef8eed2e --- /dev/null +++ b/community/nim/APKBUILD @@ -0,0 +1,131 @@ +# Contributor: Jakub Jirutka <jakub@jirutka.cz> +# Contributor: Nicolas Lorin <androw95220@gmail.com> +# Maintainer: Jakub Jirutka <jakub@jirutka.cz> +# +# WARNING: There may be breakages! +pkgname=nim +pkgver=2.0.4 +pkgrel=0 +pkgdesc="A systems and applications programming language" +url="https://nim-lang.org/" +arch="all !s390x" +license="MIT" +depends="libucontext-dev" # used by nims compiler +_gdb_depends="$pkgname gdb" +makedepends="$_gdb_depends" +checkdepends=" + gc-dev + nodejs + pcre + sqlite-libs + valgrind + " +provides="niminst=$pkgver-r$pkgrel" # backward compatibility (Alpine <3.20) +subpackages=" + $pkgname-dbg + $pkgname-gdb::noarch + $pkgname-dev + nimsuggest + " +source="https://nim-lang.org/download/nim-$pkgver.tar.xz + niminst-fix-paths.patch + nim-config-fix-paths.patch + nim-gdb-fix-posix-and-sysroot.patch + nim-config-enable-ucontext.patch + " + +# Don't run tests on armhf and ppc64le, it'd take eternity... +# Can't run tests on riscv64, no nodejs... +# riscv64, loongarch64: no valgrind +case "$CARCH" in + armhf | ppc64le | riscv64 | loongarch64) options="!check";; +esac + +export NIMFLAGS="${NIMFLAGS-} ${JOBS:+"--parallelBuild:$JOBS"}" + +build() { + msg2 "Building nim csources..." + ./build.sh + + msg2 "Building koch..." + ./bin/nim compile -d:release koch + + msg2 "Building nim..." + ./koch boot -d:release + + msg2 "Building tools..." + ./koch toolsNoExternal -d:release + + msg2 "Building niminst..." + ./bin/nim compile -d:release tools/niminst/niminst.nim +} + +check() { + # XXX: Some tests fail! + ./koch tests --pedantic --targets="c js" all || true +} + +package() { + DESTDIR="$pkgdir" ./koch install /usr/bin + + install -D -m 755 -t "$pkgdir"/usr/bin/ \ + bin/nim-gdb \ + bin/nim_dbg \ + bin/nimgrep \ + bin/nimpretty \ + bin/nimsuggest \ + bin/testament \ + tools/niminst/niminst + + install -D -m644 tools/debug/* -t "$pkgdir"/usr/lib/nim/tools/debug/ + + # This is imported from /usr/share/nimble/pkgs/nim-*/compiler/nimblecmd.nim. + mkdir -p "$pkgdir"/usr/share/nimble/pkgs/nim-$pkgver/dist + cp -r dist/checksums "$pkgdir"/usr/share/nimble/pkgs/nim-$pkgver/dist/ + + cd "$pkgdir" + rmdir usr/share/doc/nim + 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 + + # Fix wrong path for system.nim. + # https://github.com/nim-lang/Nim/issues/22369 + ln -s . usr/lib/nim/lib +} + +dbg() { + pkgdesc="$pkgdesc (debug build)" + + amove usr/bin/nim_dbg +} + +gdb() { + pkgdesc="$pkgdesc (gdb printers)" + depends="$_gdb_depends" + + amove usr/bin/nim-gdb + amove usr/lib/nim/tools/debug +} + +dev() { + pkgdesc="$pkgdesc (development files)" + + amove usr/bin/testament +} + +nimsuggest() { + pkgdesc="idetools for the nim language" + + amove usr/bin/nimsuggest +} + +sha512sums=" +1918b3d4a4fc02714677b2ca5051dc69e1d1daead2cf4dcc9b997076540d07d58ee4fe3049de86a37faa3143de1d3b95bedfa31f31d8463987bb267107459793 nim-2.0.4.tar.xz +26eb35cdaae908c96c20889b3561d0fb7ef3f6bdfe0c582eaa6122c7982a032a3e50174175dfb67b919b9e38691849d87966a9c093677774491e32b49eed3c6b niminst-fix-paths.patch +7667963a1f3370a7625c1ee6575239f20ea501b0ba8342f8dcea6020692411fc177e7f101edd81a48bb3885e1d1cbece2d6ecd1a4d7640f0f78de109a97eeea9 nim-config-fix-paths.patch +4f94829c0e0692b5563f871779b53d3639ffe0926aaacfc54a346fbc56fdad999ddbbeda894f54a243ff21c05dbc29668b3ae93c01b319f573d1b585116e2334 nim-gdb-fix-posix-and-sysroot.patch +4bff5b687fc4154a4b3c8e888e4fcdd2340acfcc87b1a5eeaa9feb173cadd6047bd73d68983461c1edcec232aca6014dbeab8efaedcf4d8a52662780de4b51d3 nim-config-enable-ucontext.patch +" diff --git a/community/nim/nim-config-enable-ucontext.patch b/community/nim/nim-config-enable-ucontext.patch new file mode 100644 index 00000000000..d203ad394c1 --- /dev/null +++ b/community/nim/nim-config-enable-ucontext.patch @@ -0,0 +1,14 @@ +diff -ruN a/config/nim.cfg b/config/nim.cfg +--- a/config/nim.cfg 2018-02-15 00:45:38.251038499 +0100 ++++ b/config/nim.cfg 2018-02-15 00:46:48.937858896 +0100 +@@ -291,6 +291,10 @@ vcc.cpp.options.size = "/O1" + # Configuration for the Tiny C Compiler: + tcc.options.always = "-w" + ++# Enable libucontext ++gcc.options.linker %= "-lucontext" ++llvm_gcc.options.linker %= "-lucontext" ++ + @if arm or arm64: + --define:nimEmulateOverflowChecks + @end diff --git a/community/nim/nim-config-fix-paths.patch b/community/nim/nim-config-fix-paths.patch new file mode 100644 index 00000000000..6fe6139983d --- /dev/null +++ b/community/nim/nim-config-fix-paths.patch @@ -0,0 +1,18 @@ +Updated: 23 Feb 2022 by Nicolas Lorin <androw95220@gmail.com> +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.new +@@ -44,8 +44,8 @@ + path="$lib/pure" + + @if not windows: +- nimblepath="/opt/nimble/pkgs2/" +- nimblepath="/opt/nimble/pkgs/" ++ nimblepath="/usr/share/nimble/pkgs2/" ++ nimblepath="/usr/share/nimble/pkgs/" + @else: + # TODO: + @end diff --git a/community/nim/nim-gdb-fix-posix-and-sysroot.patch b/community/nim/nim-gdb-fix-posix-and-sysroot.patch new file mode 100644 index 00000000000..0d1b22f076f --- /dev/null +++ b/community/nim/nim-gdb-fix-posix-and-sysroot.patch @@ -0,0 +1,28 @@ +From: Jakub Jirutka <jakub@jirutka.cz> +Date: Tue, 02 Apr 2024 23:28:26 +0200 +Subject: [PATCH] Fix nim-gdb to be POSIX-sh and fix sysroot + +--- a/bin/nim-gdb ++++ b/bin/nim-gdb +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # Exit if anything fails + set -e +@@ -7,11 +7,10 @@ + which gdb > /dev/null || (echo "gdb not in PATH"; exit 1) + which readlink > /dev/null || (echo "readlink not in PATH."; exit 1) + +-if [[ $(uname -s) == Darwin || $(uname -s) == *BSD ]]; then +- NIM_SYSROOT=$(dirname $(dirname $(readlink -f $(which nim)))) +-else +- NIM_SYSROOT=$(dirname $(dirname $(readlink -e $(which nim)))) +-fi ++case "$(uname -s)" in ++ Darwin | *BSD) NIM_SYSROOT="$(dirname $(dirname $(readlink -f $(which nim))))";; ++ *) NIM_SYSROOT="$(dirname $(dirname $(readlink -f $(which nim))))/lib/nim";; ++esac + + # Find out where the pretty printer Python module is + GDB_PYTHON_MODULE_PATH="$NIM_SYSROOT/tools/debug/nim-gdb.py" diff --git a/community/nim/niminst-fix-paths.patch b/community/nim/niminst-fix-paths.patch new file mode 100644 index 00000000000..59d83f5bf2c --- /dev/null +++ b/community/nim/niminst-fix-paths.patch @@ -0,0 +1,53 @@ +From: Jakub Jirutka <jakub@jirutka.cz> +Date: Tue, 23 Aug 2017 22:57:00 +0200 +Date: Sat, 31 Jul 2021 16:02:04 +0200 +Date: Tue, 02 Apr 2024 22:31:52 +0200 +Subject: [PATCH] Patch niminst's (de)install paths to be FHS/Alpine compliant + +--- a/tools/niminst/install.nimf ++++ b/tools/niminst/install.nimf +@@ -32,9 +32,9 @@ + bindir=$1 + configdir="/etc/?proj" + 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=$1 +@@ -42,7 +42,7 @@ + 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" ++ nimbleDir="/usr/local/share/nimble/pkgs/?c.nimblePkgName-?c.version" + ;; + "/opt") + bindir="/opt/?proj/bin" +--- a/tools/niminst/deinstall.nimf ++++ b/tools/niminst/deinstall.nimf +@@ -19,17 +19,17 @@ if [ $# -eq 1 ] ; then + bindir=/usr/bin + configdir=/etc/?proj + 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/?proj + 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/local/share/nimble/pkgs/?c.nimblePkgName-?c.version" + ;; + "/opt") + bindir="/opt/?proj/bin" |