iss.sh 5.17 KB
Newer Older
bernd's avatar
bernd committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/bin/bash

#Copyright (C) 2016 Bernd Paysan

#This file is part of net2o

#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU Affero General Public License for more details.

#You should have received a copy of the GNU Affero General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.

# use iss.sh >net2o.iss
# copy the resulting *.iss to the location of your Windows installation
# of net2o, and start the setup compiler there.

VERSION=$(gforth --version 2>&1 | cut -f2 -d' ')
bernd's avatar
bernd committed
25
N2OVER=$(n2o version | cut -f1 -d' ' | cut -f2- -d-)
bernd's avatar
bernd committed
26 27 28
machine=$(gforth --version 2>&1 | cut -f3 -d' ')
SF=$(gforth -e 'cell 8 = [IF] ." 64" [THEN] bye')
CYGWIN=cygwin$SF
29 30
CYGWIN64=cygwin64
CYGWIN32=cygwin
31
X64=$(gforth -e 'cell 8 = [IF] ." x64" [THEN] bye')
bernd's avatar
bernd committed
32

33 34 35
ln -fs /cygdrive/c/cygwin$(pwd)/lib/gforth/$VERSION/386 lib/gforth/$VERSION/

for m in amd64 386
bernd's avatar
bernd committed
36
do
37 38 39 40 41
    for i in lib/gforth/$VERSION/$m/libcc-named/*.la
    do
	sed "s/dependency_libs='.*'/dependency_libs=''/g" <$i >$i+
	mv $i+ $i
    done
bernd's avatar
bernd committed
42 43 44 45 46 47 48
done

cat <<EOF
; This is the setup script for net2o on Windows
; Setup program is Inno Setup

[Setup]
49
AppName=net2o
bernd's avatar
bernd committed
50
AppVersion=$N2OVER
51 52 53
AppCopyright=Copyright  2010-2018 Bernd Paysan
DefaultDirName={pf}\net2o
DefaultGroupName=net2o
bernd's avatar
bernd committed
54 55 56 57 58
AllowNoIcons=1
InfoBeforeFile=COPYING
Compression=lzma
DisableStartupPrompt=yes
ChangesEnvironment=yes
59
OutputBaseFilename=net2o-$N2OVER
bernd's avatar
bernd committed
60 61
AppPublisher=Bernd Paysan
AppPublisherURL=http://fossil.net2o.de/net2o
62 63 64 65 66
SignTool=sha1
SignTool=sha256
; add the following sign tools:
; sha1=signtool sign /a /fd sha1 /tr http://timestamp.comodoca.com/?td=sha1 /td sha1 $f
; sha256=signtool sign /a /as /fd sha256 /tr http://timestamp.comodoca.com/?td=sha256 /td sha256 $f
bernd's avatar
bernd committed
67
SetupIconFile=net2o.ico
bernd's avatar
bernd committed
68
UninstallDisplayIcon={app}\\net2o.ico
69
ArchitecturesInstallIn64BitMode=$X64
bernd's avatar
bernd committed
70 71 72

[Messages]
WizardInfoBefore=License Agreement
bernd's avatar
bernd committed
73
InfoBeforeLabel=net2o is free software.
bernd's avatar
bernd committed
74 75 76 77 78 79 80 81 82 83 84 85 86 87
InfoBeforeClickLabel=You don't have to accept the GPL to run the program. You only have to accept this license if you want to modify, copy, or distribute this program.

[Components]

[Dirs]
$(make distfiles | tr ' ' '\n' | (while read i; do
  while [ ! -z "$i" ]
  do
    if [ -d $i ]; then echo $i; fi
    if [ "${i%/*}" != "$i" ]; then i="${i%/*}"; else i=""; fi
  done
done) | sort -u | sed \
  -e 's:/:\\:g' \
  -e 's,^\(..*\)$,Name: "{app}\\\1",g')
88
Name: "{app}\\lib\\gforth\\$VERSION\\amd64\\libcc-named"; Check: Is64BitInstallMode
89
Name: "{app}\\lib\\gforth\\$VERSION\\386\\libcc-named"; Check: not Is64BitInstallMode
bernd's avatar
bernd committed
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
Name: "{app}\\..\\bin"
Name: "{app}\\..\\tmp"; Permissions: users-modify

[Files]
; Parameter quick reference:
;   "Source filename", "Dest. filename", Copy mode, Flags
Source: "README.txt"; DestDir: "{app}"; Flags: isreadme
EOF

cat <<EOF
$(make distfiles | tr ' ' '\n' | (while read i; do
  if [ ! -d $i ]; then echo $i; fi
done) | sed \
  -e 's:/:\\:g' \
  -e 's,^\(..*\)\\\([^\\]*\)$,Source: "\1\\\2"; DestDir: "{app}\\\1",g' \
bernd's avatar
bernd committed
105
  -e 's,^\([^\\]*\)$,Source: "\1"; DestDir: "{app}",g')
bernd's avatar
bernd committed
106
Source: "net2o.ico"; DestDir: "{app}"
bernd's avatar
bernd committed
107
$(for i in */.libs/*.dll; do
108 109 110 111
echo "Source: \"$i\"; DestDir: \"{app}\\..\\gforth\"; Check: Is64BitInstallMode" | tr '/' '\\'
done)
$(for i in */.libs/*.dll; do
echo "Source: \"C:\\cygwin$(pwd)\\$i\"; DestDir: \"{app}\\..\\gforth\"; Check: not Is64BitInstallMode" | tr '/' '\\'
bernd's avatar
bernd committed
112
done)
113 114 115 116
$(ls lib/gforth/$VERSION/amd64/libcc-named/*.la | sed -e 's,^\(..*\)$,Source: "\1"; DestDir: "{app}\\..\\gforth\\lib\\gforth\\'$VERSION'\\amd64\\libcc-named"; Check: Is64BitInstallMode,g' -e 's:/:\\:g')
$(ls lib/gforth/$VERSION/amd64/libcc-named/.libs/*.dll | sed -e 's,^\(..*\)$,Source: "\1"; DestDir: "{app}\\..\\gforth\\lib\\gforth\\'$VERSION'\\amd64\\libcc-named\\.libs"; Check: Is64BitInstallMode,g' -e 's:/:\\:g')
$(ls lib/gforth/$VERSION/386/libcc-named/*.la | sed -e 's,^\(..*\)$,Source: "C:\\cygwin'$(pwd)'\\\1"; DestDir: "{app}\\..\\gforth\\lib\\gforth\\'$VERSION'\\386\\libcc-named"; Check: not Is64BitInstallMode,g' -e 's:/:\\:g')
$(ls lib/gforth/$VERSION/386/libcc-named/.libs/*.dll | sed -e 's,^\(..*\)$,Source: "C:\\cygwin'$(pwd)'\\\1"; DestDir: "{app}\\..\\gforth\\lib\\gforth\\'$VERSION'\\386\\libcc-named\.libs"; Check: not Is64BitInstallMode,g' -e 's:/:\\:g')
117 118
Source: "c:\\$CYGWIN64\\bin\\cygstdc++-6.dll"; DestDir: "{app}\\..\\gforth"; Check: Is64BitInstallMode
Source: "c:\\$CYGWIN32\\bin\\cygstdc++-6.dll"; DestDir: "{app}\\..\\gforth"; Check: not Is64BitInstallMode
bernd's avatar
bernd committed
119 120 121 122 123

[Icons]
; Parameter quick reference:
;   "Icon title", "File name", "Parameters", "Working dir (can leave blank)",
;   "Custom icon filename (leave blank to use the default icon)", Icon index
124
Name: "{group}\net2o"; Filename: "{app}\\..\\gforth\\run.exe"; Parameters: "./env HOME='%HOMEDRIVE%%HOMEPATH%' ../gforth/mintty ../gforth/gforth-fast ./n2o cmd"; WorkingDir: "{app}"; IconFilename: "{app}\\net2o.ico"
bernd's avatar
bernd committed
125 126 127 128 129 130 131 132 133

[Run]

[UninstallDelete]

[Tasks]

EOF

134
sed -e 's/$/\r/' <README.md >README.txt