From a77ce769282a0a2805fb4af17adf4b57ab9a8c79 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Mon, 10 Dec 2018 22:20:04 -0500 Subject: [PATCH 1/5] Add NSIS installer script for windows. --- janet.nsi | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 janet.nsi diff --git a/janet.nsi b/janet.nsi new file mode 100644 index 00000000..f4c9cf56 --- /dev/null +++ b/janet.nsi @@ -0,0 +1,52 @@ +!define MULTIUSER_EXECUTIONLEVEL Highest +!define MULTIUSER_MUI +!define MULTIUSER_INSTALLMODE_COMMANDLINE +!define MULTIUSER_INSTALLMODE_INSTDIR "janet" +!include "MultiUser.nsh" +!include "MUI2.nsh" + +Name "Janet" +OutFile "janet.exe" + +!define MUI_ABORTWARNING + +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "LICENSE" +!insertmacro MUI_PAGE_COMPONENTS +!insertmacro MULTIUSER_PAGE_INSTALLMODE +!insertmacro MUI_PAGE_DIRECTORY + +!insertmacro MUI_PAGE_INSTFILES + +!insertmacro MUI_PAGE_FINISH + +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +!insertmacro MUI_LANGUAGE "English" + +Section "Janet" BfWSection + SetOutPath $INSTDIR + File "janet.exe" + WriteUninstaller "$INSTDIR\janet-uninstall.exe" +SectionEnd + +Function .onInit + !insertmacro MULTIUSER_INIT + !insertmacro MUI_LANGDLL_DISPLAY +FunctionEnd + +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${BfWSection} "The Janet programming language." +!insertmacro MUI_FUNCTION_DESCRIPTION_END + +Section "Uninstall" + Delete "$INSTDIR\janet.exe" + Delete "$INSTDIR\janet-uninstall.exe" + RMDir "$INSTDIR" +SectionEnd + +Function un.onInit + !insertmacro MULTIUSER_UNINIT + !insertmacro MUI_UNGETLANGUAGE +FunctionEnd \ No newline at end of file From 9723ddb96bb4f38277babc62d54b62e4e993f26a Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 22 Dec 2018 16:24:08 -0500 Subject: [PATCH 2/5] Fix string/number issue. --- .gitignore | 1 + Makefile | 2 +- appveyor.yml | 2 ++ build_win.bat | 1 - janet.nsi => janet-installer.nsi | 2 +- src/include/janet/janet.h | 29 +++++++++++++++-------------- 6 files changed, 20 insertions(+), 17 deletions(-) rename janet.nsi => janet-installer.nsi (97%) diff --git a/.gitignore b/.gitignore index 65ece6ae..25ba6526 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ janet /Emscripten /src/include/generated/*.h janet-*.tar.gz +dist # Emscripten *.bc diff --git a/Makefile b/Makefile index 29a45d83..d50ddc9e 100644 --- a/Makefile +++ b/Makefile @@ -157,7 +157,7 @@ dist: build/janet-dist.tar.gz build/janet-%.tar.gz: $(JANET_TARGET) src/include/janet/janet.h \ janet.1 LICENSE CONTRIBUTING.md $(JANET_LIBRARY) \ - build/doc.html README.md $(wildcard doc/*) + build/doc.html README.md $(wildcard doc/*.md) tar -czvf $@ $^ ######################### diff --git a/appveyor.yml b/appveyor.yml index c8243a46..320c9c47 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,6 +21,8 @@ install: - build_win - build_win test - build_win dist + - choco install nsis -y -pre + - call "C:\Program Files (x86)\NSIS\makensis.exe" janet-installer.nsi build: off diff --git a/build_win.bat b/build_win.bat index a5f6483f..1169d393 100644 --- a/build_win.bat +++ b/build_win.bat @@ -100,7 +100,6 @@ copy README.md dist\README.md copy janet.lib dist\janet.lib copy janet.exp dist\janet.exp copy src\include\janet\janet.h dist\janet.h -xcopy /s doc dist\doc exit /b 0 :TESTFAIL diff --git a/janet.nsi b/janet-installer.nsi similarity index 97% rename from janet.nsi rename to janet-installer.nsi index f4c9cf56..a7b74712 100644 --- a/janet.nsi +++ b/janet-installer.nsi @@ -6,7 +6,7 @@ !include "MUI2.nsh" Name "Janet" -OutFile "janet.exe" +OutFile "janet-install.exe" !define MUI_ABORTWARNING diff --git a/src/include/janet/janet.h b/src/include/janet/janet.h index f3a6cddd..5e5e74df 100644 --- a/src/include/janet/janet.h +++ b/src/include/janet/janet.h @@ -1158,8 +1158,8 @@ JANET_API int janet_typeabstract_err(JanetArgs args, int32_t n, const JanetAbstr } while (0) #define JANET_CHECKMANY(A, N, TS) do {\ if ((A).n > (N)) {\ - JanetType t = janet_type((A).v[(N)]);\ - if (!((1 << t) & (TS))) return janet_typemany_err(A, N, TS);\ + JanetType _t_ = janet_type((A).v[(N)]);\ + if (!((1 << _t_) & (TS))) return janet_typemany_err(A, N, TS);\ } else {\ if (!((TS) & JANET_NIL)) return janet_typemany_err(A, N, TS);\ }\ @@ -1167,9 +1167,9 @@ JANET_API int janet_typeabstract_err(JanetArgs args, int32_t n, const JanetAbstr #define JANET_CHECKABSTRACT(A, N, AT) do {\ if ((A).n > (N)) {\ - Janet x = (A).v[(N)];\ - if (!janet_checktype(x, JANET_ABSTRACT) ||\ - janet_abstract_type(janet_unwrap_abstract(x)) != (AT))\ + Janet _x_ = (A).v[(N)];\ + if (!janet_checktype(_x_, JANET_ABSTRACT) ||\ + janet_abstract_type(janet_unwrap_abstract(_x_)) != (AT))\ return janet_typeabstract_err(A, N, AT);\ } else {\ return janet_typeabstract_err(A, N, AT);\ @@ -1177,15 +1177,16 @@ JANET_API int janet_typeabstract_err(JanetArgs args, int32_t n, const JanetAbstr } while (0) #define JANET_ARG_NUMBER(DEST, A, N) do { \ - if ((A).n <= (N)) \ - return janet_typemany_err(A, N, JANET_TFLAG_NUMBER);\ - Janet val = (A).v[(N)];\ - if (janet_checktype(val, JANET_REAL)) { \ - DEST = janet_unwrap_real(val); \ - } else if (janet_checktype(val, JANET_INTEGER)) {\ - DEST = (double) janet_unwrap_integer(val);\ - }\ - else return janet_typemany_err(A, N, JANET_TFLAG_NUMBER); \ + if ((A).n <= (N)) return janet_typemany_err(A, N, JANET_TFLAG_NUMBER); \ + Janet _val_ = (A).v[(N)];\ + JanetType _type_ = janet_type(_val_); \ + if (_type_ == JANET_REAL) { \ + DEST = janet_unwrap_real(_val_); \ + } else if (_type_ == JANET_INTEGER) {\ + DEST = (double) janet_unwrap_integer(_val_);\ + } else { \ + return janet_typemany_err(A, N, JANET_TFLAG_NUMBER); \ + } \ } while (0) #define JANET_ARG_BOOLEAN(DEST, A, N) do { \ From 39198de60ab8c5f804687844bfb17454cd01ba47 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 22 Dec 2018 18:08:37 -0500 Subject: [PATCH 3/5] Add installer to distribution archive on windows. --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 320c9c47..db9b82a3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,9 +20,10 @@ init: install: - build_win - build_win test - - build_win dist - choco install nsis -y -pre - call "C:\Program Files (x86)\NSIS\makensis.exe" janet-installer.nsi + - build_win dist + - copy janet-install.exe doc\janet-install.exe build: off From 3bd7787efa0f8612f09dcff98b11a35db2dea35c Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 22 Dec 2018 18:30:13 -0500 Subject: [PATCH 4/5] Fix appveyor.yml --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index db9b82a3..3f4e2e68 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,7 +23,7 @@ install: - choco install nsis -y -pre - call "C:\Program Files (x86)\NSIS\makensis.exe" janet-installer.nsi - build_win dist - - copy janet-install.exe doc\janet-install.exe + - copy janet-install.exe dist\janet-install.exe build: off From 3f5ba64f30ce2785fe5c69d8a05d01ea55849344 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 22 Dec 2018 21:11:09 -0500 Subject: [PATCH 5/5] Update installer to add desktop app. --- appveyor.yml | 2 +- janet-installer.nsi | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 3f4e2e68..c9055a52 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,7 +23,7 @@ install: - choco install nsis -y -pre - call "C:\Program Files (x86)\NSIS\makensis.exe" janet-installer.nsi - build_win dist - - copy janet-install.exe dist\janet-install.exe + - copy janet-install.exe dist\install.exe build: off diff --git a/janet-installer.nsi b/janet-installer.nsi index a7b74712..94a8e2f7 100644 --- a/janet-installer.nsi +++ b/janet-installer.nsi @@ -29,6 +29,9 @@ Section "Janet" BfWSection SetOutPath $INSTDIR File "janet.exe" WriteUninstaller "$INSTDIR\janet-uninstall.exe" + + # Start Menu + CreateShortCut "$SMPROGRAMS\Janet.lnk" "$INSTDIR\janet.exe" "" "" SectionEnd Function .onInit