diff --git a/Platform/win32.mk b/Platform/win32.mk index d40fb64..e5109e4 100644 --- a/Platform/win32.mk +++ b/Platform/win32.mk @@ -11,3 +11,4 @@ LIBS = -lws2_32 EXEC = .exe LIB = .dll PREOBJS = tewi.res +INSTALLER = install.exe diff --git a/Platform/win64.mk b/Platform/win64.mk index 187462a..a9c7456 100644 --- a/Platform/win64.mk +++ b/Platform/win64.mk @@ -11,3 +11,4 @@ LIBS = -lws2_32 EXEC = .exe LIB = .dll PREOBJS = tewi.res +INSTALLER = install.exe diff --git a/Server/Makefile b/Server/Makefile index c746f1d..01bc151 100644 --- a/Server/Makefile +++ b/Server/Makefile @@ -7,7 +7,10 @@ include $(PWD)/Platform/$(PLATFORM).mk OBJS = version.o main.o config.o server.o http.o module.o strptime.o $(EXTOBJS) $(PREOBJS) -all: tewi$(EXEC) +all: tewi$(EXEC) $(INSTALLER) + +install.exe: tewi$(EXEC) install.nsi + makensis install.nsi tewi$(EXEC): $(OBJS) ../Common/common.a $(CC) $(LDFLAGS) $(EXTLDFLAGS) -o $@ $(OBJS) $(EXTLIBS) $(LIBS) ../Common/common.a diff --git a/Server/install.nsi b/Server/install.nsi new file mode 100644 index 0000000..6108d3c --- /dev/null +++ b/Server/install.nsi @@ -0,0 +1,39 @@ +# $Id$ + +Name "Tewi HTTPd" +OutFile "install.exe" +InstallDir "C:\Tewi" +Icon "tewi.ico" +LicenseData ../LICENSE +Page license +Page instfiles +UninstPage uninstConfirm +UninstPage instfiles +Section + CreateDirectory "$INSTDIR\etc" + CreateDirectory "$INSTDIR\www" + CreateDirectory "$INSTDIR\bin" + SetOutPath "$INSTDIR\bin" + File "tewi.exe" + SetOutPath "$INSTDIR\etc" + File /oname=tewi.conf "../example-win.conf" + SetOutPath "$INSTDIR\www" + File /oname=index.html "../itworks.html" + + CreateDirectory "$SMPROGRAMS\Tewi HTTPd" + CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd.lnk" "$INSTDIR\bin\tewi.exe" "" + CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd (verbose).lnk" "$INSTDIR\bin\tewi.exe" "-v" + CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Uninstall Tewi HTTPd.lnk" "$INSTDIR\uninstall.exe" "" + + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "DisplayName" "Tewi HTTPd" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"' + + WriteUninstaller "$INSTDIR\uninstall.exe" +SectionEnd + +Section "Uninstall" + RMDir /r "$INSTDIR" + RMDir /r "$SMPROGRAMS\Tewi HTTPd" + + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" +SectionEnd diff --git a/example-win.conf b/example-win.conf new file mode 100644 index 0000000..fb58ba8 --- /dev/null +++ b/example-win.conf @@ -0,0 +1,29 @@ +# $Id: example.conf 40 2024-09-17 12:31:08Z nishi $ +# This is an example config + +Listen 80 +#ListenSSL 443 + +#SSLKey key.pem +#SSLCertificate cert.pem + +MIMEType all application/octet-stream +MIMEType .html text/html +MIMEType .txt text/plain +MIMEType .png image/png + +Icon all /icons/unknown.png +Icon text/* /icons/text.png +Icon image/* /icons/image.png +Icon misc/dir /icons/folder.png +Icon misc/parent /icons/parent.png + +DirectoryIndex index.html + +Readme README + +DocumentRoot C:/Tewi/www + +BeginDirectory C:/Tewi/www + Allow all +EndDirectory diff --git a/itworks.html b/itworks.html new file mode 100644 index 0000000..62a11d3 --- /dev/null +++ b/itworks.html @@ -0,0 +1,11 @@ + + + + It Works + + +

It Works!

+
+ Congratulations - If you can see this page, it means Tewi HTTPd has been configured successfully! + +