Skip to content

Commit 2642fb2

Browse files
committed
revert: portable
This reverts commit 0ade82b. Revert portable (#22) * Revert "Portable (#19)" This reverts commit 0ade82b. * Revert "update readme (#20)" This reverts commit fcf0fc3.
1 parent 1a8c7b9 commit 2642fb2

File tree

6 files changed

+66
-7
lines changed

6 files changed

+66
-7
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v3
1717
- uses: actions/download-artifact@v3
1818
- run: |
19-
gh release create "${TAG}" --notes "Lua ${TAG}" ./build/*.zip
19+
gh release create "${TAG}" --notes "Lua ${TAG}" ./build/*.msi ./build/*.zip
2020
env:
2121
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2222
TAG: ${{ inputs.tag }}

.github/workflows/reusable-package.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
steps:
88
- uses: actions/checkout@v3
99
- name: Install required tools
10-
run: choco install ninja
10+
run: choco install ninja ghostscript
1111
- name: Generate Ninja build
1212
run: cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=clang
1313
- name: Package
@@ -16,5 +16,6 @@ jobs:
1616
with:
1717
name: build
1818
path: |
19+
build/*.msi
1920
build/*.zip
2021
if-no-files-found: error

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ lua-*/
1616
luarocks-*/
1717
*.gz
1818
*.zip
19+
lua-logo-nolabel.ps

CMakeLists.txt

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ if(WIN32)
3333
DESTINATION ${CMAKE_CURRENT_LIST_DIR}
3434
)
3535
endif()
36+
37+
set(LUA_LOGO lua-logo-nolabel.ps)
38+
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/${LUA_LOGO})
39+
file(DOWNLOAD https://www.lua.org/images/${LUA_LOGO}
40+
${CMAKE_CURRENT_LIST_DIR}/${LUA_LOGO}
41+
)
42+
endif()
43+
44+
add_custom_command(OUTPUT lua.ico
45+
COMMAND magick ${CMAKE_CURRENT_LIST_DIR}/${LUA_LOGO} -resize 256x256 lua.ico
46+
MAIN_DEPENDENCY ${CMAKE_CURRENT_LIST_DIR}/${LUA_LOGO}
47+
COMMENT "Generating Lua icon"
48+
)
49+
add_custom_target(luaicon ALL DEPENDS lua.ico)
3650
endif()
3751

3852
set(LUA_SRC lua-${CMAKE_PROJECT_VERSION}/src)
@@ -117,18 +131,22 @@ install(TARGETS lualib FILE_SET include)
117131
install(FILES ${CMAKE_CURRENT_LIST_DIR}/LICENSE.txt TYPE DOC)
118132

119133
if(WIN32)
120-
set(CPACK_GENERATOR ZIP)
134+
set(CPACK_GENERATOR ZIP WIX)
121135
install(FILES
122136
${CMAKE_CURRENT_BINARY_DIR}/lua.pdb
123137
${CMAKE_CURRENT_BINARY_DIR}/luac.pdb
124138
${CMAKE_CURRENT_BINARY_DIR}/lua54.pdb
125139
DESTINATION bin)
140+
set(CPACK_WIX_UPGRADE_GUID "3e5a792d-9d31-41d5-a93f-629ab7c7683d")
141+
set(CPACK_WIX_PRODUCT_ICON lua.ico)
142+
list(APPEND CPACK_WIX_EXTENSIONS WixUtilExtension)
143+
list(APPEND CPACK_WIX_PATCH_FILE ${CMAKE_CURRENT_LIST_DIR}/WixPatch.xml)
126144
else()
127145
install(FILES ${LUA_DOC}/lua.1 ${LUA_DOC}/luac.1
128146
DESTINATION man/man1
129147
)
130148
endif()
131-
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
149+
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY FALSE)
132150
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_LIST_DIR}/LICENSE.txt)
133151
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CMAKE_PROJECT_NAME})
134152
set(CPACK_PACKAGE_VENDOR DEVCOM)

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,30 @@ winget install --id DEVCOM.Lua
2323
[Clang](https://clang.llvm.org/))
2424
- [CMake](https://cmake.org/)
2525
- [Ninja](https://ninja-build.org/)
26+
- [ImageMagick](https://imagemagick.org/)
27+
- [GhostScript](https://www.ghostscript.com/)
28+
- [WiX v3](https://wixtoolset.org/docs/wix3/)
2629

27-
You can install these components with the following
30+
You can install the first five components with the following
2831
[winget](https://learn.microsoft.com/windows/package-manager/winget/) commands:
2932

3033
```powershell
3134
winget install --id LLVM.LLVM
3235
winget install --id Kitware.CMake
3336
winget install --id Ninja-build.Ninja
37+
winget install --id ImageMagick.ImageMagick
38+
winget install --id ArtifexSoftware.GhostScript
39+
```
40+
41+
WiX v3 is available at <https://github.com/wixtoolset/wix3/releases/>. It
42+
requires .NET Framework 3.5 that can be installed with the following command:
43+
44+
```powershell
45+
Start-Process `
46+
-FilePath pwsh `
47+
-ArgumentList "-Command `"& {Enable-WindowsOptionalFeature -Online -FeatureName NetFx3}`"" `
48+
-Wait `
49+
-Verb RunAs
3450
```
3551

3652
Update your path environment with `setx` (supposing you installed the tools in
@@ -47,14 +63,17 @@ Check if `PATH` was set correctly:
4763
Get-Command clang
4864
Get-Command cmake
4965
Get-Command ninja
66+
Get-Command magick
67+
Get-Command gswin64
5068
```
5169

5270
You may need to restart your Windows session if you can't find `ninja` even
5371
after restarting your terminal.
5472

5573
## Build
5674

57-
Use the following commands to generate a ZIP package with Lua and LuaRocks:
75+
Use the following commands to generate the installation package in both ZIP and
76+
MSI formats:
5877

5978
```powershell
6079
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
@@ -66,4 +85,4 @@ code and LuaRocks binaries.
6685

6786
For convenience, you can use the `Build-Lua.ps1` script to run these commands.
6887

69-
If successful, the ZIP file will be available in the `build` directory.
88+
If successful, the ZIP and MSI files will be available in the `build` directory.

WixPatch.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<CPackWiXPatch>
2+
<!-- Fragment ID is from [build/_CPack_Packages/win64/WIX/features.wxs] -->
3+
<CPackWiXFragment Id="CM_CP_bin.lua.exe">
4+
<Environment
5+
Id='UpdatePath'
6+
Name='PATH'
7+
Action='set'
8+
Permanent='no'
9+
Part='last'
10+
Value='[INSTALL_ROOT]bin'
11+
/>
12+
</CPackWiXFragment>
13+
14+
<!-- Allow installation by non-administrative users -->
15+
<!-- https://learn.microsoft.com/windows/win32/msi/allusers -->
16+
<CPackWiXFragment Id="#PRODUCT">
17+
<Property Id="ALLUSERS" Value="2" />
18+
<Property Id="MSIINSTALLPERUSER" Value="1" />
19+
</CPackWiXFragment>
20+
</CPackWiXPatch>

0 commit comments

Comments
 (0)