pkgbase=mingw-w64-nim-git pkgname=("${MINGW_PACKAGE_PREFIX}-nim-git") pkgver=20180209 pkgrel=1 arch=('i686' 'x86_64') groups=('nim') depends=("${MINGW_PACKAGE_PREFIX}-openssl") makedepends=('git') source=(git+https://github.com/nim-lang/Nim git+https://github.com/nim-lang/csources git+https://github.com/nim-lang/nimble git+https://github.com/nim-lang/nimsuggest "0001-Use-unixy-filenames-even-on-Windows.patch" "0002-Always-look-in-unix-paths.patch" "0003-Check-lib-nim-subdirectory.patch" "0004-Use-nimOldDlls.patch") sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' '3010acbe7769ea214dd51f5889e3a26b44925001905deb04b060beaede2578f4' 'fac04c8caa29a545275cd19a0fac597649c8ad9e7556fe65802e28c88c8905ac' '3cfe161bd1e19f621e2ff824a59362e4f3d4d2a4d27a2653bae1d83ba23ab9b1' '5e97d3ad36f8c4fd29ba69f4a8c613d9a57006da35109c616f4a288f5955a276') pkgver() { cd "$srcdir/Nim" git log -1 --format="%cd" --date=short | sed "s|-||g" } prepare() { cd "$srcdir/Nim" msg2 'Cloning csources...' [ -d csources ] && rm -rf csources git clone --local "$srcdir/csources" 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-nimOldDlls.patch" } build() { cd "$srcdir/Nim" msg2 'Building csources...' pushd csources sh build.sh popd msg2 'Building Nim...' ./bin/nim c -d:release koch ./koch boot -d:release -d:nativeStacktrace -d:useGnuReadline msg2 'Building Nimble...' ./koch nimble msg2 'Building nimgrep and nimsuggest...' ./koch tools msg2 'Building libnimrtl...' pushd lib ../bin/nim c --app:lib -d:createNimRtl -d:release nimrtl.nim popd } package() { pkgdesc="Compiled, garbage-collected systems programming language which has an excellent productivity/performance ratio" url="https://github.com/nim-lang/Nim" license=('MIT') options=('!emptydirs') provides=('nim' 'nimble') conflicts=('nim' 'nimble') cd "$srcdir/Nim" msg2 'Installing Nim license...' install -Dm 644 "copying.txt" -t "$pkgdir$MINGW_PREFIX/share/licenses/nim" msg2 'Installing Nim documentation...' install -dm 755 "$pkgdir$MINGW_PREFIX/share/doc/nim" cp -dpr --no-preserve=ownership examples web doc/* "$pkgdir$MINGW_PREFIX/share/doc/nim" msg2 'Installing Nim...' ./koch install "$pkgdir" install -Dm 755 bin/{nim,nimgrep} -t "$pkgdir$MINGW_PREFIX/bin" cd "$pkgdir/nim" install -dm 755 "$pkgdir$MINGW_PREFIX/etc" "$pkgdir$MINGW_PREFIX/lib/nim" find lib -mindepth 1 -maxdepth 1 -exec \ cp -dpr --no-preserve=ownership '{}' "$pkgdir$MINGW_PREFIX/lib/nim" \; find config -mindepth 1 -maxdepth 1 -exec \ cp -dpr --no-preserve=ownership '{}' "$pkgdir$MINGW_PREFIX/etc/" \; cp -dpr --no-preserve=ownership "$srcdir/Nim/lib/packages" \ "$pkgdir$MINGW_PREFIX/lib/nim" # https://bugs.archlinux.org/task/50252 msg2 'Fixing unusual placement of header files...' install -dm 755 "$pkgdir$MINGW_PREFIX/include" for _header in cycle nimbase; do cp "$pkgdir$MINGW_PREFIX/lib/nim/${_header}.h" "$pkgdir$MINGW_PREFIX/include/${_header}.h" done msg2 'Fixing unusual placement of shared object files...' cp "$pkgdir$MINGW_PREFIX/lib/nim/libnimrtl.dll" "$pkgdir$MINGW_PREFIX/lib/libnimrtl.dll" msg2 'Cleaning up pkgdir...' find "$pkgdir" -type d -name .git -exec rm -r '{}' + find "$pkgdir" -type f -name .gitignore -exec rm -r '{}' + rm -rf "$pkgdir/nim" # nimble cd "$srcdir/nimble" msg2 'Installing Nimble license...' install -Dm 644 license.txt -t "$pkgdir$MINGW_PREFIX/share/licenses/nimble" msg2 'Installing Nimble documentation...' install -Dm 644 *.markdown -t "$pkgdir$MINGW_PREFIX/share/doc/nimble" msg2 'Installing Nimble...' install -Dm 755 "$srcdir/Nim/bin/nimble" -t "$pkgdir$MINGW_PREFIX/bin" # Nimble looks for nimscriptapi.nim in /usr/bin/nimblepkg/, of all places. install -dm 755 "$pkgdir$MINGW_PREFIX/share/nimble" cp -dpr --no-preserve=ownership src/nimblepkg "$pkgdir$MINGW_PREFIX/share/nimble" cp -dpr --no-preserve=ownership "$pkgdir$MINGW_PREFIX/share/nimble" "$pkgdir$MINGW_PREFIX/bin/nimblepkg" msg2 'Installing Nimble bash completion...' install -Dm 644 nimble.bash-completion \ "$pkgdir$MINGW_PREFIX/share/bash-completion/completions/nimble" }