From 1b25a58a63b60d6154cbe4e59175d34905c3a450 Mon Sep 17 00:00:00 2001 From: Nishi Date: Wed, 2 Oct 2024 19:50:16 +0000 Subject: [PATCH] add a script to create specific installer git-svn-id: file:///raid/svn-personal/tewi/trunk@217 8739d7e6-ffea-ec47-b151-bdff447c6205 --- Makefile | 4 ++-- Server/install.nsi | 34 +++++++++++++++++++++++++--------- Server/module.c | 1 + make-installer.sh | 31 +++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 make-installer.sh diff --git a/Makefile b/Makefile index deea9d3..77f48c1 100644 --- 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 diff --git a/Server/install.nsi b/Server/install.nsi index e50b239..09fa190 100644 --- a/Server/install.nsi +++ b/Server/install.nsi @@ -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 diff --git a/Server/module.c b/Server/module.c index b11dd3a..90fd598 100644 --- a/Server/module.c +++ b/Server/module.c @@ -28,6 +28,7 @@ int tw_module_init(void* mod) { return 1; } #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) #include +#include #else #include #endif diff --git a/make-installer.sh b/make-installer.sh new file mode 100644 index 0000000..ed61e38 --- /dev/null +++ b/make-installer.sh @@ -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 -- 2.43.0