mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-29 22:53:03 +00:00 
			
		
		
		
	Update installer and jpm to work better on windows.
This commit is contained in:
		| @@ -12,7 +12,7 @@ VIFileVersion "${PRODUCT_VERSION}" | ||||
| !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "" | ||||
| !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "Software\Janet\${VERSION}" | ||||
| !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "" | ||||
| !define MULTIUSER_INSTALLMODE_INSTDIR "Janet ${VERSION}" | ||||
| !define MULTIUSER_INSTALLMODE_INSTDIR "Janet-${VERSION}" | ||||
| !include "MultiUser.nsh" | ||||
| !include "MUI2.nsh" | ||||
| !include ".\tools\EnvVarUpdate.nsh" | ||||
| @@ -42,7 +42,7 @@ BrandingText "The Janet Programming Language" | ||||
| # Pick Install Directory | ||||
| !insertmacro MULTIUSER_PAGE_INSTALLMODE | ||||
| !insertmacro MUI_PAGE_DIRECTORY | ||||
| !define MUI_PAGE_INSFILES | ||||
| !insertmacro MUI_PAGE_INSTFILES | ||||
|  | ||||
| # Done | ||||
| !insertmacro MUI_PAGE_FINISH | ||||
| @@ -58,7 +58,7 @@ section "Janet" BfWSection | ||||
|     createDirectory "$INSTDIR\Library" | ||||
|     createDirectory "$INSTDIR\C" | ||||
|     createDirectory "$INSTDIR\bin" | ||||
| 	setOutPath $INSTDIR | ||||
| 	setOutPath "$INSTDIR" | ||||
|      | ||||
|     file /oname=bin\janet.exe dist\janet.exe | ||||
|     file /oname=logo.ico assets\icon.ico | ||||
| @@ -127,19 +127,10 @@ section "uninstall" | ||||
| 	delete "$SMPROGRAMS\Janet.lnk" | ||||
|   | ||||
| 	# Remove files | ||||
|     delete $INSTDIR\logo.ico | ||||
|      | ||||
|     delete $INSTDIR\C\janet.c | ||||
|     delete $INSTDIR\C\janet.h | ||||
|     delete $INSTDIR\C\janet.lib | ||||
|     delete $INSTDIR\C\janet.exp | ||||
|     delete $INSTDIR\C\janetconf.h | ||||
|      | ||||
|     delete $INSTDIR\bin\jpm.janet | ||||
|     delete $INSTDIR\bin\jpm.bat | ||||
|     delete $INSTDIR\bin\janet.exe | ||||
|  | ||||
|     delete $INSTDIR\Library\cook.janet | ||||
|     delete "$INSTDIR\logo.ico" | ||||
|     rmdir /S "$INSTDIR\Library" | ||||
|     rmdir /S "$INSTDIR\bin" | ||||
|     rmdir /S "$INSTDIR\C" | ||||
|      | ||||
|     # Remove env vars | ||||
|  | ||||
| @@ -159,11 +150,7 @@ section "uninstall" | ||||
|     SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 | ||||
|       | ||||
| 	# Always delete uninstaller as the last action | ||||
| 	delete $INSTDIR\uninstall.exe | ||||
|   | ||||
|     rmDir "$INSTDIR\Library" | ||||
| 	rmDir "$INSTDIR\C" | ||||
|     rmDir "$INSTDIR\bin" | ||||
| 	delete "$INSTDIR\uninstall.exe" | ||||
|   | ||||
| 	# Remove uninstaller information from the registry | ||||
| 	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Janet" | ||||
|   | ||||
| @@ -164,7 +164,7 @@ | ||||
| (defn copy | ||||
|   "Copy a file or directory recursively from one location to another." | ||||
|   [src dest] | ||||
|   (shell (if is-win "xcopy " "cp -rf ") src " " dest (if is-win " /h /y /t /e" ""))) | ||||
|   (shell (if is-win "xcopy " "cp -rf ") `"` src `" "` dest (if is-win `" /h /y /e` `"`))) | ||||
|  | ||||
| # | ||||
| # C Compilation | ||||
| @@ -224,10 +224,12 @@ | ||||
|   "Generate the c flags from the input options." | ||||
|   [opts] | ||||
|   (string (opt opts :cflags CFLAGS) | ||||
|           (if is-win " /I" " -I") | ||||
|           (if is-win " /I\"" " \"-I") | ||||
|           (opt opts :headerpath JANET_HEADERPATH) | ||||
|           (if is-win " /O" " -O") | ||||
|           (opt opts :optimize OPTIMIZE))) | ||||
|           `"` | ||||
|           (if is-win " /O\"" " \"-O") | ||||
|           (opt opts :optimize OPTIMIZE) | ||||
|           `"`)) | ||||
|  | ||||
| (defn- compile-c | ||||
|   "Compile a C file into an object file." | ||||
| @@ -237,8 +239,8 @@ | ||||
|   (def defines (interpose " " (make-defines (opt opts :defines {})))) | ||||
|   (rule dest [src] | ||||
|         (if is-win | ||||
|           (shell cc " " ;defines " /nologo /c " cflags " /Fo" dest " " src) | ||||
|           (shell cc " -c " src " " ;defines " " cflags " -o " dest)))) | ||||
|           (shell cc " " ;defines " /nologo /c " cflags " /Fo\"" dest `" "` src `"`) | ||||
|           (shell cc " -c '" src "' " ;defines " " cflags " -o '" dest `'`)))) | ||||
|  | ||||
| (defn- link-c | ||||
|   "Link a number of object files together." | ||||
| @@ -246,11 +248,11 @@ | ||||
|   (def ld (opt opts :linker LD)) | ||||
|   (def cflags (getcflags opts)) | ||||
|   (def lflags (opt opts :lflags LDFLAGS)) | ||||
|   (def olist (string/join objects " ")) | ||||
|   (def olist (string/join objects `" "`)) | ||||
|   (rule target objects | ||||
|         (if is-win | ||||
|           (shell ld " " lflags " /DLL /OUT:" target " " olist " " (opt opts :headerpath JANET_HEADERPATH) "\\janet.lib") | ||||
|           (shell ld " " cflags " -o " target " " olist " " lflags)))) | ||||
|           (shell ld " " lflags " /DLL /OUT:" target ` "` olist `" "` (opt opts :headerpath JANET_HEADERPATH) `"\\janet.lib`) | ||||
|           (shell ld " " cflags ` -o "` target `" "` olist `" ` lflags)))) | ||||
|  | ||||
| (defn- create-buffer-c | ||||
|   "Inline raw byte file as a c file." | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose