From 797301ace8f0ce7e3e43eac9d5fbb11c0f6f615a Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Tue, 16 May 2017 20:45:10 +0800 Subject: add back SIG_IGN, SIG_DFL and friends to posix.nim (#5820) * add back SIG_IGN, SIG_DFL and friends to posix.nim accidentally wiped by ce86b4ad78aae11f62c50e4f46e8ab2a124356b4 * move deprecated sig_hold after consts include --- tools/detect/detect.nim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tools') 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("") @@ -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("") v("IPC_CREAT") v("IPC_EXCL") -- cgit 1.4.1-2-gfad0 From 68573630340f60f452d5f206da37017e47bd8f6e Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 17 May 2017 21:48:36 +0200 Subject: finish.nim tool: use global path environment variable if local does not exist --- tools/finish.nim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tools') 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) -- cgit 1.4.1-2-gfad0 From 675b271aa60cd2c24a53927533a106d022b21203 Mon Sep 17 00:00:00 2001 From: James Cowgill Date: Wed, 17 May 2017 17:06:00 +0100 Subject: makefile.tmpl: fix error handling and cleanups This changes the indentation of all non-recipe lines from tabs to 2 spaces. While this doesn't fix anything, it avoids either make or someone interpreting those lines as a make recipe. This also fixes the error handling by using make's $(error) function instead. Previously make gave this syntax error whenever it hit the error handling code: ``` *** recipe commences before first target. Stop. ``` --- tools/niminst/makefile.tmpl | 115 +++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 59 deletions(-) (limited to 'tools') diff --git a/tools/niminst/makefile.tmpl b/tools/niminst/makefile.tmpl index ce2db1c48..ef8921f3e 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 -- cgit 1.4.1-2-gfad0 From 5b9620bc2d0e8945bcc7adf9f705426980d3b63a Mon Sep 17 00:00:00 2001 From: Dennis Felsing Date: Tue, 23 May 2017 15:30:58 +0200 Subject: Invoke xz -9 explicitly instead of trusting tar to interpret XZ_OPT --- tools/niminst/niminst.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tools') 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) -- cgit 1.4.1-2-gfad0 From 245a1fe8d78efcba6a56922d0e53a2419397cd46 Mon Sep 17 00:00:00 2001 From: def Date: Tue, 20 Jun 2017 21:33:49 +0200 Subject: Minor fixes for makefile.tmpl --- tools/niminst/makefile.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/niminst/makefile.tmpl b/tools/niminst/makefile.tmpl index ef8921f3e..c4e0be55e 100644 --- a/tools/niminst/makefile.tmpl +++ b/tools/niminst/makefile.tmpl @@ -45,7 +45,7 @@ ifeq ($(uos),darwin) CC = clang LINKER = clang LINK_FLAGS += -ldl -lm - ifeq ($HOSTTYPE,x86_64) + ifeq ($(HOSTTYPE),x86_64) ucpu = amd64 endif endif @@ -130,7 +130,7 @@ ifeq ($(ucpu),armv6l) mycpu = arm endif ifndef ucpu - $(error unknown processor : $(ucpu)) + $(error unknown processor: $(ucpu)) endif # for osA in 1..c.oses.len: -- cgit 1.4.1-2-gfad0