Browse Source

rewrite nim-git package, dropping git

master
Connor Olding 5 months ago
parent
commit
d231e93ead

+ 4
- 3
README.md View File

@@ -3,10 +3,11 @@ some of them are for Arch Linux, some of them are for MSYS2,
some of them work with both.
heads up: these are likely to be out of date.

### mingw-w64-nim-git
### mingw-w64-nim

patches nim to compile with MSYS2, and use MSYS2 paths/DLLs.
a few things aren't working yet, but the core functionality is there.
patches nim 1.0.0 to compile with MSYS2, and use MSYS2 paths/DLLs.
a few things might not work, but the core functionality
(including nimble) is working.

### mingw-w64-tbox


+ 0
- 4
mingw-w64-nim-git/.gitignore View File

@@ -1,4 +0,0 @@
Nim
nimble
nimsuggest
csources

+ 0
- 13
mingw-w64-nim-git/0002-Always-look-in-unix-paths.patch View File

@@ -1,13 +0,0 @@
diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim
index 808159b..12e0b49 100644
--- a/compiler/nimconf.nim
+++ b/compiler/nimconf.nim
@@ -221,7 +221,7 @@ proc getSystemConfigPath(filename: string): string =
# the UNIX way)
let p = getPrefixDir()
result = joinPath([p, "config", filename])
- when defined(unix):
+ when true:
if not existsFile(result): result = joinPath([p, "etc", filename])
if not existsFile(result): result = "/etc/" & filename

+ 0
- 15
mingw-w64-nim-git/0003-Check-lib-nim-subdirectory.patch View File

@@ -1,15 +0,0 @@
diff --git a/compiler/options.nim b/compiler/options.nim
index 6372cdd..1354da0 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -229,6 +229,10 @@ proc setDefaultLibpath*() =
else: libpath = joinPath(prefix, "lib")
else: libpath = joinPath(prefix, "lib")
+ if not fileExists(libpath / "system.nim") and
+ fileExists(libpath / "nim" / "system.nim"):
+ libpath = libpath / "nim"
+
# Special rule to support other tools (nimble) which import the compiler
# modules and make use of them.
let realNimPath = findExe("nim")

+ 0
- 39
mingw-w64-nim-git/0004-Use-nimOldDlls.patch View File

@@ -1,39 +0,0 @@
diff --git a/lib/wrappers/openssl.nim b/lib/wrappers/openssl.nim
index 5521476..2453c16 100644
--- a/lib/wrappers/openssl.nim
+++ b/lib/wrappers/openssl.nim
@@ -14,7 +14,7 @@
const useWinVersion = defined(Windows) or defined(nimdoc)
when useWinVersion:
- when not defined(nimOldDlls) and defined(cpu64):
+ when not true and defined(cpu64):
const
DLLSSLName = "(ssleay64|libssl64).dll"
DLLUtilName = "libeay64.dll"
diff --git a/lib/wrappers/pcre.nim b/lib/wrappers/pcre.nim
index 6c7088b..8b0e7f6 100644
--- a/lib/wrappers/pcre.nim
+++ b/lib/wrappers/pcre.nim
@@ -310,7 +310,7 @@ type
when not defined(usePcreHeader):
when hostOS == "windows":
- when defined(nimOldDlls):
+ when true:
const pcreDll = "pcre.dll"
elif defined(cpu64):
const pcreDll = "pcre64.dll"
diff --git a/lib/wrappers/sqlite3.nim b/lib/wrappers/sqlite3.nim
index a129458..5e84a9b 100644
--- a/lib/wrappers/sqlite3.nim
+++ b/lib/wrappers/sqlite3.nim
@@ -9,7 +9,7 @@
{.deadCodeElim: on.}
when defined(windows):
- when defined(nimOldDlls):
+ when true:
const Lib = "sqlite3.dll"
elif defined(cpu64):
const Lib = "sqlite3_64.dll"

+ 0
- 131
mingw-w64-nim-git/PKGBUILD View File

@@ -1,131 +0,0 @@
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"
}

mingw-w64-nim-git/0001-Use-unixy-filenames-even-on-Windows.patch → mingw-w64-nim/0001-Use-unixy-filenames-even-on-Windows.patch View File


+ 11
- 0
mingw-w64-nim/0002-Always-look-in-unix-paths.patch View File

@@ -0,0 +1,11 @@
--- a/compiler/nimconf.nim
+++ b/compiler/nimconf.nim
@@ -227,7 +227,7 @@
# the UNIX way)
let p = getPrefixDir(conf)
result = p / RelativeDir"config" / filename
- when defined(unix):
+ when true:
if not fileExists(result): result = p / RelativeDir"etc/nim" / filename
if not fileExists(result): result = AbsoluteDir"/etc/nim" / filename

+ 13
- 0
mingw-w64-nim/0003-Check-lib-nim-subdirectory.patch View File

@@ -0,0 +1,13 @@
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -507,6 +507,10 @@
else:
conf.libpath = prefix / RelativeDir"lib"
+ if not fileExists(conf.libpath.string / "system.nim") and
+ fileExists(conf.libpath.string / "nim" / "system.nim"):
+ conf.libpath = conf.libpath / RelativeDir"nim"
+
# Special rule to support other tools (nimble) which import the compiler
# modules and make use of them.
let realNimPath = findExe("nim")

+ 43
- 0
mingw-w64-nim/0004-Use-mingw64-dlls.patch View File

@@ -0,0 +1,43 @@
--- a/lib/wrappers/openssl.nim
+++ b/lib/wrappers/openssl.nim
@@ -53,7 +53,7 @@
from posix import SocketHandle
elif useWinVersion:
- when not defined(nimOldDlls) and defined(cpu64):
+ when defined(cpu64):
const
DLLSSLName* = "(libssl-1_1-x64|ssleay64|libssl64).dll"
DLLUtilName* = "(libcrypto-1_1-x64|libeay64).dll"
--- a/lib/wrappers/pcre.nim
+++ b/lib/wrappers/pcre.nim
@@ -314,12 +314,7 @@
when not defined(usePcreHeader):
when hostOS == "windows":
- when defined(nimOldDlls):
- const pcreDll = "pcre.dll"
- elif defined(cpu64):
- const pcreDll = "pcre64.dll"
- else:
- const pcreDll = "pcre32.dll"
+ const pcreDll = "libpcre-1.dll"
elif hostOS == "macosx":
const pcreDll = "libpcre(.3|.1|).dylib"
else:
--- a/lib/wrappers/sqlite3.nim
+++ b/lib/wrappers/sqlite3.nim
@@ -13,12 +13,7 @@
{.push styleChecks: off.}
when defined(windows):
- when defined(nimOldDlls):
- const Lib = "sqlite3.dll"
- elif defined(cpu64):
- const Lib = "sqlite3_64.dll"
- else:
- const Lib = "sqlite3_32.dll"
+ const Lib = "libsqlite3-0.dll"
elif defined(macosx):
const
Lib = "libsqlite3(|.0).dylib"

+ 104
- 0
mingw-w64-nim/PKGBUILD View File

@@ -0,0 +1,104 @@
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.0.0
_csources=0.20.0
_nimble=0.11.0
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-${_csources}.tar.gz::https://github.com/nim-lang/csources/archive/v${_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=('6d93d25da6b5ef4e0223acb1f1abadf06be1019a8137491ddc7c6fa030e638c3'
'5e6fd15d90df1a8cb7614c4ffc70aa8c4198cd854d7742016202b96dd0228d3c'
'a31d06128f3d1014d68297aa5cd264023d202cae74746d78ba84e335af3399d2'
'3010acbe7769ea214dd51f5889e3a26b44925001905deb04b060beaede2578f4'
'1861121215c183de721cfed2ebbbcc9323a40a7cacb2389d89cc21339b5bf026'
'5011e96e3dd7e695ad8996b54e75612a892ed1d54d50506e733196a62bbaf10f'
'b15c1ed3e8cb31d3b8eda925684abbc8a0e6883ea3e911f57cc8dd6003d12ce2')

prepare() {
cd "${srcdir}/nim-${pkgver}"

rm -rf csources nimble
mv ../csources-${_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-nimOldDlls.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 examples 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"
}

Loading…
Cancel
Save