1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-23 06:50:26 +00:00

Update installer and jpm to work better on windows.

This commit is contained in:
Calvin Rose 2019-05-29 19:01:12 -04:00
parent 12247bd958
commit e8516c29e0
2 changed files with 19 additions and 30 deletions

View File

@ -12,7 +12,7 @@ VIFileVersion "${PRODUCT_VERSION}"
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "" !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME ""
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "Software\Janet\${VERSION}" !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "Software\Janet\${VERSION}"
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "" !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME ""
!define MULTIUSER_INSTALLMODE_INSTDIR "Janet ${VERSION}" !define MULTIUSER_INSTALLMODE_INSTDIR "Janet-${VERSION}"
!include "MultiUser.nsh" !include "MultiUser.nsh"
!include "MUI2.nsh" !include "MUI2.nsh"
!include ".\tools\EnvVarUpdate.nsh" !include ".\tools\EnvVarUpdate.nsh"
@ -42,7 +42,7 @@ BrandingText "The Janet Programming Language"
# Pick Install Directory # Pick Install Directory
!insertmacro MULTIUSER_PAGE_INSTALLMODE !insertmacro MULTIUSER_PAGE_INSTALLMODE
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_INSFILES !insertmacro MUI_PAGE_INSTFILES
# Done # Done
!insertmacro MUI_PAGE_FINISH !insertmacro MUI_PAGE_FINISH
@ -58,7 +58,7 @@ section "Janet" BfWSection
createDirectory "$INSTDIR\Library" createDirectory "$INSTDIR\Library"
createDirectory "$INSTDIR\C" createDirectory "$INSTDIR\C"
createDirectory "$INSTDIR\bin" createDirectory "$INSTDIR\bin"
setOutPath $INSTDIR setOutPath "$INSTDIR"
file /oname=bin\janet.exe dist\janet.exe file /oname=bin\janet.exe dist\janet.exe
file /oname=logo.ico assets\icon.ico file /oname=logo.ico assets\icon.ico
@ -127,19 +127,10 @@ section "uninstall"
delete "$SMPROGRAMS\Janet.lnk" delete "$SMPROGRAMS\Janet.lnk"
# Remove files # Remove files
delete $INSTDIR\logo.ico delete "$INSTDIR\logo.ico"
rmdir /S "$INSTDIR\Library"
delete $INSTDIR\C\janet.c rmdir /S "$INSTDIR\bin"
delete $INSTDIR\C\janet.h rmdir /S "$INSTDIR\C"
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
# Remove env vars # Remove env vars
@ -159,11 +150,7 @@ section "uninstall"
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
# Always delete uninstaller as the last action # Always delete uninstaller as the last action
delete $INSTDIR\uninstall.exe delete "$INSTDIR\uninstall.exe"
rmDir "$INSTDIR\Library"
rmDir "$INSTDIR\C"
rmDir "$INSTDIR\bin"
# Remove uninstaller information from the registry # Remove uninstaller information from the registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Janet" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Janet"

View File

@ -164,7 +164,7 @@
(defn copy (defn copy
"Copy a file or directory recursively from one location to another." "Copy a file or directory recursively from one location to another."
[src dest] [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 # C Compilation
@ -224,10 +224,12 @@
"Generate the c flags from the input options." "Generate the c flags from the input options."
[opts] [opts]
(string (opt opts :cflags CFLAGS) (string (opt opts :cflags CFLAGS)
(if is-win " /I" " -I") (if is-win " /I\"" " \"-I")
(opt opts :headerpath JANET_HEADERPATH) (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 (defn- compile-c
"Compile a C file into an object file." "Compile a C file into an object file."
@ -237,8 +239,8 @@
(def defines (interpose " " (make-defines (opt opts :defines {})))) (def defines (interpose " " (make-defines (opt opts :defines {}))))
(rule dest [src] (rule dest [src]
(if is-win (if is-win
(shell cc " " ;defines " /nologo /c " cflags " /Fo" dest " " src) (shell cc " " ;defines " /nologo /c " cflags " /Fo\"" dest `" "` src `"`)
(shell cc " -c " src " " ;defines " " cflags " -o " dest)))) (shell cc " -c '" src "' " ;defines " " cflags " -o '" dest `'`))))
(defn- link-c (defn- link-c
"Link a number of object files together." "Link a number of object files together."
@ -246,11 +248,11 @@
(def ld (opt opts :linker LD)) (def ld (opt opts :linker LD))
(def cflags (getcflags opts)) (def cflags (getcflags opts))
(def lflags (opt opts :lflags LDFLAGS)) (def lflags (opt opts :lflags LDFLAGS))
(def olist (string/join objects " ")) (def olist (string/join objects `" "`))
(rule target objects (rule target objects
(if is-win (if is-win
(shell ld " " lflags " /DLL /OUT:" target " " olist " " (opt opts :headerpath JANET_HEADERPATH) "\\janet.lib") (shell ld " " lflags " /DLL /OUT:" target ` "` olist `" "` (opt opts :headerpath JANET_HEADERPATH) `"\\janet.lib`)
(shell ld " " cflags " -o " target " " olist " " lflags)))) (shell ld " " cflags ` -o "` target `" "` olist `" ` lflags))))
(defn- create-buffer-c (defn- create-buffer-c
"Inline raw byte file as a c file." "Inline raw byte file as a c file."