zip files for Windows
This commit is contained in:
parent
c96295b380
commit
00b749c418
4 changed files with 30 additions and 39 deletions
|
|
@ -43,8 +43,10 @@ ReM which mingw link to put in the NSIS installer.
|
||||||
nim c --out:koch_temp koch || exit /b
|
nim c --out:koch_temp koch || exit /b
|
||||||
koch_temp boot -d:release || exit /b
|
koch_temp boot -d:release || exit /b
|
||||||
koch_temp nsis -d:release || exit /b
|
koch_temp nsis -d:release || exit /b
|
||||||
|
koch_temp zip -d:release || exit /b
|
||||||
dir build
|
dir build
|
||||||
move /y build\nim_%NIMVER%.exe build\nim-%NIMVER%_x32.exe || exit /b
|
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:
|
ReM Build Win64 version:
|
||||||
|
|
@ -55,4 +57,6 @@ cd ..
|
||||||
nim c --out:koch_temp koch || exit /b
|
nim c --out:koch_temp koch || exit /b
|
||||||
koch_temp boot -d:release || exit /b
|
koch_temp boot -d:release || exit /b
|
||||||
koch_temp nsis -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%.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/makelink.exe"
|
||||||
Files: "bin/*.dll"
|
Files: "bin/*.dll"
|
||||||
|
|
||||||
Files: "dist/*.dll"
|
|
||||||
Files: "koch.exe"
|
Files: "koch.exe"
|
||||||
; Files: "dist/mingw"
|
; Files: "dist/mingw"
|
||||||
Files: "start.bat"
|
Files: "start.bat"
|
||||||
|
|
|
||||||
27
koch.nim
27
koch.nim
|
|
@ -20,11 +20,6 @@ import
|
||||||
|
|
||||||
const VersionAsString = system.NimVersion #"0.10.2"
|
const VersionAsString = system.NimVersion #"0.10.2"
|
||||||
|
|
||||||
when defined(withUpdate):
|
|
||||||
import httpclient
|
|
||||||
when defined(haveZipLib):
|
|
||||||
import zipfiles
|
|
||||||
|
|
||||||
const
|
const
|
||||||
HelpText = """
|
HelpText = """
|
||||||
+-----------------------------------------------------------------+
|
+-----------------------------------------------------------------+
|
||||||
|
|
@ -68,7 +63,10 @@ Web options:
|
||||||
build the official docs, use UA-48159761-1
|
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 =
|
proc findNim(): string =
|
||||||
var nim = "nim".exe
|
var nim = "nim".exe
|
||||||
|
|
@ -144,7 +142,7 @@ proc copyExe(source, dest: string) =
|
||||||
inclFilePermissions(dest, {fpUserExec})
|
inclFilePermissions(dest, {fpUserExec})
|
||||||
|
|
||||||
const
|
const
|
||||||
compileNimInst = "-d:useLibzipSrc tools/niminst/niminst"
|
compileNimInst = "tools/niminst/niminst"
|
||||||
|
|
||||||
proc csource(args: string) =
|
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" %
|
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) =
|
proc zip(args: string) =
|
||||||
bundleNimbleSrc()
|
bundleNimbleSrc()
|
||||||
|
bundleNimsuggest(false)
|
||||||
exec("$3 cc -r $2 --var:version=$1 --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" %
|
exec("$3 cc -r $2 --var:version=$1 --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" %
|
||||||
[VersionAsString, compileNimInst, findNim()])
|
[VersionAsString, compileNimInst, findNim()])
|
||||||
exec("$# --var:version=$# --var:mingw=none --main:compiler/nim.nim zip compiler/installer.ini" %
|
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 ---------------------------------------------
|
# -------------- 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() =
|
proc winRelease() =
|
||||||
exec(r"call ci\nsis_build.bat " & VersionAsString)
|
exec(r"call ci\nsis_build.bat " & VersionAsString)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -617,9 +617,8 @@ when haveZipLib:
|
||||||
else:
|
else:
|
||||||
quit("Cannot open for writing: " & n)
|
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
|
let proj = toLower(c.name) & "-" & c.version
|
||||||
var n = "$#.tar.xz" % proj
|
|
||||||
let tmpDir = if c.outdir.len == 0: "build" else: c.outdir
|
let tmpDir = if c.outdir.len == 0: "build" else: c.outdir
|
||||||
|
|
||||||
template processFile(z, dest, src) =
|
template processFile(z, dest, src) =
|
||||||
|
|
@ -636,15 +635,17 @@ proc xzDist(c: var ConfigData) =
|
||||||
processFile(z, proj / makeFile, "build" / makeFile)
|
processFile(z, proj / makeFile, "build" / makeFile)
|
||||||
processFile(z, proj / installShFile, installShFile)
|
processFile(z, proj / installShFile, installShFile)
|
||||||
processFile(z, proj / deinstallShFile, deinstallShFile)
|
processFile(z, proj / deinstallShFile, deinstallShFile)
|
||||||
for f in walkFiles(c.libpath / "lib/*.h"):
|
if not windowsZip:
|
||||||
processFile(z, proj / "c_code" / extractFilename(f), f)
|
for f in walkFiles(c.libpath / "lib/*.h"):
|
||||||
for osA in 1..c.oses.len:
|
processFile(z, proj / "c_code" / extractFilename(f), f)
|
||||||
for cpuA in 1..c.cpus.len:
|
for osA in 1..c.oses.len:
|
||||||
var dir = buildDir(osA, cpuA)
|
for cpuA in 1..c.cpus.len:
|
||||||
for k, f in walkDir("build" / dir):
|
var dir = buildDir(osA, cpuA)
|
||||||
if k == pcFile: processFile(z, proj / dir / extractFilename(f), f)
|
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)
|
echo("Current category: ", cat)
|
||||||
for f in items(c.cat[cat]): processFile(z, proj / f, f)
|
for f in items(c.cat[cat]): processFile(z, proj / f, f)
|
||||||
|
|
||||||
|
|
@ -656,10 +657,15 @@ proc xzDist(c: var ConfigData) =
|
||||||
let oldDir = getCurrentDir()
|
let oldDir = getCurrentDir()
|
||||||
setCurrentDir(tmpDir)
|
setCurrentDir(tmpDir)
|
||||||
try:
|
try:
|
||||||
if execShellCmd("XZ_OPT=-9 gtar Jcf $1.tar.xz $1 --exclude=.DS_Store" % proj) != 0:
|
if windowsZip:
|
||||||
# try old 'tar' without --exclude feature:
|
if execShellCmd("7z a -tzip $1.zip $1" % proj) != 0:
|
||||||
if execShellCmd("XZ_OPT=-9 tar Jcf $1.tar.xz $1" % proj) != 0:
|
|
||||||
echo("External program failed")
|
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:
|
finally:
|
||||||
setCurrentDir(oldDir)
|
setCurrentDir(oldDir)
|
||||||
|
|
||||||
|
|
@ -725,10 +731,7 @@ if actionCSource in c.actions:
|
||||||
if actionScripts in c.actions:
|
if actionScripts in c.actions:
|
||||||
writeInstallScripts(c)
|
writeInstallScripts(c)
|
||||||
if actionZip in c.actions:
|
if actionZip in c.actions:
|
||||||
when haveZipLib:
|
xzDist(c, true)
|
||||||
zipDist(c)
|
|
||||||
else:
|
|
||||||
quit("libzip is not installed")
|
|
||||||
if actionXz in c.actions:
|
if actionXz in c.actions:
|
||||||
xzDist(c)
|
xzDist(c)
|
||||||
if actionDeb in c.actions:
|
if actionDeb in c.actions:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue