diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-07-13 04:48:22 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-07-13 04:48:22 +0200 |
commit | 2b862b74e0b0b7b4a18f4262356289fb921eaf0c (patch) | |
tree | 8f41b7355f6d791d6485e8225d6a5cb2f80ca7d6 /tools | |
parent | a5695c13afabac6e67ff677d564b6d1a6aeb1af4 (diff) | |
parent | 0c271f54208c7ba0bac6ad2da87f60e7c6d8e37c (diff) | |
download | Nim-2b862b74e0b0b7b4a18f4262356289fb921eaf0c.tar.gz |
Merge branch 'devel' into araq
Diffstat (limited to 'tools')
-rw-r--r-- | tools/detect/detect.nim | 11 | ||||
-rw-r--r-- | tools/finish.nim | 8 | ||||
-rw-r--r-- | tools/niminst/makefile.tmpl | 115 | ||||
-rw-r--r-- | tools/niminst/niminst.nim | 7 |
4 files changed, 78 insertions, 63 deletions
diff --git a/tools/detect/detect.nim b/tools/detect/detect.nim index 3afe8ee67..1b016cef9 100644 --- a/tools/detect/detect.nim +++ b/tools/detect/detect.nim @@ -119,10 +119,14 @@ proc v(name: string, typ = "cint", no_other = false) = addf(tl, "#ifdef $3\n fprintf(f, \"const $1* = $2(%ld)\\n\", $3);\n#endif\n", n, t, name) - else: + of "cint", "cshort", "InAddrScalar", "TSa_Family": addf(tl, "#ifdef $3\n fprintf(f, \"const $1* = $2(%d)\\n\", $3);\n#endif\n", n, t, name) + else: + addf(tl, + "#ifdef $3\n fprintf(f, \"const $1* = cast[$2](%d)\\n\", $3);\n#endif\n", + n, t, name) header("<aio.h>") @@ -544,6 +548,11 @@ v("SS_DISABLE") v("MINSIGSTKSZ") v("SIGSTKSZ") +v("SIG_HOLD", "Sighandler") +v("SIG_DFL", "Sighandler") +v("SIG_ERR", "Sighandler") +v("SIG_IGN", "Sighandler") + header("<sys/ipc.h>") v("IPC_CREAT") v("IPC_EXCL") diff --git a/tools/finish.nim b/tools/finish.nim index cdbbdabe5..a6f689eac 100644 --- a/tools/finish.nim +++ b/tools/finish.nim @@ -92,7 +92,13 @@ when defined(windows): echo "Could not access 'config/nim.cfg' [Error]" proc addToPathEnv*(e: string) = - let p = getUnicodeValue(r"Environment", "Path", HKEY_CURRENT_USER) + var p: string + try: + p = getUnicodeValue(r"Environment", "Path", HKEY_CURRENT_USER) + except OSError: + p = getUnicodeValue( + r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment", + "Path", HKEY_LOCAL_MACHINE) let x = if e.contains(Whitespace): "\"" & e & "\"" else: e setUnicodeValue(r"Environment", "Path", p & ";" & x, HKEY_CURRENT_USER) diff --git a/tools/niminst/makefile.tmpl b/tools/niminst/makefile.tmpl index ce2db1c48..c4e0be55e 100644 --- a/tools/niminst/makefile.tmpl +++ b/tools/niminst/makefile.tmpl @@ -12,146 +12,143 @@ binDir = ?{firstBinPath(c).toUnix} koch := $(shell sh -c 'test -s ../koch.nim && echo "yes"') ifeq ($(koch),yes) - binDir = ../bin + binDir = ../bin endif ucpu := $(shell sh -c 'uname -m | tr "[:upper:]" "[:lower:]"') uos := $(shell sh -c 'uname | tr "[:upper:]" "[:lower:]"') ifeq ($(uos),linux) - myos = linux - LINK_FLAGS += -ldl -lm + myos = linux + LINK_FLAGS += -ldl -lm endif ifeq ($(uos),dragonfly) - myos = freebsd - LINK_FLAGS += -lm + myos = freebsd + LINK_FLAGS += -lm endif ifeq ($(uos),freebsd) - myos= freebsd - CC = clang - LINKER = clang - LINK_FLAGS += -lm + myos= freebsd + CC = clang + LINKER = clang + LINK_FLAGS += -lm endif ifeq ($(uos),openbsd) - myos = openbsd - LINK_FLAGS += -lm + myos = openbsd + LINK_FLAGS += -lm endif ifeq ($(uos),netbsd) - myos = netbsd - LINK_FLAGS += -lm + myos = netbsd + LINK_FLAGS += -lm endif ifeq ($(uos),darwin) - myos = macosx - CC = clang - LINKER = clang - LINK_FLAGS += -ldl -lm - ifeq ($HOSTTYPE,x86_64) - ucpu = amd64 - endif + myos = macosx + CC = clang + LINKER = clang + LINK_FLAGS += -ldl -lm + ifeq ($(HOSTTYPE),x86_64) + ucpu = amd64 + endif endif ifeq ($(uos),aix) - myos = aix - LINK_FLAGS += -dl -lm + myos = aix + LINK_FLAGS += -dl -lm endif ifeq ($(uos),solaris) - myos = solaris - LINK_FLAGS += -ldl -lm -lsocket -lnsl + myos = solaris + LINK_FLAGS += -ldl -lm -lsocket -lnsl endif ifeq ($(uos),sun) - myos = solaris - LINK_FLAGS += -ldl -lm -lsocket -lnsl + myos = solaris + LINK_FLAGS += -ldl -lm -lsocket -lnsl endif ifeq ($(uos),haiku) - myos = haiku + myos = haiku endif ifndef uos - @echo "Error: unknown operating system: $(uos)" - @exit 1 + $(error unknown operating system: $(uos)) endif ifeq ($(ucpu),i386) - mycpu = i386 + mycpu = i386 endif ifeq ($(ucpu),i486) - mycpu = i386 + mycpu = i386 endif ifeq ($(ucpu),i586) - mycpu = i386 + mycpu = i386 endif ifeq ($(ucpu),i686) - mycpu = i386 + mycpu = i386 endif ifeq ($(ucpu),bepc) - mycpu = i386 + mycpu = i386 endif ifeq ($(ucpu),i86pc) - mycpu = i386 + mycpu = i386 endif ifeq ($(ucpu),amd64) - mycpu = amd64 + mycpu = amd64 endif ifeq ($(ucpu),x86-64) - mycpu = amd64 + mycpu = amd64 endif ifeq ($(ucpu),x86_64) - mycpu = amd64 + mycpu = amd64 endif ifeq ($(ucpu),sparc) - mycpu = sparc + mycpu = sparc endif ifeq ($(ucpu),sun) - mycpu = sparc + mycpu = sparc endif ifeq ($(ucpu),ppc64) - mycpu = powerpc64 - ifeq ($(myos),linux) - COMP_FLAGS += -m64 - LINK_FLAGS += -m64 - endif + mycpu = powerpc64 + ifeq ($(myos),linux) + COMP_FLAGS += -m64 + LINK_FLAGS += -m64 + endif endif ifeq ($(ucpu),powerpc) - mycpu = powerpc + mycpu = powerpc endif ifeq ($(ucpu),ppc) - mycpu = ppc + mycpu = ppc endif ifeq ($(ucpu),mips) - mycpu = mips + mycpu = mips endif ifeq ($(ucpu),arm) - mycpu = arm + mycpu = arm endif ifeq ($(ucpu),armeb) - mycpu = arm + mycpu = arm endif ifeq ($(ucpu),armel) - mycpu = arm + mycpu = arm endif ifeq ($(ucpu),armv6l) - mycpu = arm + mycpu = arm endif ifndef ucpu - @echo "Error: unknown processor : $(ucpu)" - @exit 1 + $(error unknown processor: $(ucpu)) endif # for osA in 1..c.oses.len: ifeq ($(myos),?{c.oses[osA-1]}) # for cpuA in 1..c.cpus.len: - ifeq ($(mycpu),?{c.cpus[cpuA-1]}) + ifeq ($(mycpu),?{c.cpus[cpuA-1]}) # var oFiles = "" # for ff in c.cfiles[osA][cpuA].items: # oFiles.add(" " & changeFileExt(ff.toUnix, "o")) # end for - oFiles =?oFiles - endif + oFiles =?oFiles + endif # end for endif # end for ifeq ($(strip $(oFiles)),) - @echo "Error: no C code generated for: [$(myos): $(mycpu)]" - @exit 1 + $(error no C code generated for: [$(myos): $(mycpu)]) endif %.o: %.c diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim index 67f5e2b33..e4568dc3a 100644 --- a/tools/niminst/niminst.nim +++ b/tools/niminst/niminst.nim @@ -679,11 +679,14 @@ RunProgram="tools\downloader.exe" if execShellCmd("7z a -sfx7zS2.sfx -t7z $1.exe $1" % proj) != 0: echo("External program failed (7z)") else: - if execShellCmd("XZ_OPT=-9 gtar Jcf $1.tar.xz $1 --exclude=.DS_Store" % + if execShellCmd("gtar cf $1.tar $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 execShellCmd("tar cf $1.tar $1" % proj) != 0: echo("External program failed") + + if execShellCmd("xz -9f $1.tar" % proj) != 0: + echo("External program failed") finally: setCurrentDir(oldDir) |