121 lines
4.1 KiB
Bash
121 lines
4.1 KiB
Bash
# Maintainer: David Macek <david.macek.0@gmail.com>
|
|
|
|
# TODO: include more stuff from tools/?
|
|
|
|
_realname=nim
|
|
pkgbase=mingw-w64-${_realname}
|
|
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
|
pkgver=1.6.12
|
|
_csourcesver=561b417c65791cd8356b5f73620914ceff845d10
|
|
pkgrel=1
|
|
pkgdesc='Imperative, multi-paradigm, compiled programming language (mingw-w64)'
|
|
arch=('any')
|
|
mingw_arch=('mingw64' 'ucrt64' 'clang64')
|
|
url='https://nim-lang.org/'
|
|
msys2_references=(
|
|
"cpe: cpe:/a:nim-lang:nim"
|
|
"cpe: cpe:/a:nim-lang:nim-lang"
|
|
)
|
|
license=('spdx:MIT')
|
|
makedepends=('git' "${MINGW_PACKAGE_PREFIX}-cc")
|
|
options=(!emptydirs)
|
|
source=(https://github.com/nim-lang/Nim/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz
|
|
"git+https://github.com/nim-lang/csources_v1.git#commit=${_csourcesver}"
|
|
"0001-Use-unixy-filenames-even-on-Windows.patch"
|
|
"0002-Fix-config-path.patch"
|
|
"0003-Fix-library-path.patch"
|
|
"0004-Fix-nimrtl-dll-name.patch"
|
|
"0005-Fix-pcre-dll-name.patch"
|
|
"0006-Fix-sqlite3-dll-name.patch"
|
|
"0007-Fix-openssl-dll-name.patch")
|
|
sha256sums=('0ce3f0aa9bbf91ecba0ccd812e62294f83eb37c985c466c57ae25c04aedd330b'
|
|
'SKIP'
|
|
'3010acbe7769ea214dd51f5889e3a26b44925001905deb04b060beaede2578f4'
|
|
'e4616080589f8140dbf4e4dc8afff1dddd95c93af51e2754bd84606cee415386'
|
|
'214e5835c9220b2f2951c9b1d62a1ab44f73e4d0f6dbabf3b284405ddac2c78f'
|
|
'35a60e8c4ccff04ac9adb4b7d13c6e1e72b96dac9361173e4a44b1662107eea3'
|
|
'fa475808c100a86174ae348faaa4048d09e56406cb54c2f795da9d733605b003'
|
|
'008a090cf561124796daaab8390f495bc740a4ec8936eb96bc025cee6e017e3d'
|
|
'371a3133fd00d748199364ce2c6a2c23e0105c20fa236b46c2d7f61f2ffd7442')
|
|
|
|
prepare() {
|
|
cd "${srcdir}"
|
|
|
|
cd "${_realname}-${pkgver}"
|
|
cp -r ../csources_v1/* .
|
|
|
|
patch -p1 -i "${srcdir}/0001-Use-unixy-filenames-even-on-Windows.patch"
|
|
patch -p1 -i "${srcdir}/0002-Fix-config-path.patch"
|
|
patch -p1 -i "${srcdir}/0003-Fix-library-path.patch"
|
|
patch -p1 -i "${srcdir}/0004-Fix-nimrtl-dll-name.patch"
|
|
patch -p1 -i "${srcdir}/0005-Fix-pcre-dll-name.patch"
|
|
patch -p1 -i "${srcdir}/0006-Fix-sqlite3-dll-name.patch"
|
|
patch -b -p1 -i "${srcdir}/0007-Fix-openssl-dll-name.patch"
|
|
|
|
if [[ ${MSYSTEM} == CLANG* ]]; then
|
|
echo "cc = clang" >> "config/nim.cfg"
|
|
fi
|
|
}
|
|
|
|
build() {
|
|
cd "${srcdir}/${_realname}-${pkgver}"
|
|
|
|
msg2 "Building nim"
|
|
sh build.sh --cpu ${MINGW_CHOST}
|
|
|
|
msg2 "Building koch"
|
|
./bin/nim c -d:release koch
|
|
./koch boot -d:release -d:useGnuReadline
|
|
|
|
export PATH="${srcdir}/${_realname}-${pkgver}/bin:$PATH"
|
|
|
|
msg2 "Building libs"
|
|
pushd lib
|
|
nim c --app:lib -d:createNimRtl -d:release nimrtl.nim
|
|
popd
|
|
|
|
msg2 "Building tools"
|
|
pushd tools
|
|
nim c -d:release nimgrep.nim
|
|
popd
|
|
|
|
msg2 "Building nimsuggest"
|
|
nim c -d:release nimsuggest/nimsuggest.nim
|
|
}
|
|
|
|
package() {
|
|
cd "${srcdir}/${_realname}-${pkgver}"
|
|
|
|
export PATH="${srcdir}/${_realname}-${pkgver}/bin:$PATH"
|
|
|
|
./koch install "${pkgdir}"
|
|
|
|
mkdir -p "${pkgdir}${MINGW_PREFIX}/lib"
|
|
cp -a lib "${pkgdir}${MINGW_PREFIX}/lib/nim"
|
|
cp -a compiler "${pkgdir}${MINGW_PREFIX}/lib/nim"
|
|
|
|
mkdir -p "${pkgdir}${MINGW_PREFIX}/bin"
|
|
cp "lib/libnimrtl.dll" "${pkgdir}${MINGW_PREFIX}/bin"
|
|
|
|
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"
|
|
|
|
mkdir -p "${pkgdir}${MINGW_PREFIX}/share/nim/doc"
|
|
cp -r "doc"/* "${pkgdir}${MINGW_PREFIX}/share/nim/doc/"
|
|
mkdir -p "${pkgdir}${MINGW_PREFIX}/lib/nim/doc"
|
|
cp doc/{basicopt.txt,advopt.txt} "${pkgdir}${MINGW_PREFIX}/lib/nim/doc/"
|
|
|
|
mkdir -p "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}"
|
|
cp "copying.txt" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
|
|
|
|
# clean up after koch install
|
|
rm -r "${pkgdir}/nim"
|
|
rm -f "${pkgdir}"${MINGW_PREFIX}/bin/*.txt
|
|
rm -r "${pkgdir}"${MINGW_PREFIX}/lib/nim/*.dll
|
|
rm -r "${pkgdir}"${MINGW_PREFIX}/lib/nim/compiler/*.exe
|
|
}
|