]> Nishi Git Mirror - tewi.git/commitdiff
add a script to create specific installer
authorNishi <nishi@nishi.boats>
Wed, 2 Oct 2024 19:50:16 +0000 (19:50 +0000)
committerNishi <nishi@nishi.boats>
Wed, 2 Oct 2024 19:50:16 +0000 (19:50 +0000)
git-svn-id: file:///raid/svn-personal/tewi/trunk@217 8739d7e6-ffea-ec47-b151-bdff447c6205

Makefile
Server/install.nsi
Server/module.c
make-installer.sh [new file with mode: 0644]

index deea9d371ece044b469ab9319836a788fe29cd7f..77f48c1c3e8e932dcc08d0a1580dfc656d643d19 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ all: ./Server $(MODULE)
        $(MAKE) -C $@ $(FLAGS)
 
 ./README: ./README.tmpl ./Server/tw_version.h
-       sed "s/@VERSION@/`grep "define TW_VERSION" Server/tw_version.h | grep -Eo '"[^\]+' | sed -E 's/^"//g'`/g" ./README.tmpl > $@
+       sed "s/@VERSION@/`grep "define TW_VERSION" Server/tw_version.h | grep -Eo '"[^\]+' | sed 's/^"//g'`/g" ./README.tmpl > $@
 
 install: all ./Tool/genconf ./Tool/itworks
        mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/lib/tewi $(DESTDIR)$(PREFIX)/etc $(DESTDIR)$(PREFIX)/www
@@ -46,7 +46,7 @@ format:
        clang-format --verbose -i `find ./Server ./Common ./Module ./Tool "(" -name "*.c" -or -name "*.h" ")" -and -not -name "strptime.*"` config.h
 
 get-version:
-       @grep "define TW_VERSION" Server/tw_version.h | grep -Eo '"[^\]+' | sed -E 's/^"//g'
+       @grep "define TW_VERSION" Server/tw_version.h | grep -Eo '"[^\]+' | sed 's/^"//g'
 
 clean:
        $(MAKE) -C ./Server $(FLAGS) clean
index e50b23950eae7050c912ebf5e658bb87dbc8d215..09fa1900c89d1fe5aa2deb13a7489c00d001de83 100644 (file)
@@ -39,17 +39,25 @@ Section
        CreateDirectory "$INSTDIR\modules"
        CreateDirectory "$INSTDIR\bin"
        SetOutPath "$INSTDIR"
-       File /oname=LICENSE.txt "../LICENSE"
+       !cd ..
+       File /oname=LICENSE.txt "LICENSE"
        SetOutPath "$INSTDIR\modules"
-       File "../Module/*.dll"
+       !cd Module
+       File "*.dll"
+       !cd ..
        SetOutPath "$INSTDIR\etc"
        SetOverWrite off
-       File /oname=tewi.conf "../generated.conf"
+       File /oname=tewi.conf "generated.conf"
        SetOutPath "$INSTDIR\www"
-       File /oname=index.html "../itworks.html"
-       File /oname=pbtewi.gif "../Binary/pbtewi.gif"
+       File /oname=index.html "itworks.html"
+       !cd Binary
+       File /oname=pbtewi.gif "pbtewi.gif"
+       !cd ..
        SetOutPath "$INSTDIR\www\icons"
-       File "../Icons/*.png"
+       !cd Icons
+       File "*.png"
+       !cd ..
+       !cd Server
        SetOverWrite on
 
        CreateDirectory "$SMPROGRAMS\Tewi HTTPd"
@@ -72,10 +80,13 @@ SectionEnd
 
 Section "$(EXEC_ONLY)" SEL_EXEC
        SetOutPath "$INSTDIR\bin"
-       File "../tewi.exe"
+       !cd ..
+       File "tewi.exe"
+       !cd Server
        WriteINIStr $INSTDIR\install.ini uninstall service false
 SectionEnd
 
+!ifndef ONLY_EXEC
 Section /o "$(SERV_TOO)" SEL_SERVICE
        WriteINIStr $INSTDIR\install.ini uninstall service true
        FileOpen $9 $INSTDIR\install.bat w
@@ -87,8 +98,10 @@ Section /o "$(SERV_TOO)" SEL_SERVICE
        Sleep 1000
        CreateDirectory "$INSTDIR\logs"
        SetOutPath "$INSTDIR\bin"
-       File "../tewi.exe"
-       File /oname=tewisrv.exe "../tewi-service.exe"
+       !cd ..
+       File "tewi.exe"
+       File /oname=tewisrv.exe "tewi-service.exe"
+       !cd Server
        FileOpen $9 $INSTDIR\install.bat w
        FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
        FileWrite $9 '"$SYSDIR\sc.exe" create "TewiHTTPd" DisplayName= "Tewi HTTPd" binpath= "$INSTDIR\bin\tewisrv.exe" start= "auto"$\r$\n'
@@ -98,6 +111,7 @@ Section /o "$(SERV_TOO)" SEL_SERVICE
        Pop $0
        Delete $INSTDIR\install.bat
 SectionEnd
+!endif
 
 Function .onInit
        StrCpy $1 ${SEL_EXEC}
@@ -106,7 +120,9 @@ FunctionEnd
 Function .onSelChange
        !insertmacro StartRadioButtons $1
        !insertmacro RadioButton ${SEL_EXEC}
+       !ifndef ONLY_EXEC
        !insertmacro RadioButton ${SEL_SERVICE}
+       !endif
        !insertmacro EndRadioButtons
 FunctionEnd
 
index b11dd3a879f918fc087ee92a51dec4625292737c..90fd5982ee23a1d127ead48d688ad651a5e2d981 100644 (file)
@@ -28,6 +28,7 @@ int tw_module_init(void* mod) { return 1; }
 
 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
 #include <windows.h>
+#include <direct.h>
 #else
 #include <dlfcn.h>
 #endif
diff --git a/make-installer.sh b/make-installer.sh
new file mode 100644 (file)
index 0000000..ed61e38
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+# $Id$
+
+if [ "x$1" = "x" ]; then
+       echo "Usage: $0 win32|win64|vc6|bcc [description]"
+       exit 1
+fi
+
+fail() {
+       rm -f tewi.exe
+       rm -f generated.conf
+       rm -f itworks.html
+       exit 1
+}
+
+rm -f install.exe
+
+VERSION=`make get-version`
+
+make clean || fail
+make PLATFORM=$1 PREFIX=C:/Tewi -j4 || fail
+cp Server/tewi.exe tewi.exe
+cd Server
+../Tool/genconf "C:/Tewi" modules dll > ../generated.conf
+../Tool/itworks > ../itworks.html
+makensis /inputcharset utf8 -DVERSION=$VERSION -DONLY_EXEC install.nsi
+cp install.exe ../install.exe
+cd ..
+rm tewi.exe
+rm itworks.html
+rm generated.conf