Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Separate out install/uninstall script generation

- Add new feature to niminst: scripts - build install scripts
  (based on csource feature)
- Change install feature in koch to build the install scripts, then
  run install.sh
- Don't track install scripts in Git.
  • Loading branch information...
commit 30cc9efb044b42e11d69e4a74fb8596801d81ded 1 parent 0f2f9b9
@ackalker ackalker authored
Showing with 18 additions and 5 deletions.
  1. +2 −0  .gitignore
  2. +4 −1 koch.nim
  3. +12 −4 tools/niminst/niminst.nim
View
2  .gitignore
@@ -29,6 +29,8 @@ examples/cross_todo/nimrod_backend/backend
examples/cross_todo/nimrod_backend/testbackend
examples/cross_todo/nimrod_backend/todo.sqlite3
examples/cross_todo/nimrod_commandline/nimtodo
+install.sh
+deinstall.sh
# iOS specific wildcards.
*.mode1v3
View
5 koch.nim
@@ -36,6 +36,7 @@ Options:
--help, -h shows this help and quits
Possible Commands:
boot [options] bootstraps with given command line options
+ install [dir] installs to given directory
clean cleans Nimrod project; removes generated files
web generates the website
csource [options] builds the C sources for installation
@@ -84,7 +85,9 @@ proc inno(args: string) =
NimrodVersion)
proc install(args: string) =
- exec("sh ./build.sh")
+ exec("nimrod cc -r tools/niminst/niminst --var:version=$# scripts compiler/nimrod.ini" %
+ NimrodVersion)
+ exec("sh ./install.sh $#" % args)
proc web(args: string) =
exec(("nimrod cc -r tools/nimweb.nim web/nimrod --putenv:nimrodversion=$#" &
View
16 tools/niminst/niminst.nim
@@ -32,6 +32,7 @@ type
actionNone, # action not yet known
actionCSource # action: create C sources
actionInno, # action: create Inno Setup installer
+ actionScripts # action: create install and deinstall scripts
actionZip, # action: create zip file
actionDeb # action: prepare deb package
@@ -128,6 +129,7 @@ Usage:
niminst [options] command[;command2...] ini-file[.ini] [compile_options]
Command:
csource build C source code for source based installations
+ scripts build install and deinstall scripts
zip build the ZIP file
inno build the Inno Setup installer
deb create files for debhelper
@@ -153,6 +155,7 @@ proc parseCmdLine(c: var TConfigData) =
for a in split(normalize(key.string), {';', ','}):
case a
of "csource": incl(c.actions, actionCSource)
+ of "scripts": incl(c.actions, actionScripts)
of "zip": incl(c.actions, actionZip)
of "inno": incl(c.actions, actionInno)
of "deb": incl(c.actions, actionDeb)
@@ -382,6 +385,12 @@ proc removeDuplicateFiles(c: var TConfigData) =
RemoveFile(dup)
c.cfiles[osA][cpuA][i] = orig
+proc writeInstallScripts(c: var TConfigData) =
+ if c.installScript:
+ writeFile(installShFile, GenerateInstallScript(c), "\10")
+ if c.uninstallScript:
+ writeFile(deinstallShFile, GenerateDeinstallScript(c), "\10")
+
proc srcdist(c: var TConfigData) =
for x in walkFiles(c.libpath / "lib/*.h"):
CopyFile(dest="build" / extractFilename(x), source=x)
@@ -408,10 +417,7 @@ proc srcdist(c: var TConfigData) =
writeFile(buildShFile, GenerateBuildShellScript(c), "\10")
writeFile(buildBatFile32, GenerateBuildBatchScript(c, tWin32), "\13\10")
writeFile(buildBatFile64, GenerateBuildBatchScript(c, tWin64), "\13\10")
- if c.installScript:
- writeFile(installShFile, GenerateInstallScript(c), "\10")
- if c.uninstallScript:
- writeFile(deinstallShFile, GenerateDeinstallScript(c), "\10")
+ writeInstallScripts(c)
# --------------------- generate inno setup -----------------------------------
proc setupDist(c: var TConfigData) =
@@ -514,6 +520,8 @@ if actionInno in c.actions:
setupDist(c)
if actionCSource in c.actions:
srcdist(c)
+if actionScripts in c.actions:
+ writeInstallScripts(c)
if actionZip in c.actions:
when haveZipLib:
zipdist(c)
Please sign in to comment.
Something went wrong with that request. Please try again.