From fefbc00e9de02214596268fcf059a6709b3129c3 Mon Sep 17 00:00:00 2001 From: kj-sh604 Date: Fri, 11 Apr 2025 21:01:44 -0400 Subject: feat: add nim-compat --- nim-compat/.SRCINFO | 28 ++++++++++++ nim-compat/.gitignore | 5 +++ nim-compat/PKGBUILD | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+) create mode 100644 nim-compat/.SRCINFO create mode 100644 nim-compat/.gitignore create mode 100644 nim-compat/PKGBUILD diff --git a/nim-compat/.SRCINFO b/nim-compat/.SRCINFO new file mode 100644 index 0000000..f54783b --- /dev/null +++ b/nim-compat/.SRCINFO @@ -0,0 +1,28 @@ +pkgbase = nim + pkgdesc = Imperative, multi-paradigm, compiled programming language + pkgver = 2.0.8 + pkgrel = 1 + url = https://nim-lang.org/ + arch = x86_64 + license = MIT + makedepends = git + depends = bash + depends = gcc + depends = gcc-libs + depends = glibc + provides = nimble + conflicts = nimble + replaces = nimble + options = !emptydirs + backup = etc/nim/nim.cfg + backup = etc/nim/nimdoc.cfg + backup = etc/nim/nimdoc.tex.cfg + backup = etc/nim/rename.rules.cfg + source = https://github.com/nim-lang/Nim/archive/v2.2.2/nim-2.2.2.tar.gz + source = git+https://github.com/nim-lang/csources_v2.git#commit=86742fb02c6606ab01a532a0085784effb2e753e + sha256sums = 4b70f050fcb64b7cd6e4acc295c6a16feab6f6380127cbee49b02a0cc2c6ce1f + sha256sums = 130a6d21808f43da421057385a5a8fd0a6ebd0d211211d3edd645eefd4fc7087 + b2sums = 01c193eb0153cef7408c12bd3c3a8167fc1ae5a06b263593574de0185fdc822c5a9a903cd7daab5d01cd07a9919b80cef0554d9767f51eb35b3a330184da153d + b2sums = 2325bebb91b56f9373df83366efb308994fececc0f73acb2ad7b0822fc549d101026a5c1bf7c5ff7fd534e57f9e956f167bbfe00223fe3db0b487175cf0ca369 + +pkgname = nim diff --git a/nim-compat/.gitignore b/nim-compat/.gitignore new file mode 100644 index 0000000..1cbcfa6 --- /dev/null +++ b/nim-compat/.gitignore @@ -0,0 +1,5 @@ +pkg/ +src/ +csources_*/ +*.toml +*.tar* diff --git a/nim-compat/PKGBUILD b/nim-compat/PKGBUILD new file mode 100644 index 0000000..9b30274 --- /dev/null +++ b/nim-compat/PKGBUILD @@ -0,0 +1,120 @@ +# Maintainer: Levente Polyak +# Contributor: Alexander F Rødseth +# Contributor: Dominik Picheta +# Contributor: Sven-Hendrik Haase +# Contributor: Jesus Alvarez + +pkgname=nim +_pkgname=Nim +pkgver=2.0.8 +_pkgver=2.2.2 +_csourcesver=86742fb02c6606ab01a532a0085784effb2e753e +pkgrel=1 +pkgdesc='Imperative, multi-paradigm, compiled programming language' +url='https://nim-lang.org/' +arch=(x86_64) +license=(MIT) +depends=( + bash + gcc + gcc-libs + glibc +) +makedepends=( + git +) +provides=(nimble) +conflicts=(nimble) +replaces=(nimble) +options=('!emptydirs') +backup=( + etc/nim/nim.cfg + etc/nim/nimdoc.cfg + etc/nim/nimdoc.tex.cfg + etc/nim/rename.rules.cfg +) +source=(https://github.com/nim-lang/Nim/archive/v${_pkgver}/${pkgname}-${_pkgver}.tar.gz + "git+https://github.com/nim-lang/csources_v2.git#commit=${_csourcesver}") +sha256sums=('4b70f050fcb64b7cd6e4acc295c6a16feab6f6380127cbee49b02a0cc2c6ce1f' + '130a6d21808f43da421057385a5a8fd0a6ebd0d211211d3edd645eefd4fc7087') +b2sums=('01c193eb0153cef7408c12bd3c3a8167fc1ae5a06b263593574de0185fdc822c5a9a903cd7daab5d01cd07a9919b80cef0554d9767f51eb35b3a330184da153d' + '2325bebb91b56f9373df83366efb308994fececc0f73acb2ad7b0822fc549d101026a5c1bf7c5ff7fd534e57f9e956f167bbfe00223fe3db0b487175cf0ca369') + +prepare() { + cd ${_pkgname}-${_pkgver} + cp -r ../csources_v2/* . + rm bin/empty.txt + for nimcfg in {compiler,config}/nim.cfg; do + echo "gcc.options.always %= \"\${gcc.options.always} ${CFLAGS:-} ${CPPFLAGS}\"" >> "${nimcfg}" + echo "gcc.options.linker %= \"\${gcc.options.linker} ${LDFLAGS:-}\"" >> "${nimcfg}" + done +} + +build() { + cd ${_pkgname}-${_pkgver} + export PATH="${srcdir}/${_pkgname}-${_pkgver}/bin:${PATH}" + + echo "Building nim" + sh build.sh + + echo "Building koch" + nim c -d:release koch + ./koch boot -d:release -d:nativeStacktrace -d:useGnuReadline + + echo "Building libs" + (cd lib + nim c --app:lib -d:createNimRtl -d:release nimrtl.nim + ) + + echo "Building tools" + ./koch tools + (cd tools + nim c -d:release nimgrep.nim + ) + + echo "Building nimsuggest" + nim c -d:release nimsuggest/nimsuggest.nim +} + +package() { + cd ${_pkgname}-${_pkgver} + export PATH="${srcdir}/${_pkgname}-${_pkgver}/bin:${PATH}" + + ./koch install "${pkgdir}" + + install -d "${pkgdir}/usr/lib" + cp -a lib "${pkgdir}/usr/lib/nim" + cp -a compiler "${pkgdir}/usr/lib/nim" + install -Dm 644 nim.nimble "${pkgdir}/usr/lib/nim/compiler" + install -m 755 lib/libnimrtl.so "${pkgdir}/usr/lib/libnimrtl.so" + + install -Dm 644 config/* -t "${pkgdir}/etc/nim" + install -Dm 755 bin/* -t "${pkgdir}/usr/bin" + + # Fix FS#50252, unusual placement of header files + install -d "${pkgdir}/usr/include" + cp -a "${pkgdir}/usr/lib/nim/"*.h "${pkgdir}/usr/include" + + # Fix FS#48118, related to the doc2 command + ln -s /usr/share/nim/doc "${pkgdir}/usr/lib/nim/doc" + install -d "${pkgdir}/usr/share/nim/doc" + cp -a doc/* "${pkgdir}/usr/share/nim/doc" + + # Fix wrong path for system.nim https://github.com/nim-lang/Nim/issues/22369 + ln -s /usr/lib/nim "$pkgdir"/usr/lib/nim/lib + + install -Dm 644 copying.txt -t "${pkgdir}/usr/share/licenses/${pkgname}" + + # completions + for comp in tools/*.bash-completion; do + install -Dm 644 "${comp}" "${pkgdir}/usr/share/bash-completion/completions/$(basename "${comp/.bash-completion}")" + done + for comp in tools/*.zsh-completion; do + install -Dm 644 "${comp}" "${pkgdir}/usr/share/zsh/site-functions/_$(basename "${comp/.zsh-completion}")" + done + + rm -r "${pkgdir}/nim" + rm "${pkgdir}"/usr/bin/nim-gdb.bat +} + +# vim: ts=2 sw=2 et: -- cgit v1.2.3