Build #96
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build_linux: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Build Lua Lib | |
run: | | |
wget https://www.lua.org/ftp/lua-5.4.6.tar.gz | |
tar -xvf lua-5.4.6.tar.gz | |
cd lua-5.4.6/src/ | |
sed -i '/MYCFLAGS=/ !b; s/$/ -fPIC/' Makefile | |
sed -i '/MYLDFLAGS=/ !b; s/$/ -fPIC/' Makefile | |
make linux | |
cd - | |
- name: Build luasockets | |
run: | | |
git clone https://github.com/lunarmodules/luasocket --depth 1 | |
cd luasocket/src/ | |
cp ../../lua-5.4.6/src/liblua.a . | |
cp ../../lua-5.4.6/src/lua.h . | |
cp ../../lua-5.4.6/src/luaconf.h . | |
cp ../../lua-5.4.6/src/lauxlib.h . | |
perl -0777 -i.original -pe 's/LUAV\?=5\.1/LUAV?=5.4/' makefile | |
perl -0777 -i.original -pe 's/CFLAGS_linux=\$\(LUAINC:%=-I%\) \$\(DEF\) -Wall -Wshadow -Wextra.*\\\n.*-Wimplicit -O2 -ggdb3 -fpic/CFLAGS_linux=\$\(LUAINC:%=-I%\) \$\(DEF\) -Wall -Wshadow -Wextra \\\n\t-Wimplicit -O2 -fPIC/' makefile | |
perl -0777 -i.original -pe 's/LDFLAGS_linux=-O -shared -fpic -o/LDFLAGS_linux=-O -Wl,-Bstatic -L. -llua -Wl,-Bdynamic -shared -fPIC -o/' makefile | |
perl -0777 -i.original -pe 's/SOCKET_SO=socket-\$\(SOCKET_V\)\.\$\(SO\)/SOCKET_SO=core\.\$\(SO\) /' makefile | |
make linux | |
- name: collect files | |
run: | | |
mkdir archive | |
mkdir archive/socket | |
cp luasocket/src/core.so archive/socket | |
cp luasocket/src/*.lua archive | |
- name: Upload linux artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mavriq-lua-sockts(linux) | |
path: archive | |
build_macos: | |
runs-on: macos-11 | |
steps: | |
- name: Build Lua Lib | |
run: | | |
wget https://www.lua.org/ftp/lua-5.4.6.tar.gz | |
tar -xvf lua-5.4.6.tar.gz | |
cd lua-5.4.6/src/ | |
perl -0777 -i.original -pe 's/MYCFLAGS=/MYCFLAGS= -mmacosx-version-min=10.9 -arch arm64 -arch x86_64/' makefile | |
perl -0777 -i.original -pe 's/MYLDFLAGS=/MYLDFLAGS= -mmacosx-version-min=10.9 -arch arm64 -arch x86_64/' makefile | |
make macosx | |
cd - | |
- name: Build luasockets | |
run: | | |
git clone https://github.com/lunarmodules/luasocket --depth 1 | |
cd luasocket/src/ | |
cp ../../lua-5.4.6/src/liblua.a . | |
cp ../../lua-5.4.6/src/lua.h . | |
cp ../../lua-5.4.6/src/luaconf.h . | |
cp ../../lua-5.4.6/src/lauxlib.h . | |
perl -0777 -i.original -pe 's/LUAV\?=5\.1/LUAV?=5.4/' makefile | |
perl -0777 -i.original -pe 's/CFLAGS_macosx=\$\(LUAINC:%=-I%\) \$\(DEF\) -Wall -O2 -fno-common.*/CFLAGS_macosx=\$\(LUAINC:%=-I%\) \$\(DEF\) -Wall -Wshadow -Wextra -mmacosx-version-min=10.9 -arch arm64 -arch x86_64/' makefile | |
perl -0777 -i.original -pe 's/LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o.*/LDFLAGS_macosx= -mmacosx-version-min=10.9 -arch arm64 -arch x86_64 -L. -llua -bundle -o /' makefile | |
perl -0777 -i.original -pe 's/SOCKET_SO=socket-\$\(SOCKET_V\)\.\$\(SO\)/SOCKET_SO=core\.\$\(SO\) /' makefile | |
make macosx | |
- name: Codesign executable | |
env: | |
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} | |
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} | |
run: | | |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 | |
security create-keychain -p abcd1234 build.keychain | |
security default-keychain -s build.keychain | |
security unlock-keychain -p abcd1234 build.keychain | |
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign | |
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k abcd1234 build.keychain | |
/usr/bin/codesign --force -s "Developer ID Application: Geoff Van Brunt (45VRR5GY44)" luasocket/src/core.so -v | |
- name: Collect files | |
run: | | |
mkdir archive | |
mkdir archive/socket | |
cp luasocket/src/core.so archive/socket | |
cp luasocket/src/*.lua archive | |
- name: Upload mac artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mavriq-lua-sockts(mac) | |
path: archive | |
build_windows: | |
runs-on: windows-2022 | |
steps: | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- name: Build lua static | |
run: | | |
curl -sSL -o lua.tar.gz https://www.lua.org/ftp/lua-5.4.6.tar.gz | |
tar -xvf lua.tar.gz | |
cd lua-5.4.6/src/ | |
cl /MD /O2 /c /DLUA_BUILD_AS_DLL *.c | |
ren lua.obj lua.o | |
#ren luac.obj luac.o | |
#link /DLL /IMPLIB:lua5.4.6.lib /OUT:lua5.4.6.dll *.obj | |
#link /OUT:lua.exe lua.o lua5.4.6.lib | |
lib /OUT:lua54.lib *.obj | |
#link /OUT:luac.exe luac.o lua54.lib | |
- name: Clone luasockets | |
run: | | |
git clone https://github.com/lunarmodules/luasocket --depth 1 | |
cd luasocket/ | |
sed -i -e 's/LUAV>5\.3/LUAV>5.4/' lua.props | |
cp ../lua-5.4.6/src/lua54.lib . | |
cd src/ | |
cp ../../lua-5.4.6/src/lua.h . | |
cp ../../lua-5.4.6/src/luaconf.h . | |
cp ../../lua-5.4.6/src/lauxlib.h . | |
cd .. | |
- name: Setup MSBuild path | |
uses: microsoft/setup-msbuild@v1.1 | |
- name: Build luasockets | |
run: | | |
cd luasocket | |
msbuild socket.vcxproj /p:Configuration=Release /p:Platform=x64 /property:AdditionalDependencies=lua54.lib /property:WindowsTargetPlatformVersion=10.0.19041.0 | |
- name: Collect files | |
run: | | |
mkdir archive | |
mkdir archive/socket | |
cp luasocket/x64/release/socket/core.dll archive/socket | |
cp luasocket/src/*.lua archive | |
- name: Upload windows artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mavriq-lua-sockts(win) | |
path: archive |