pkgbase=mingw-w64-nim pkgname=("${MINGW_PACKAGE_PREFIX}-nim") pkgdesc='Imperative, multi-paradigm, compiled programming language' url='https://github.com/nim-lang/Nim' license=('MIT') options=('!emptydirs') provides=('nim' 'nimble') conflicts=('nim' 'nimble') pkgver=1.6.4 _csources=561b417c65791cd8356b5f73620914ceff845d10 _nimble=0.13.1 pkgrel=1 arch=('i686' 'x86_64') depends=("${MINGW_PACKAGE_PREFIX}-openssl") source=(nim-${pkgver}.tar.gz::https://github.com/nim-lang/Nim/archive/v${pkgver}.tar.gz csources_v1-${_csources}.tar.gz::https://github.com/nim-lang/csources_v1/archive/${_csources}.tar.gz nimble-${_nimble}.tar.gz::https://github.com/nim-lang/nimble/archive/v${_nimble}.tar.gz '0001-Use-unixy-filenames-even-on-Windows.patch' '0002-Always-look-in-unix-paths.patch' '0003-Check-lib-nim-subdirectory.patch' '0004-Use-mingw64-dlls.patch') sha256sums=('46beadcf4d606d0bbbf4bf93e5fa8a9d18baa1a7171eb2586a894099fd925b12' '71c823444c794a12da9027d19d6a717dd7759521ecbbe28190b08372142607ec' 'e6aa8d9ee4b3ed0321dca329b4a38fa546771b9729984482fb50fe73d3777f5d' '3010acbe7769ea214dd51f5889e3a26b44925001905deb04b060beaede2578f4' '047036575b23b607f992981da7d53f027ed05d533b7b02fecc42782466e410e4' '1b3c72c6cae8af9e297bbd345ab655e51eec7012f0d0dcf873904cc6f28e77d4' '169ff8e04af1fb10ab06604b517ba8f4e98f4341d29fbbb10af3d3e360085dfc') prepare() { cd "${srcdir}/nim-${pkgver}" rm -rf csources nimble mv "../csources_v1-${_csources}" csources mv "../nimble-${_nimble}" nimble 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 patch -p1 -i "${srcdir}/0001-Use-unixy-filenames-even-on-Windows.patch" patch -p1 -i "${srcdir}/0002-Always-look-in-unix-paths.patch" patch -p1 -i "${srcdir}/0003-Check-lib-nim-subdirectory.patch" patch -p1 -i "${srcdir}/0004-Use-mingw64-dlls.patch" } build() { cd "${srcdir}/nim-${pkgver}" msg2 "Building nim" (cd csources; sh build.sh) msg2 "Building koch" ./bin/nim c -d:release koch ./koch boot -d:release -d:nativeStacktrace -d:useGnuReadline msg2 "Building libs" (cd lib; ../bin/nim c --app:lib -d:createNimRtl -d:release nimrtl.nim) msg2 "Building tools" (cd tools; ../bin/nim c -d:release nimgrep.nim) msg2 "Building nimsuggest" ./bin/nim c -d:release nimsuggest/nimsuggest.nim msg2 "Building Nimble" (cd nimble; ../bin/nim c -d:release src/nimble) } package() { cd "${srcdir}/nim-${pkgver}" export PATH="${srcdir}/nim-${pkgver}/bin:${PATH}" ./koch install "${pkgdir}" install -Dm 755 bin/nim -t "${pkgdir}${MINGW_PREFIX}/bin" install -Dm 755 nimble/src/nimble -t "${pkgdir}${MINGW_PREFIX}/bin" install -d "${pkgdir}${MINGW_PREFIX}/lib" cp -a lib "${pkgdir}${MINGW_PREFIX}/lib/nim" cp -a compiler "${pkgdir}${MINGW_PREFIX}/lib/nim" install -Dm 644 compiler.nimble "${pkgdir}${MINGW_PREFIX}/lib/nim/compiler" install -m 755 lib/libnimrtl.dll "${pkgdir}${MINGW_PREFIX}/lib/libnimrtl.dll" # Fix FS#48118, related to the doc2 command # ln -s ${MINGW_PREFIX}/share/nim/doc "${pkgdir}${MINGW_PREFIX}/lib/nim/doc" install -Dm 644 config/* -t "${pkgdir}${MINGW_PREFIX}/etc/nim" install -Dm 755 bin/* tools/nimgrep nimsuggest/nimsuggest -t "${pkgdir}${MINGW_PREFIX}/bin" # Fix FS#50252, unusual placement of header files install -d "${pkgdir}${MINGW_PREFIX}/include" cp -a "${pkgdir}${MINGW_PREFIX}/lib/nim/"*.h "${pkgdir}${MINGW_PREFIX}/include" install -d "${pkgdir}${MINGW_PREFIX}/share/nim/doc" cp -a doc/* "${pkgdir}${MINGW_PREFIX}/share/nim/doc" install -Dm 644 copying.txt -t "${pkgdir}${MINGW_PREFIX}/share/licenses/${pkgname}" rm -r "${pkgdir}/nim" # Nimble looks for nimscriptapi.nim in /usr/bin/nimblepkg/, of all places. cp -r nimble/src/nimblepkg "${pkgdir}${MINGW_PREFIX}/share/nimble" cp -r "${pkgdir}${MINGW_PREFIX}/share/nimble" "${pkgdir}${MINGW_PREFIX}/bin/nimblepkg" }