Build a Windows installer when doing a CI build.

This commit is contained in:
David Given 2022-07-19 21:21:48 +02:00
parent 79aff56b62
commit 4555352a18
3 changed files with 98 additions and 3 deletions

View file

@ -36,6 +36,7 @@ jobs:
make
mingw-w64-i686-gcc
mingw-w64-i686-lua
mingw-w64-i686-nsis
ninja
bison
flex
@ -44,5 +45,12 @@ jobs:
- uses: actions/checkout@v3
- name: build
run: |
make
make LDFLAGS=-s CFLAGS=-Os
- name: package
run: |
make ack-setup.exe
- name: upload setup
uses: actions/upload-artifact@v2
with:
name: ${{ github.event.repository.name }}.${{ github.sha }}
path: ack-setup.exe

View file

@ -15,8 +15,12 @@ ACK_TEMP_DIR ?= /tmp
# install it and just want to run the ACK from the build directory
# (/tmp/ack-build/staging, by default), leave this as $(INSDIR).
ifeq ($(OS),Windows_NT)
PREFIX ?= c:/Program Files (x86)/Amsterdam Compiler Kit
else
PREFIX ?= /usr/local
#PREFIX = $(INSDIR)
endif
# Where do you want to put the object files used when building?
@ -119,12 +123,16 @@ $(build-file): first/ackbuilder.lua Makefile $(lua-files)
INSDIR=$(INSDIR) \
PLATIND=$(PLATIND) \
PLATDEP=$(PLATDEP) \
PREFIX=$(PREFIX) \
PREFIX="$(PREFIX)" \
AR=$(AR) \
CC=$(CC) \
CFLAGS="$(CFLAGS)" \
LDFLAGS="$(LDFLAGS)" \
> $(build-file)
ack-setup.exe: etc/windows-installer.nsi
makensis -dBUILDDIR=$(BUILDDIR)/staging -dOUTFILE="$$(realpath $@)" $<
install:
mkdir -p $(PREFIX)
tar cf - -C $(INSDIR) . | tar xvf - -C $(PREFIX)

79
etc/windows-installer.nsi Normal file
View file

@ -0,0 +1,79 @@
!include MUI2.nsh
Name "The Amsterdam Compiler Kit"
OutFile "${OUTFILE}"
Unicode True
InstallDir "$PROGRAMFILES\Amsterdam Compiler Kit"
RequestExecutionLevel admin
SetCompressor /solid lzma
;--------------------------------
!define MUI_WELCOMEPAGE_TITLE "The Amsterdam Compiler Kit"
!define MUI_WELCOMEPAGE_TEXT "The ACK is a compiler toolchain supporting a \
variety of frontend and backends. It's not easy to use, so if you don't \
know what you're doing you shouldn't install this.$\r$\n\
$\r$\n\
This wizard will install the ACK on your computer.$\r$\n\
$\r$\n\
$_CLICK"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp"
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_WELCOME
!define MUI_COMPONENTSPAGE_NODESC
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_TITLE "Installation complete"
!define MUI_FINISHPAGE_TEXT_LARGE
!define MUI_FINISHPAGE_TEXT "The ACK is now ready to use, but \
hasn't been added to your path.$\r$\n\
$\r$\n\
Have fun!"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
; The stuff to install
Section "The ACK (required)"
SectionIn RO
SetOutPath $INSTDIR
File /r "${BUILDDIR}\*.*"
;File /oname=wordgrinder.exe "bin\wordgrinder-builtin-sdl-release.exe"
;File /oname=cwordgrinder.exe "bin\wordgrinder-builtin-wincon-release.exe"
;File "README.wg"
;File "licenses\COPYING.*"
;CreateDirectory $INSTDIR\Dictionaries
;File /oname=Dictionaries\British.dictionary "extras\british.dictionary"
;File /oname=Dictionaries\American-Canadian.dictionary "extras\american-canadian.dictionary"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WordGrinder" "DisplayName" "WordGrinder for Windows"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WordGrinder" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WordGrinder" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WordGrinder" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
; Remove files and uninstaller
RMDir /r $INSTDIR
SectionEnd