Skip to content

Commit

Permalink
do the windows arch dance
Browse files Browse the repository at this point in the history
  • Loading branch information
Razish committed Oct 13, 2023
1 parent c0352e2 commit 8a78c9b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ jobs:
working-directory: ${{ github.workspace }}
shell: pwsh
run: |
if ( ${{ matrix.arch }} -eq "x86" ) {
$env:TARGET_ARCH="x86"
}
$env:PATH="${{ github.workspace }}\.lua\lib;$env:PATH"
$env:LUA_CPATH="$env:USERPROFILE\AppData\Roaming\LuaRocks\lib\lua\5.4\?.dll"
lua package.lua
Expand Down
12 changes: 4 additions & 8 deletions package.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ local function get_platform_details()
if package.config:sub(1, 1) == '\\' then
-- Windows
local env_OS = os.getenv('OS')
print('env_OS: ' .. env_OS)
local env_ARCH = os.getenv('PROCESSOR_ARCHITECTURE')
print('env_ARCH: ' .. env_ARCH)
if env_OS and env_ARCH then return env_OS, env_ARCH end
local archTranslation = {AMD64 = 'x86_64'};
local arch = archTranslation[env_ARCH] and archTranslation[env_ARCH] or env_ARCH
if env_OS and arch then return env_OS, arch end
else
-- hopefullu a POSIX-y unix
local os_name = io.popen('uname -s', 'r'):read('*l')
Expand All @@ -32,20 +32,16 @@ local function get_platform_details()
end

local host_platform, arch = get_platform_details()
print('host_platform: ' .. host_platform)
print('arch: ' .. arch)
local target_arch = os.getenv('TARGET_ARCH') -- this can override what arch we're packaging
arch = target_arch and target_arch or arch
print('arch: ' .. arch)

local nixy = true and package.config:find('/') or false
local suffix = host_platform .. '_' .. arch
local libExt = ({
Linux = '.so', --
Windows = '.dll', --
Windows_NT = '.dll', --
Darwin = '.dylib',
})[host_platform]
print('libExt: ' .. libExt)
local extension = nixy and '.zip' or '.pk3'

local paks = {
Expand Down

0 comments on commit 8a78c9b

Please sign in to comment.