mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-06 21:17:48 +00:00
zip files for Windows
This commit is contained in:
@@ -43,8 +43,10 @@ ReM which mingw link to put in the NSIS installer.
|
||||
nim c --out:koch_temp koch || exit /b
|
||||
koch_temp boot -d:release || exit /b
|
||||
koch_temp nsis -d:release || exit /b
|
||||
koch_temp zip -d:release || exit /b
|
||||
dir build
|
||||
move /y build\nim_%NIMVER%.exe build\nim-%NIMVER%_x32.exe || exit /b
|
||||
move /y build\nim_%NIMVER%.zip build\nim-%NIMVER%_x32.zip || exit /b
|
||||
|
||||
|
||||
ReM Build Win64 version:
|
||||
@@ -55,4 +57,6 @@ cd ..
|
||||
nim c --out:koch_temp koch || exit /b
|
||||
koch_temp boot -d:release || exit /b
|
||||
koch_temp nsis -d:release || exit /b
|
||||
koch_temp zip -d:release || exit /b
|
||||
move /y build\nim_%NIMVER%.exe build\nim-%NIMVER%_x64.exe || exit /b
|
||||
move /y build\nim_%NIMVER%.zip build\nim-%NIMVER%_x64.zip || exit /b
|
||||
|
||||
@@ -92,7 +92,6 @@ Files: "bin/nimble.exe"
|
||||
Files: "bin/makelink.exe"
|
||||
Files: "bin/*.dll"
|
||||
|
||||
Files: "dist/*.dll"
|
||||
Files: "koch.exe"
|
||||
; Files: "dist/mingw"
|
||||
Files: "start.bat"
|
||||
|
||||
27
koch.nim
27
koch.nim
@@ -20,11 +20,6 @@ import
|
||||
|
||||
const VersionAsString = system.NimVersion #"0.10.2"
|
||||
|
||||
when defined(withUpdate):
|
||||
import httpclient
|
||||
when defined(haveZipLib):
|
||||
import zipfiles
|
||||
|
||||
const
|
||||
HelpText = """
|
||||
+-----------------------------------------------------------------+
|
||||
@@ -68,7 +63,10 @@ Web options:
|
||||
build the official docs, use UA-48159761-1
|
||||
"""
|
||||
|
||||
proc exe(f: string): string = return addFileExt(f, ExeExt)
|
||||
proc exe(f: string): string =
|
||||
result = addFileExt(f, ExeExt)
|
||||
when defined(windows):
|
||||
result = result.replace('/','\\')
|
||||
|
||||
proc findNim(): string =
|
||||
var nim = "nim".exe
|
||||
@@ -144,7 +142,7 @@ proc copyExe(source, dest: string) =
|
||||
inclFilePermissions(dest, {fpUserExec})
|
||||
|
||||
const
|
||||
compileNimInst = "-d:useLibzipSrc tools/niminst/niminst"
|
||||
compileNimInst = "tools/niminst/niminst"
|
||||
|
||||
proc csource(args: string) =
|
||||
exec("$4 cc $1 -r $3 --var:version=$2 --var:mingw=none csource --main:compiler/nim.nim compiler/installer.ini $1" %
|
||||
@@ -177,6 +175,7 @@ proc bundleNimsuggest(buildExe: bool) =
|
||||
|
||||
proc zip(args: string) =
|
||||
bundleNimbleSrc()
|
||||
bundleNimsuggest(false)
|
||||
exec("$3 cc -r $2 --var:version=$1 --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" %
|
||||
[VersionAsString, compileNimInst, findNim()])
|
||||
exec("$# --var:version=$# --var:mingw=none --main:compiler/nim.nim zip compiler/installer.ini" %
|
||||
@@ -318,20 +317,6 @@ proc clean(args: string) =
|
||||
|
||||
# -------------- builds a release ---------------------------------------------
|
||||
|
||||
#[
|
||||
proc run7z(platform: string, patterns: varargs[string]) =
|
||||
const tmpDir = "nim-" & VersionAsString
|
||||
createDir tmpDir
|
||||
try:
|
||||
for pattern in patterns:
|
||||
for f in walkFiles(pattern):
|
||||
if "nimcache" notin f:
|
||||
copyFile(f, tmpDir / f)
|
||||
exec("7z a -tzip $1-$2.zip $1" % [tmpDir, platform])
|
||||
finally:
|
||||
removeDir tmpDir
|
||||
]#
|
||||
|
||||
proc winRelease() =
|
||||
exec(r"call ci\nsis_build.bat " & VersionAsString)
|
||||
|
||||
|
||||
@@ -617,9 +617,8 @@ when haveZipLib:
|
||||
else:
|
||||
quit("Cannot open for writing: " & n)
|
||||
|
||||
proc xzDist(c: var ConfigData) =
|
||||
proc xzDist(c: var ConfigData; windowsZip=false) =
|
||||
let proj = toLower(c.name) & "-" & c.version
|
||||
var n = "$#.tar.xz" % proj
|
||||
let tmpDir = if c.outdir.len == 0: "build" else: c.outdir
|
||||
|
||||
template processFile(z, dest, src) =
|
||||
@@ -636,15 +635,17 @@ proc xzDist(c: var ConfigData) =
|
||||
processFile(z, proj / makeFile, "build" / makeFile)
|
||||
processFile(z, proj / installShFile, installShFile)
|
||||
processFile(z, proj / deinstallShFile, deinstallShFile)
|
||||
for f in walkFiles(c.libpath / "lib/*.h"):
|
||||
processFile(z, proj / "c_code" / extractFilename(f), f)
|
||||
for osA in 1..c.oses.len:
|
||||
for cpuA in 1..c.cpus.len:
|
||||
var dir = buildDir(osA, cpuA)
|
||||
for k, f in walkDir("build" / dir):
|
||||
if k == pcFile: processFile(z, proj / dir / extractFilename(f), f)
|
||||
if not windowsZip:
|
||||
for f in walkFiles(c.libpath / "lib/*.h"):
|
||||
processFile(z, proj / "c_code" / extractFilename(f), f)
|
||||
for osA in 1..c.oses.len:
|
||||
for cpuA in 1..c.cpus.len:
|
||||
var dir = buildDir(osA, cpuA)
|
||||
for k, f in walkDir("build" / dir):
|
||||
if k == pcFile: processFile(z, proj / dir / extractFilename(f), f)
|
||||
|
||||
for cat in items({fcConfig..fcOther, fcUnix, fcNimble}):
|
||||
let osSpecific = if windowsZip: fcWindows else: fcUnix
|
||||
for cat in items({fcConfig..fcOther, osSpecific, fcNimble}):
|
||||
echo("Current category: ", cat)
|
||||
for f in items(c.cat[cat]): processFile(z, proj / f, f)
|
||||
|
||||
@@ -656,10 +657,15 @@ proc xzDist(c: var ConfigData) =
|
||||
let oldDir = getCurrentDir()
|
||||
setCurrentDir(tmpDir)
|
||||
try:
|
||||
if execShellCmd("XZ_OPT=-9 gtar Jcf $1.tar.xz $1 --exclude=.DS_Store" % proj) != 0:
|
||||
# try old 'tar' without --exclude feature:
|
||||
if execShellCmd("XZ_OPT=-9 tar Jcf $1.tar.xz $1" % proj) != 0:
|
||||
if windowsZip:
|
||||
if execShellCmd("7z a -tzip $1.zip $1" % proj) != 0:
|
||||
echo("External program failed")
|
||||
else:
|
||||
if execShellCmd("XZ_OPT=-9 gtar Jcf $1.tar.xz $1 --exclude=.DS_Store" %
|
||||
proj) != 0:
|
||||
# try old 'tar' without --exclude feature:
|
||||
if execShellCmd("XZ_OPT=-9 tar Jcf $1.tar.xz $1" % proj) != 0:
|
||||
echo("External program failed")
|
||||
finally:
|
||||
setCurrentDir(oldDir)
|
||||
|
||||
@@ -725,10 +731,7 @@ if actionCSource in c.actions:
|
||||
if actionScripts in c.actions:
|
||||
writeInstallScripts(c)
|
||||
if actionZip in c.actions:
|
||||
when haveZipLib:
|
||||
zipDist(c)
|
||||
else:
|
||||
quit("libzip is not installed")
|
||||
xzDist(c, true)
|
||||
if actionXz in c.actions:
|
||||
xzDist(c)
|
||||
if actionDeb in c.actions:
|
||||
|
||||
Reference in New Issue
Block a user