summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2015-10-03 19:30:34 +0100
committerDominik Picheta <dominikpicheta@googlemail.com>2015-10-03 19:30:34 +0100
commit6bc29ccf4c71899855402afff285bd66318cd479 (patch)
tree41b37206ce429162973d88c42ef99292f97852ee
parent3fe573177715b1c21d34e79a113862d298741c01 (diff)
parent6cc98539354607306e213ac90b2dac7cb3e86f73 (diff)
downloadNim-6bc29ccf4c71899855402afff285bd66318cd479.tar.gz
Merge pull request #3400 from nanoant/patch/generate-install.sh-during-bootstrap
Generate install.sh during bootstrap
-rwxr-xr-xbootstrap.sh7
-rw-r--r--install.sh.template9
-rw-r--r--koch.nim9
3 files changed, 12 insertions, 13 deletions
diff --git a/bootstrap.sh b/bootstrap.sh
index ade74a9aa..7f19c2440 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -12,8 +12,11 @@ cd ".."
 
 ./bin/nim c koch
 ./koch boot -d:release
+./koch geninstall
 
-cp -f install.sh.template install.sh
-chmod +x install.sh
+set +x
+
+echo
+echo 'Install Nim using "./install.sh <dir>" or "sudo ./install.sh <dir>".'
 
 exit 0
diff --git a/install.sh.template b/install.sh.template
deleted file mode 100644
index 1292abdab..000000000
--- a/install.sh.template
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-set -e
-set -x
-
-if [ "$1" != "" ]; then
-	exec ./koch install "$1"
-else
-	exec ./koch install
-fi
diff --git a/koch.nim b/koch.nim
index 8992271bf..3d1a22b9c 100644
--- a/koch.nim
+++ b/koch.nim
@@ -41,6 +41,7 @@ Options:
 Possible Commands:
   boot [options]           bootstraps with given command line options
   install [bindir]         installs to given directory; Unix only!
+  geninstall               generate ./install.sh; Unix only!
   clean                    cleans Nim project; removes generated files
   web [options]            generates the website and the full documentation
   website [options]        generates only the website
@@ -127,9 +128,12 @@ proc nsis(args: string) =
   exec(("tools" / "niminst" / "niminst --var:version=$# --var:mingw=mingw$#" &
         " nsis compiler/installer.ini") % [VersionAsString, $(sizeof(pointer)*8)])
 
+proc geninstall(args="") =
+  exec("$# cc -r $# --var:version=$# --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini $#" %
+       [findNim(), compileNimInst, VersionAsString, args])
+
 proc install(args: string) =
-  exec("$# cc -r $# --var:version=$# --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" %
-       [findNim(), compileNimInst, VersionAsString])
+  geninstall()
   exec("sh ./install.sh $#" % args)
 
 proc web(args: string) =
@@ -373,6 +377,7 @@ of cmdArgument:
   of "zip": zip(op.cmdLineRest)
   of "xz": xz(op.cmdLineRest)
   of "nsis": nsis(op.cmdLineRest)
+  of "geninstall": geninstall(op.cmdLineRest)
   of "install": install(op.cmdLineRest)
   of "test", "tests": tests(op.cmdLineRest)
   of "update":