mirror of
https://github.com/janet-lang/janet
synced 2024-12-23 06:50:26 +00:00
Update installer and make things build on windows.
We can now build windows executables with jpm.
This commit is contained in:
parent
7e97687c9e
commit
ec32d11b76
@ -20,6 +20,10 @@ init:
|
|||||||
install:
|
install:
|
||||||
- choco install nsis -y -pre
|
- choco install nsis -y -pre
|
||||||
- build_win all
|
- build_win all
|
||||||
|
- refreshenv
|
||||||
|
# We need to reload vcvars after refreshing
|
||||||
|
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||||
|
- build_win test-install
|
||||||
build: off
|
build: off
|
||||||
|
|
||||||
only_commits:
|
only_commits:
|
||||||
|
0
auxbin/jpm
Executable file → Normal file
0
auxbin/jpm
Executable file → Normal file
@ -464,7 +464,13 @@ int main(int argc, const char **argv) {
|
|||||||
(defn clear-cache
|
(defn clear-cache
|
||||||
"Clear the global git cache."
|
"Clear the global git cache."
|
||||||
[]
|
[]
|
||||||
(rm (find-cache)))
|
(def cache (find-cache))
|
||||||
|
(print "clearing " cache "...")
|
||||||
|
(if is-win
|
||||||
|
# Git for windows decided that .git should be hidden and everything in it read-only.
|
||||||
|
# This means we can't delete things easily.
|
||||||
|
(os/shell (string `rmdir /S /Q "` cache `"`))
|
||||||
|
(rm cache)))
|
||||||
|
|
||||||
(defn install-git
|
(defn install-git
|
||||||
"Install a bundle from git. If the bundle is already installed, the bundle
|
"Install a bundle from git. If the bundle is already installed, the bundle
|
||||||
|
@ -159,7 +159,7 @@ exit /b 0
|
|||||||
:INSTALL
|
:INSTALL
|
||||||
@echo Running Installer...
|
@echo Running Installer...
|
||||||
FOR %%a in (janet-*-windows-installer.exe) DO (
|
FOR %%a in (janet-*-windows-installer.exe) DO (
|
||||||
%%a /S /D=%userprofile%\AppData\Local\Janet\
|
%%a /S /CurrentUser
|
||||||
)
|
)
|
||||||
exit /b 0
|
exit /b 0
|
||||||
|
|
||||||
@ -183,8 +183,6 @@ call %0 dist
|
|||||||
@if errorlevel 1 exit /b 1
|
@if errorlevel 1 exit /b 1
|
||||||
call %0 install
|
call %0 install
|
||||||
@if errorlevel 1 exit /b 1
|
@if errorlevel 1 exit /b 1
|
||||||
call %0 test-install
|
|
||||||
@if errorlevel 1 exit /b 1
|
|
||||||
@echo Done!
|
@echo Done!
|
||||||
exit /b 0
|
exit /b 0
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ VIFileVersion "${PRODUCT_VERSION}"
|
|||||||
!include "MUI2.nsh"
|
!include "MUI2.nsh"
|
||||||
!include ".\tools\EnvVarUpdate.nsh"
|
!include ".\tools\EnvVarUpdate.nsh"
|
||||||
!include "LogicLib.nsh"
|
!include "LogicLib.nsh"
|
||||||
!include "./tools\FileAssociation.nsh"
|
|
||||||
|
|
||||||
# Basics
|
# Basics
|
||||||
Name "Janet"
|
Name "Janet"
|
||||||
@ -82,7 +81,7 @@ section "Janet" BfWSection
|
|||||||
createDirectory "$INSTDIR\C"
|
createDirectory "$INSTDIR\C"
|
||||||
createDirectory "$INSTDIR\bin"
|
createDirectory "$INSTDIR\bin"
|
||||||
createDirectory "$INSTDIR\docs"
|
createDirectory "$INSTDIR\docs"
|
||||||
setOutPath "$INSTDIR"
|
setOutPath "$INSTDIR"
|
||||||
|
|
||||||
# Bin files
|
# Bin files
|
||||||
file /oname=bin\janet.exe dist\janet.exe
|
file /oname=bin\janet.exe dist\janet.exe
|
||||||
@ -109,11 +108,11 @@ section "Janet" BfWSection
|
|||||||
file README.md
|
file README.md
|
||||||
file LICENSE
|
file LICENSE
|
||||||
|
|
||||||
# Uninstaller - See function un.onInit and section "uninstall" for configuration
|
# Uninstaller - See function un.onInit and section "uninstall" for configuration
|
||||||
writeUninstaller "$INSTDIR\uninstall.exe"
|
writeUninstaller "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
# Start Menu
|
# Start Menu
|
||||||
createShortCut "$SMPROGRAMS\Janet.lnk" "$INSTDIR\bin\janet.exe" "" "$INSTDIR\logo.ico"
|
createShortCut "$SMPROGRAMS\Janet.lnk" "$INSTDIR\bin\janet.exe" "" "$INSTDIR\logo.ico"
|
||||||
|
|
||||||
# Set up Environment variables
|
# Set up Environment variables
|
||||||
!insertmacro WriteEnv JANET_PATH "$INSTDIR\Library"
|
!insertmacro WriteEnv JANET_PATH "$INSTDIR\Library"
|
||||||
@ -124,28 +123,28 @@ section "Janet" BfWSection
|
|||||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||||
|
|
||||||
# Update path
|
# Update path
|
||||||
${EnvVarUpdate} $0 "PATH" "A" "HKCU" "$INSTDIR\bin" ; Append
|
${If} $MultiUser.InstallMode == "AllUsers"
|
||||||
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin" ; Append
|
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin" ; Append
|
||||||
|
${Else}
|
||||||
# File Assocations
|
${EnvVarUpdate} $0 "PATH" "A" "HKCU" "$INSTDIR\bin" ; Append
|
||||||
${RegisterExtension} "$INSTDIR\bin\janet.exe" ".janet" "Janet Source File"
|
${EndIf}
|
||||||
|
|
||||||
# Registry information for add/remove programs
|
# Registry information for add/remove programs
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "DisplayName" "Janet"
|
WriteRegStr SHCTX "${UNINST_KEY}" "DisplayName" "Janet"
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "InstallLocation" "$INSTDIR"
|
WriteRegStr SHCTX "${UNINST_KEY}" "InstallLocation" "$INSTDIR"
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\logo.ico"
|
WriteRegStr SHCTX "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\logo.ico"
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "Publisher" "Janet-Lang.org"
|
WriteRegStr SHCTX "${UNINST_KEY}" "Publisher" "Janet-Lang.org"
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "HelpLink" "${HELPURL}"
|
WriteRegStr SHCTX "${UNINST_KEY}" "HelpLink" "${HELPURL}"
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "URLUpdateInfo" "${HELPURL}"
|
WriteRegStr SHCTX "${UNINST_KEY}" "URLUpdateInfo" "${HELPURL}"
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "URLInfoAbout" "${HELPURL}"
|
WriteRegStr SHCTX "${UNINST_KEY}" "URLInfoAbout" "${HELPURL}"
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "DisplayVersion" "${VERSION}"
|
WriteRegStr SHCTX "${UNINST_KEY}" "DisplayVersion" "${VERSION}"
|
||||||
WriteRegDWORD SHCTX "${UNINST_KEY}" "NoModify" 1
|
WriteRegDWORD SHCTX "${UNINST_KEY}" "NoModify" 1
|
||||||
WriteRegDWORD SHCTX "${UNINST_KEY}" "NoRepair" 1
|
WriteRegDWORD SHCTX "${UNINST_KEY}" "NoRepair" 1
|
||||||
WriteRegDWORD SHCTX "${UNINST_KEY}" "EstimatedSize" 1000
|
WriteRegDWORD SHCTX "${UNINST_KEY}" "EstimatedSize" 1000
|
||||||
# Add uninstall
|
# Add uninstall
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\" /$MultiUser.InstallMode"
|
WriteRegStr SHCTX "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\" /$MultiUser.InstallMode"
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /$MultiUser.InstallMode /S"
|
WriteRegStr SHCTX "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /$MultiUser.InstallMode /S"
|
||||||
|
|
||||||
sectionEnd
|
sectionEnd
|
||||||
|
|
||||||
# Uninstaller
|
# Uninstaller
|
||||||
@ -156,10 +155,10 @@ functionEnd
|
|||||||
|
|
||||||
section "uninstall"
|
section "uninstall"
|
||||||
|
|
||||||
# Remove Start Menu launcher
|
# Remove Start Menu launcher
|
||||||
delete "$SMPROGRAMS\Janet.lnk"
|
delete "$SMPROGRAMS\Janet.lnk"
|
||||||
|
|
||||||
# Remove files
|
# Remove files
|
||||||
delete "$INSTDIR\logo.ico"
|
delete "$INSTDIR\logo.ico"
|
||||||
delete "$INSTDIR\README.md"
|
delete "$INSTDIR\README.md"
|
||||||
delete "$INSTDIR\LICENSE"
|
delete "$INSTDIR\LICENSE"
|
||||||
@ -175,18 +174,19 @@ section "uninstall"
|
|||||||
!insertmacro DelEnv JANET_BINPATH
|
!insertmacro DelEnv JANET_BINPATH
|
||||||
|
|
||||||
# Unset PATH
|
# Unset PATH
|
||||||
${un.EnvVarUpdate} $0 "PATH" "R" "HKCU" "$INSTDIR\bin" ; Remove
|
${If} $MultiUser.InstallMode == "AllUsers"
|
||||||
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin" ; Remove
|
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin" ; Remove
|
||||||
|
${Else}
|
||||||
# File Associations
|
${un.EnvVarUpdate} $0 "PATH" "R" "HKCU" "$INSTDIR\bin" ; Remove
|
||||||
${UnRegisterExtension} ".janet" "Janet Source File"
|
${EndIf}
|
||||||
|
|
||||||
# make sure windows knows about the change
|
# make sure windows knows about the change
|
||||||
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"
|
||||||
|
|
||||||
# Remove uninstaller information from the registry
|
# Remove uninstaller information from the registry
|
||||||
DeleteRegKey SHCTX "${UNINST_KEY}"
|
DeleteRegKey SHCTX "${UNINST_KEY}"
|
||||||
sectionEnd
|
|
||||||
|
sectionEnd
|
@ -1,190 +0,0 @@
|
|||||||
/*
|
|
||||||
_____________________________________________________________________________
|
|
||||||
|
|
||||||
File Association
|
|
||||||
_____________________________________________________________________________
|
|
||||||
|
|
||||||
Based on code taken from http://nsis.sourceforge.net/File_Association
|
|
||||||
|
|
||||||
Usage in script:
|
|
||||||
1. !include "FileAssociation.nsh"
|
|
||||||
2. [Section|Function]
|
|
||||||
${FileAssociationFunction} "Param1" "Param2" "..." $var
|
|
||||||
[SectionEnd|FunctionEnd]
|
|
||||||
|
|
||||||
FileAssociationFunction=[RegisterExtension|UnRegisterExtension]
|
|
||||||
|
|
||||||
_____________________________________________________________________________
|
|
||||||
|
|
||||||
${RegisterExtension} "[executable]" "[extension]" "[description]"
|
|
||||||
|
|
||||||
"[executable]" ; executable which opens the file format
|
|
||||||
;
|
|
||||||
"[extension]" ; extension, which represents the file format to open
|
|
||||||
;
|
|
||||||
"[description]" ; description for the extension. This will be display in Windows Explorer.
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
${UnRegisterExtension} "[extension]" "[description]"
|
|
||||||
|
|
||||||
"[extension]" ; extension, which represents the file format to open
|
|
||||||
;
|
|
||||||
"[description]" ; description for the extension. This will be display in Windows Explorer.
|
|
||||||
;
|
|
||||||
|
|
||||||
_____________________________________________________________________________
|
|
||||||
|
|
||||||
Macros
|
|
||||||
_____________________________________________________________________________
|
|
||||||
|
|
||||||
Change log window verbosity (default: 3=no script)
|
|
||||||
|
|
||||||
Example:
|
|
||||||
!include "FileAssociation.nsh"
|
|
||||||
!insertmacro RegisterExtension
|
|
||||||
${FileAssociation_VERBOSE} 4 # all verbosity
|
|
||||||
!insertmacro UnRegisterExtension
|
|
||||||
${FileAssociation_VERBOSE} 3 # no script
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
!ifndef FileAssociation_INCLUDED
|
|
||||||
!define FileAssociation_INCLUDED
|
|
||||||
|
|
||||||
!include Util.nsh
|
|
||||||
|
|
||||||
!verbose push
|
|
||||||
!verbose 3
|
|
||||||
!ifndef _FileAssociation_VERBOSE
|
|
||||||
!define _FileAssociation_VERBOSE 3
|
|
||||||
!endif
|
|
||||||
!verbose ${_FileAssociation_VERBOSE}
|
|
||||||
!define FileAssociation_VERBOSE `!insertmacro FileAssociation_VERBOSE`
|
|
||||||
!verbose pop
|
|
||||||
|
|
||||||
!macro FileAssociation_VERBOSE _VERBOSE
|
|
||||||
!verbose push
|
|
||||||
!verbose 3
|
|
||||||
!undef _FileAssociation_VERBOSE
|
|
||||||
!define _FileAssociation_VERBOSE ${_VERBOSE}
|
|
||||||
!verbose pop
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
!macro RegisterExtensionCall _EXECUTABLE _EXTENSION _DESCRIPTION
|
|
||||||
!verbose push
|
|
||||||
!verbose ${_FileAssociation_VERBOSE}
|
|
||||||
Push `${_DESCRIPTION}`
|
|
||||||
Push `${_EXTENSION}`
|
|
||||||
Push `${_EXECUTABLE}`
|
|
||||||
${CallArtificialFunction} RegisterExtension_
|
|
||||||
!verbose pop
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro UnRegisterExtensionCall _EXTENSION _DESCRIPTION
|
|
||||||
!verbose push
|
|
||||||
!verbose ${_FileAssociation_VERBOSE}
|
|
||||||
Push `${_EXTENSION}`
|
|
||||||
Push `${_DESCRIPTION}`
|
|
||||||
${CallArtificialFunction} UnRegisterExtension_
|
|
||||||
!verbose pop
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
!define RegisterExtension `!insertmacro RegisterExtensionCall`
|
|
||||||
!define un.RegisterExtension `!insertmacro RegisterExtensionCall`
|
|
||||||
|
|
||||||
!macro RegisterExtension
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro un.RegisterExtension
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro RegisterExtension_
|
|
||||||
!verbose push
|
|
||||||
!verbose ${_FileAssociation_VERBOSE}
|
|
||||||
|
|
||||||
Exch $R2 ;exe
|
|
||||||
Exch
|
|
||||||
Exch $R1 ;ext
|
|
||||||
Exch
|
|
||||||
Exch 2
|
|
||||||
Exch $R0 ;desc
|
|
||||||
Exch 2
|
|
||||||
Push $0
|
|
||||||
Push $1
|
|
||||||
|
|
||||||
ReadRegStr $1 HKCR $R1 "" ; read current file association
|
|
||||||
StrCmp "$1" "" NoBackup ; is it empty
|
|
||||||
StrCmp "$1" "$R0" NoBackup ; is it our own
|
|
||||||
WriteRegStr HKCR $R1 "backup_val" "$1" ; backup current value
|
|
||||||
NoBackup:
|
|
||||||
WriteRegStr HKCR $R1 "" "$R0" ; set our file association
|
|
||||||
|
|
||||||
ReadRegStr $0 HKCR $R0 ""
|
|
||||||
StrCmp $0 "" 0 Skip
|
|
||||||
WriteRegStr HKCR "$R0" "" "$R0"
|
|
||||||
WriteRegStr HKCR "$R0\shell" "" "open"
|
|
||||||
WriteRegStr HKCR "$R0\DefaultIcon" "" "$R2,0"
|
|
||||||
Skip:
|
|
||||||
WriteRegStr HKCR "$R0\shell\open\command" "" '"$R2" "%1"'
|
|
||||||
WriteRegStr HKCR "$R0\shell\edit" "" "Edit $R0"
|
|
||||||
WriteRegStr HKCR "$R0\shell\edit\command" "" '"$R2" "%1"'
|
|
||||||
|
|
||||||
Pop $1
|
|
||||||
Pop $0
|
|
||||||
Pop $R2
|
|
||||||
Pop $R1
|
|
||||||
Pop $R0
|
|
||||||
|
|
||||||
!verbose pop
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
!define UnRegisterExtension `!insertmacro UnRegisterExtensionCall`
|
|
||||||
!define un.UnRegisterExtension `!insertmacro UnRegisterExtensionCall`
|
|
||||||
|
|
||||||
!macro UnRegisterExtension
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro un.UnRegisterExtension
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro UnRegisterExtension_
|
|
||||||
!verbose push
|
|
||||||
!verbose ${_FileAssociation_VERBOSE}
|
|
||||||
|
|
||||||
Exch $R1 ;desc
|
|
||||||
Exch
|
|
||||||
Exch $R0 ;ext
|
|
||||||
Exch
|
|
||||||
Push $0
|
|
||||||
Push $1
|
|
||||||
|
|
||||||
ReadRegStr $1 HKCR $R0 ""
|
|
||||||
StrCmp $1 $R1 0 NoOwn ; only do this if we own it
|
|
||||||
ReadRegStr $1 HKCR $R0 "backup_val"
|
|
||||||
StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
|
|
||||||
DeleteRegKey HKCR $R0
|
|
||||||
Goto NoOwn
|
|
||||||
|
|
||||||
Restore:
|
|
||||||
WriteRegStr HKCR $R0 "" $1
|
|
||||||
DeleteRegValue HKCR $R0 "backup_val"
|
|
||||||
DeleteRegKey HKCR $R1 ;Delete key with association name settings
|
|
||||||
|
|
||||||
NoOwn:
|
|
||||||
|
|
||||||
Pop $1
|
|
||||||
Pop $0
|
|
||||||
Pop $R1
|
|
||||||
Pop $R0
|
|
||||||
|
|
||||||
!verbose pop
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!endif # !FileAssociation_INCLUDED
|
|
0
tools/format.sh
Executable file → Normal file
0
tools/format.sh
Executable file → Normal file
Loading…
Reference in New Issue
Block a user