From ee25c22edd517af73aa54c3c7871257fa70df600 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 08:49:30 -0400 Subject: [PATCH 01/34] Did the following: - Removed .exe hardcoded extensions, so scripts masking scripts can be run instead - Default using curl instead of bitsadmin due to curl being native to windows now --- prereqs.bat | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/prereqs.bat b/prereqs.bat index 2f71b75..cd336f3 100644 --- a/prereqs.bat +++ b/prereqs.bat @@ -31,7 +31,7 @@ setlocal IF NOT DEFINED ZIP set "ZIP=7zip" IF NOT DEFINED GIT set "GIT=git" - IF NOT DEFINED DLM set "DLM=bitsadmin" + IF NOT DEFINED DLM set "DLM=curl" REM - Basic Switches --------------------------------------------- @@ -56,7 +56,7 @@ setlocal setlocal EnableDelayedExpansion IF [7zip] == [%ZIP%] ( - where 7z.exe + where 7z IF [!errorlevel!] == [1] ( echo %%ZIP%% - 7zip requested but not found in path goto failure @@ -64,7 +64,7 @@ setlocal ) IF [git] == [%GIT%] ( - where git.exe + where git IF [!errorlevel!] == [1] ( echo %%GIT%% - git requested but not found in path goto failure @@ -72,7 +72,7 @@ setlocal ) IF [bitsadmin] == [%DLM%] ( - where bitsadmin.exe + where bitsadmin IF [!errorlevel!] == [1] ( echo %%DLM%% - bitsadmin requested but not found in path goto failure @@ -80,7 +80,7 @@ setlocal ) IF [curl] == [%DLM%] ( - where curl.exe + where curl IF [!errorlevel!] == [1] ( echo %%DLM%% - curl requested but not found in path goto failure @@ -88,7 +88,7 @@ setlocal ) IF [wget] == [%DLM%] ( - where wget.exe + where wget IF [!errorlevel!] == [1] ( echo %%DLM%% - wget requested but not found in path goto failure @@ -166,8 +166,8 @@ setlocal echo Checking for cached %CWD%\lua-all.tar.gz folder ... IF NOT EXIST "%CWD%\lua-all.tar.gz" ( echo Not found. Downloading... - IF [bitsadmin] == [%DLM%] bitsadmin.exe /TRANSFER "lua-all.tar.gz" "https://www.lua.org/ftp/lua-all.tar.gz" %CWD%\lua-all.tar.gz - IF [wget] == [%DLM%] wget.exe "https://www.lua.org/ftp/lua-all.tar.gz" + IF [bitsadmin] == [%DLM%] bitsadmin /TRANSFER "lua-all.tar.gz" "https://www.lua.org/ftp/lua-all.tar.gz" %CWD%\lua-all.tar.gz + IF [wget] == [%DLM%] wget "https://www.lua.org/ftp/lua-all.tar.gz" IF [curl] == [%DLM%] curl "https://www.lua.org/ftp/lua-all.tar.gz" > %CWD%\lua-all.tar.gz IF NOT EXIST "%CWD%\lua-all.tar.gz" ( echo failed to download lua-all From 569991416be42cd6551ab23b0bbaaf10d9f66556 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 09:15:30 -0400 Subject: [PATCH 02/34] Changed the following: - build.* build [lua_ver] has been changed to build.* driver [lua_ver] in the usage, due to the previous change going overlooked in the help message --- build.mingw.bat | 2 +- build.msvs.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.mingw.bat b/build.mingw.bat index 8d28524..1147c78 100644 --- a/build.mingw.bat +++ b/build.mingw.bat @@ -358,7 +358,7 @@ REM Simplex help message :help echo Usage: echo. - echo build build lua-x.x.x Builds the driver with a default package + echo build driver lua-x.x.x Builds the driver with a default package echo build package lua-x.x.x Creates packages for the driver echo build clean Cleans the environment of built files echo build install [directory] Installs to a pre-created directory diff --git a/build.msvs.bat b/build.msvs.bat index 2d48425..233eb01 100644 --- a/build.msvs.bat +++ b/build.msvs.bat @@ -355,7 +355,7 @@ REM Simplex help message :help echo Usage: echo. - echo build build lua-x.x.x Builds the driver with a default package + echo build driver lua-x.x.x Builds the driver with a default package echo build package lua-x.x.x Creates packages for the driver echo build clean Cleans the environment of built files echo build install [directory] Installs to a pre-created directory From bb28db42734e661e9e40abdff705903f3c347791 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 09:31:29 -0400 Subject: [PATCH 03/34] Default ZIP method was not tar, instead 7zip as per help message --- prereqs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prereqs.sh b/prereqs.sh index a666e79..9fcba0c 100755 --- a/prereqs.sh +++ b/prereqs.sh @@ -26,7 +26,7 @@ # - Basic Variables -------------------------------------------------- -[[ -z "${ZIP}" ]] && ZIP="7zip" +[[ -z "${ZIP}" ]] && ZIP="tar" [[ -z "${GIT}" ]] && GIT="git" [[ -z "${DLM}" ]] && DLM="curl" From 16f16fa691115958481a9933fe982f7f6dceb75c Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 09:45:41 -0400 Subject: [PATCH 04/34] Fixed issue where driver was built with lua-5.4.2 instead of luajit so test failed --- .github/workflows/ci.mingw.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.mingw.bat b/.github/workflows/ci.mingw.bat index cd8092b..d5bebe3 100644 --- a/.github/workflows/ci.mingw.bat +++ b/.github/workflows/ci.mingw.bat @@ -33,8 +33,8 @@ setlocal REM Building echo ^> BUILDING set debug=1 - call build.mingw.bat driver lua-5.4.2 - call build.mingw.bat package luajit + call build.mingw.bat driver luajit + call build.mingw.bat package lua-5.4.2 call build.mingw.bat package lua-5.3.6 call build.mingw.bat package lua-5.2.4 call build.mingw.bat package lua-5.1.5 From 7123d5408472c211ee7179bd01a7f655e939ea7c Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 10:01:42 -0400 Subject: [PATCH 05/34] Attempt to force travis to use later version of openssl to try to fix curl error --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8117bfb..112887f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,10 @@ jobs: script: ./travis.linux.sh os: linux dist: trusty + addons: + apt: + packages: + - libssl - stage: build script: ./travis.mac.sh osx_image: xcode12.2 From ac71ab114537b9220388c65ae99711838e7c7e5d Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 10:15:38 -0400 Subject: [PATCH 06/34] Revert: Attempt to force travis to use later version of openssl to try to fix curl error --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 112887f..8117bfb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,10 +32,6 @@ jobs: script: ./travis.linux.sh os: linux dist: trusty - addons: - apt: - packages: - - libssl - stage: build script: ./travis.mac.sh osx_image: xcode12.2 From 32e88ed433df71379ea34a447b3a6fdf012331b3 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 19:50:09 -0400 Subject: [PATCH 07/34] Adding patch suggested by Qasim Abdullah @Travis-CI --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8117bfb..669d295 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,11 @@ jobs: script: ./travis.linux.sh os: linux dist: trusty + addons: + apt: + packages: + - libgnutls-openssl27 + - libgnutls30 - stage: build script: ./travis.mac.sh osx_image: xcode12.2 From 7c580aed25ce1b405e1160228696b1619b6bdd5b Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 19:53:04 -0400 Subject: [PATCH 08/34] Adding patch suggested by Qasim Abdullah @Travis-CI, with apt update in before_install --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 669d295..c8b810d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,8 @@ branches: only: - master +before_install: + - apt update before_script: - chmod +x travis.linux.sh From 8a6b72e06b99bd0a00df11596569384dec03771e Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 19:55:09 -0400 Subject: [PATCH 09/34] Adding patch suggested by Qasim Abdullah @Travis-CI, with apt update in before_install removing from os --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c8b810d..bf7004e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ branches: before_install: - apt update + - apt install libgnutls-openssl27 libgnutls30 before_script: - chmod +x travis.linux.sh @@ -34,11 +35,6 @@ jobs: script: ./travis.linux.sh os: linux dist: trusty - addons: - apt: - packages: - - libgnutls-openssl27 - - libgnutls30 - stage: build script: ./travis.mac.sh osx_image: xcode12.2 From ac2b149b09cd020c19be489f679b98597afc2400 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 19:56:43 -0400 Subject: [PATCH 10/34] Evidently travis respects sudo now --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index bf7004e..4080f94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,8 @@ branches: - master before_install: - - apt update - - apt install libgnutls-openssl27 libgnutls30 + - sudo apt update + - sudo apt install libgnutls-openssl27 libgnutls30 before_script: - chmod +x travis.linux.sh From 265fd2c4781445a1fff1debe5c044699f260a77f Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 20:01:57 -0400 Subject: [PATCH 11/34] Gave up. Travis will have to fail until they fix their curl. Can switch to wget. I don't think this is necessary right now. --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4080f94..8117bfb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,9 +15,6 @@ branches: only: - master -before_install: - - sudo apt update - - sudo apt install libgnutls-openssl27 libgnutls30 before_script: - chmod +x travis.linux.sh From 0028723e03876836dfb1335da30bde8c3e4a9746 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 20:19:12 -0400 Subject: [PATCH 12/34] Attempt to fix regression where build.mingw.bat seems to link weird/cant find lc library --- build.mingw.bat | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.mingw.bat b/build.mingw.bat index 1147c78..abaf7f2 100644 --- a/build.mingw.bat +++ b/build.mingw.bat @@ -110,7 +110,6 @@ setlocal REM - Basic GCC Setup -------------------------------------------------- - REM GCC setup IF [0] EQU [%debug%] ( set attrib=-std=gnu11 -Wall -O2 set root=%CWD%\bin\Release @@ -316,9 +315,9 @@ setlocal setlocal IF [%1] == [luajit] ( set luaverdef=-DLUA_JIT_51 - set luaverout=%dlldir%\libluajit.dll + set luaverout=-lluajit ) ELSE ( - set luaverout=%dlldir%\lib%1.dll + set luaverout=-l%1 ) echo Compiling luaw driver package %1... From ca113ef6c779b0e8704eff2e6a3934eaeee1ee80 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 20:35:31 -0400 Subject: [PATCH 13/34] Buggy behavior observed when using call in batch, perhaps github actually changed it to expected behavior? --- build.mingw.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.mingw.bat b/build.mingw.bat index abaf7f2..11869b5 100644 --- a/build.mingw.bat +++ b/build.mingw.bat @@ -332,7 +332,7 @@ setlocal :build_driver setlocal - echo Compiling luaw driver... + echo Compiling luaw driver (using %1)... %GCC% %attrib% %dirs% -D__USE_MINGW_ANSI_STDIO=1 -DDEFAULT_LUA=\"liblc%1.dll\" -c %srcdir%\luadriver.c echo Linking luaw driver... From 11f0018ee7cfd0d2ff7d0089f0875f668a1a1cd8 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Fri, 15 Oct 2021 20:41:50 -0400 Subject: [PATCH 14/34] Popping cache --- .github/workflows/c-cpp.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 4331438..4bc5f4b 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -21,9 +21,9 @@ jobs: lua-all lua-all.tar.gz luajit-2.0 - key: ${{ runner.os }}-cacher-1 + key: ${{ runner.os }}-cacher-2 restore-keys: | - ${{ runner.os }}-cacher-1 + ${{ runner.os }}-cacher-2 - name: Build & Test Linux run: ./.github/workflows/ci.linux.sh shell: bash @@ -39,9 +39,9 @@ jobs: lua-all lua-all.tar.gz luajit-2.0 - key: ${{ runner.os }}-cacher-1 + key: ${{ runner.os }}-cacher-2 restore-keys: | - ${{ runner.os }}-cacher-1 + ${{ runner.os }}-cacher-2 - name: Build & Test Windows run: call .github\workflows\ci.mingw.bat shell: cmd From 45bbe31dccee940d2a1d4ccdc8b8a23ba734d9b5 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sat, 16 Oct 2021 22:27:51 -0400 Subject: [PATCH 15/34] Did the following: - removed call per each batch file call in appveyor so everything is synchronized - added tests to appveyor - github ci removed calls also so everything is synchronized - reorgnized mingw build script gcc arguments - revert saved change where mingw build script added temporary debug information --- .github/workflows/ci.mingw.bat | 12 +++--- appveyor.msvs.bat | 79 ++++++++++++++++++++++++++++++---- build.mingw.bat | 4 +- 3 files changed, 79 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.mingw.bat b/.github/workflows/ci.mingw.bat index d5bebe3..90c634a 100644 --- a/.github/workflows/ci.mingw.bat +++ b/.github/workflows/ci.mingw.bat @@ -27,17 +27,17 @@ setlocal REM Init echo ^> PREREQS set DLM=curl - call prereqs.bat download + prereqs.bat download REM Building echo ^> BUILDING set debug=1 - call build.mingw.bat driver luajit - call build.mingw.bat package lua-5.4.2 - call build.mingw.bat package lua-5.3.6 - call build.mingw.bat package lua-5.2.4 - call build.mingw.bat package lua-5.1.5 + build.mingw.bat driver luajit + build.mingw.bat package lua-5.4.2 + build.mingw.bat package lua-5.3.6 + build.mingw.bat package lua-5.2.4 + build.mingw.bat package lua-5.1.5 echo Building complete. dir bin\Debug diff --git a/appveyor.msvs.bat b/appveyor.msvs.bat index 4ce1d77..93ee64f 100644 --- a/appveyor.msvs.bat +++ b/appveyor.msvs.bat @@ -24,19 +24,82 @@ setlocal - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" + "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" - call prereqs.bat download + REM Init + echo ^> PREREQS + prereqs.bat download - call build.msvs.bat driver luajit + REM Building + echo ^> BUILDING + set debug=1 + build.msvs.bat driver luajit + build.msvs.bat package lua-5.4.2 + build.msvs.bat package lua-5.3.6 + build.msvs.bat package lua-5.2.4 + build.msvs.bat package lua-5.1.5 + echo Building complete. - call build.msvs.bat package lua-5.4.2 + dir bin\Debug - call build.msvs.bat package lua-5.3.6 - call build.msvs.bat package lua-5.2.4 - - call build.msvs.bat package lua-5.1.5 + REM Testing + echo ^> TESTING + pushd bin\Debug + echo Test 1 + luaw -e "print('Everything went okay')" + + echo Test 2 + luaw -w luajit -e "print('Everything went okay')" + + echo Test 3 + luaw -w lua-5.3.6 -e "print('Everything went okay')" + + echo Test 4 + luaw -w lua-5.2.4 -e "print('Everything went okay')" + + echo Test 5 + luaw -w lua-5.1.5 -e "print('Everything went okay')" + + echo Test 6 + luaw res\testing.lua -Dtest=5 -n a b c + echo Test 6 end + + echo Test 7 + luaw -b res\testing.lua testing.luac + luaw testing.luac -Dtest=5 -n a b c + echo Test 7 end + + echo Test 8 + luaw -w luajit -c -o testing.luac "res\testing.lua" + luaw -w luajit -ltesting.luac -Dtest=5 -n a b c + echo Test 8 end + + echo Test 9 + luaw -w lua-5.4.2 -c -o testing.luac "res\testing.lua" + luaw -w lua-5.4.2 -ltesting.luac -Dtest=5 -n a b c + echo Test 9 end + + echo Test 10 + luaw -w lua-5.3.6 -c -o testing.luac "res\testing.lua" + luaw -w lua-5.3.6 -ltesting.luac -Dtest=5 -n a b c + echo Test 10 end + + echo Test 11 + luaw -w lua-5.2.4 -c -o testing.luac "res\testing.lua" + luaw -w lua-5.2.4 -ltesting.luac -Dtest=5 -n a b c + echo Test 11 end + + echo Test 12 + luaw -w lua-5.1.5 -c -o testing.luac "res\testing.lua" + luaw -w lua-5.1.5 -ltesting.luac -Dtest=5 -n a b c + echo Test 12 end + + echo Testing complete. + popd endlocal + +exit /b 0 + diff --git a/build.mingw.bat b/build.mingw.bat index 11869b5..48d3bbd 100644 --- a/build.mingw.bat +++ b/build.mingw.bat @@ -321,7 +321,7 @@ setlocal ) echo Compiling luaw driver package %1... - %gcc% %attrib% %dirs% %luaverdef% -D__USE_MINGW_ANSI_STDIO=1 -DLC_LD_DLL -c %srcdir%\ldata.c %srcdir%\jitsupport.c + %gcc% %attrib% %dirs% -D__USE_MINGW_ANSI_STDIO=1 -DLC_LD_DLL %luaverdef% -c %srcdir%\ldata.c %srcdir%\jitsupport.c echo Linking luaw driver package liblc%1.dll... %GCC% %attrib% %dirs% -shared -o liblc%1.dll ldata.o jitsupport.o %luaverout% @@ -332,7 +332,7 @@ setlocal :build_driver setlocal - echo Compiling luaw driver (using %1)... + echo Compiling luaw driver... %GCC% %attrib% %dirs% -D__USE_MINGW_ANSI_STDIO=1 -DDEFAULT_LUA=\"liblc%1.dll\" -c %srcdir%\luadriver.c echo Linking luaw driver... From a267669edb5a4f58e635948636b4b42ef36dfadd Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sat, 16 Oct 2021 22:32:59 -0400 Subject: [PATCH 16/34] Reverted call change, due to appveyor exiting with error code after any batch file run --- appveyor.msvs.bat | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/appveyor.msvs.bat b/appveyor.msvs.bat index 93ee64f..9bf0319 100644 --- a/appveyor.msvs.bat +++ b/appveyor.msvs.bat @@ -28,16 +28,16 @@ setlocal REM Init echo ^> PREREQS - prereqs.bat download + call prereqs.bat download REM Building echo ^> BUILDING set debug=1 - build.msvs.bat driver luajit - build.msvs.bat package lua-5.4.2 - build.msvs.bat package lua-5.3.6 - build.msvs.bat package lua-5.2.4 - build.msvs.bat package lua-5.1.5 + call build.msvs.bat driver luajit + call build.msvs.bat package lua-5.4.2 + call build.msvs.bat package lua-5.3.6 + call build.msvs.bat package lua-5.2.4 + call build.msvs.bat package lua-5.1.5 echo Building complete. dir bin\Debug From 70efa611128c872c7ba683c8b7da64c6378e6a95 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sat, 16 Oct 2021 22:34:00 -0400 Subject: [PATCH 17/34] Removed useless curl set, as its the default now --- .github/workflows/ci.mingw.bat | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.mingw.bat b/.github/workflows/ci.mingw.bat index 90c634a..68a3058 100644 --- a/.github/workflows/ci.mingw.bat +++ b/.github/workflows/ci.mingw.bat @@ -26,7 +26,6 @@ setlocal REM Init echo ^> PREREQS - set DLM=curl prereqs.bat download From 50b13263dcbe534f9fff16ddf5a305c45b0aa2d4 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sat, 16 Oct 2021 22:35:03 -0400 Subject: [PATCH 18/34] Forgot one call --- appveyor.msvs.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.msvs.bat b/appveyor.msvs.bat index 9bf0319..031a3c2 100644 --- a/appveyor.msvs.bat +++ b/appveyor.msvs.bat @@ -24,7 +24,7 @@ setlocal - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" REM Init echo ^> PREREQS From c5d15b3b5efac475939f388510de5bb88064fa33 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sat, 16 Oct 2021 22:40:12 -0400 Subject: [PATCH 19/34] Also reverted call on ci.mingw.bat which doesn't work as expected --- .github/workflows/ci.mingw.bat | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.mingw.bat b/.github/workflows/ci.mingw.bat index 68a3058..51b0087 100644 --- a/.github/workflows/ci.mingw.bat +++ b/.github/workflows/ci.mingw.bat @@ -26,17 +26,17 @@ setlocal REM Init echo ^> PREREQS - prereqs.bat download + call prereqs.bat download REM Building echo ^> BUILDING set debug=1 - build.mingw.bat driver luajit - build.mingw.bat package lua-5.4.2 - build.mingw.bat package lua-5.3.6 - build.mingw.bat package lua-5.2.4 - build.mingw.bat package lua-5.1.5 + call build.mingw.bat driver luajit + call build.mingw.bat package lua-5.4.2 + call build.mingw.bat package lua-5.3.6 + call build.mingw.bat package lua-5.2.4 + call build.mingw.bat package lua-5.1.5 echo Building complete. dir bin\Debug From 2ffcab6aaab9aaf21fefed0dbaf6c6d76f9a2ed7 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sat, 16 Oct 2021 22:50:46 -0400 Subject: [PATCH 20/34] Adding numbers to print outs to make sure log doesnt have print race because of weird call nature being enforced --- .github/workflows/ci.mingw.bat | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.mingw.bat b/.github/workflows/ci.mingw.bat index 51b0087..d8b21a5 100644 --- a/.github/workflows/ci.mingw.bat +++ b/.github/workflows/ci.mingw.bat @@ -46,19 +46,19 @@ setlocal echo ^> TESTING pushd bin\Debug echo Test 1 - luaw -e "print('Everything went okay')" + luaw -e "print('Everything went okay') 1" echo Test 2 - luaw -w luajit -e "print('Everything went okay')" + luaw -w luajit -e "print('Everything went okay') 2" echo Test 3 - luaw -w lua-5.3.6 -e "print('Everything went okay')" + luaw -w lua-5.3.6 -e "print('Everything went okay') 3" echo Test 4 - luaw -w lua-5.2.4 -e "print('Everything went okay')" + luaw -w lua-5.2.4 -e "print('Everything went okay') 4" echo Test 5 - luaw -w lua-5.1.5 -e "print('Everything went okay')" + luaw -w lua-5.1.5 -e "print('Everything went okay') 5" echo Test 6 luaw res\testing.lua -Dtest=5 -n a b c From dba8892b2c3d4d2c33161d51726fe25bfce1e94b Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sat, 16 Oct 2021 23:07:33 -0400 Subject: [PATCH 21/34] Adding printout to luadriver to probe ci errors --- src/luadriver.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/luadriver.c b/src/luadriver.c index 680babd..e5290ab 100644 --- a/src/luadriver.c +++ b/src/luadriver.c @@ -280,6 +280,7 @@ int main(int argc, char** argv) { } #if defined(_WIN32) || defined(_WIN64) + printf("Loading %s\n", ARGS.luaver == 0 ? DEFAULT_LUA : luastr); HMODULE luacxt; luacxt = LoadLibrary(ARGS.luaver == 0 ? DEFAULT_LUA : luastr); check_error(luacxt == 0, _("LC_DLL_MIA")); From f2298b0b69338072fe7f2b2dc011f2f616a0b451 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sat, 16 Oct 2021 23:22:27 -0400 Subject: [PATCH 22/34] Did the following: - added a ci folder - migrated all ci files to ci folder - updated yml files to execute builds and test sin new ci folder --- .appveyor.yml | 2 +- .github/workflows/c-cpp.yml | 4 ++-- .travis.yml | 14 +++++++------- appveyor.msvs.bat => ci/appveyor.msvs.bat | 0 {.github/workflows => ci}/ci.linux.sh | 0 {.github/workflows => ci}/ci.mingw.bat | 10 +++++----- {.github/workflows => ci}/ci.msvs.bat | 0 travis.linux.sh => ci/travis.linux.sh | 0 travis.mac.sh => ci/travis.mac.sh | 0 9 files changed, 15 insertions(+), 15 deletions(-) rename appveyor.msvs.bat => ci/appveyor.msvs.bat (100%) rename {.github/workflows => ci}/ci.linux.sh (100%) mode change 100755 => 100644 rename {.github/workflows => ci}/ci.mingw.bat (90%) rename {.github/workflows => ci}/ci.msvs.bat (100%) rename travis.linux.sh => ci/travis.linux.sh (100%) rename travis.mac.sh => ci/travis.mac.sh (100%) diff --git a/.appveyor.yml b/.appveyor.yml index eb83c03..a771153 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -11,7 +11,7 @@ branches: - master build_script: -- cmd: appveyor.msvs.bat +- cmd: ci\appveyor.msvs.bat test: off deploy: off diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 4bc5f4b..4eacc3c 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -25,7 +25,7 @@ jobs: restore-keys: | ${{ runner.os }}-cacher-2 - name: Build & Test Linux - run: ./.github/workflows/ci.linux.sh + run: ./ci/ci.linux.sh shell: bash build_mingw: runs-on: windows-latest @@ -43,6 +43,6 @@ jobs: restore-keys: | ${{ runner.os }}-cacher-2 - name: Build & Test Windows - run: call .github\workflows\ci.mingw.bat + run: ci\ci.mingw.bat shell: cmd diff --git a/.travis.yml b/.travis.yml index 8117bfb..f308f69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,11 +17,11 @@ branches: before_script: - - chmod +x travis.linux.sh - - chmod +x travis.mac.sh - - chmod +x build.linux.sh - - chmod +x build.mac.sh - - chmod +x prereqs.sh + - chmod +x ./ci/travis.linux.sh + - chmod +x ./ci/travis.mac.sh + - chmod +x ./build.linux.sh + - chmod +x ./build.mac.sh + - chmod +x ./prereqs.sh jobs: @@ -29,11 +29,11 @@ jobs: - os: osx include: - stage: build - script: ./travis.linux.sh + script: ./ci/travis.linux.sh os: linux dist: trusty - stage: build - script: ./travis.mac.sh + script: ./ci/travis.mac.sh osx_image: xcode12.2 os: osx diff --git a/appveyor.msvs.bat b/ci/appveyor.msvs.bat similarity index 100% rename from appveyor.msvs.bat rename to ci/appveyor.msvs.bat diff --git a/.github/workflows/ci.linux.sh b/ci/ci.linux.sh old mode 100755 new mode 100644 similarity index 100% rename from .github/workflows/ci.linux.sh rename to ci/ci.linux.sh diff --git a/.github/workflows/ci.mingw.bat b/ci/ci.mingw.bat similarity index 90% rename from .github/workflows/ci.mingw.bat rename to ci/ci.mingw.bat index d8b21a5..51b0087 100644 --- a/.github/workflows/ci.mingw.bat +++ b/ci/ci.mingw.bat @@ -46,19 +46,19 @@ setlocal echo ^> TESTING pushd bin\Debug echo Test 1 - luaw -e "print('Everything went okay') 1" + luaw -e "print('Everything went okay')" echo Test 2 - luaw -w luajit -e "print('Everything went okay') 2" + luaw -w luajit -e "print('Everything went okay')" echo Test 3 - luaw -w lua-5.3.6 -e "print('Everything went okay') 3" + luaw -w lua-5.3.6 -e "print('Everything went okay')" echo Test 4 - luaw -w lua-5.2.4 -e "print('Everything went okay') 4" + luaw -w lua-5.2.4 -e "print('Everything went okay')" echo Test 5 - luaw -w lua-5.1.5 -e "print('Everything went okay') 5" + luaw -w lua-5.1.5 -e "print('Everything went okay')" echo Test 6 luaw res\testing.lua -Dtest=5 -n a b c diff --git a/.github/workflows/ci.msvs.bat b/ci/ci.msvs.bat similarity index 100% rename from .github/workflows/ci.msvs.bat rename to ci/ci.msvs.bat diff --git a/travis.linux.sh b/ci/travis.linux.sh similarity index 100% rename from travis.linux.sh rename to ci/travis.linux.sh diff --git a/travis.mac.sh b/ci/travis.mac.sh similarity index 100% rename from travis.mac.sh rename to ci/travis.mac.sh From 3c0eaf179f154909b22e6a180d8c98322ed8f919 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sat, 16 Oct 2021 23:28:01 -0400 Subject: [PATCH 23/34] Trying to force c-cpp.yml to force chmod +x --- .github/workflows/c-cpp.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 4eacc3c..1e84d9a 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -25,7 +25,9 @@ jobs: restore-keys: | ${{ runner.os }}-cacher-2 - name: Build & Test Linux - run: ./ci/ci.linux.sh + run: + - chmod +x ./ci/ci.linux.sh + - ./ci/ci.linux.sh shell: bash build_mingw: runs-on: windows-latest From 84d234791f63be87878498a22051f6dfbbb40511 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sat, 16 Oct 2021 23:29:15 -0400 Subject: [PATCH 24/34] Trying alternate execution method --- .github/workflows/c-cpp.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 1e84d9a..08977ec 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -25,9 +25,7 @@ jobs: restore-keys: | ${{ runner.os }}-cacher-2 - name: Build & Test Linux - run: - - chmod +x ./ci/ci.linux.sh - - ./ci/ci.linux.sh + run: chmod +x ./ci/ci.linux.sh && ./ci/ci.linux.sh shell: bash build_mingw: runs-on: windows-latest From 33fa7656c701e3680f8b45bf1d1a7444d5f8604a Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sat, 16 Oct 2021 23:32:25 -0400 Subject: [PATCH 25/34] Seeing if I can't get away with synchronizing --- ci/ci.mingw.bat | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ci/ci.mingw.bat b/ci/ci.mingw.bat index 51b0087..68a3058 100644 --- a/ci/ci.mingw.bat +++ b/ci/ci.mingw.bat @@ -26,17 +26,17 @@ setlocal REM Init echo ^> PREREQS - call prereqs.bat download + prereqs.bat download REM Building echo ^> BUILDING set debug=1 - call build.mingw.bat driver luajit - call build.mingw.bat package lua-5.4.2 - call build.mingw.bat package lua-5.3.6 - call build.mingw.bat package lua-5.2.4 - call build.mingw.bat package lua-5.1.5 + build.mingw.bat driver luajit + build.mingw.bat package lua-5.4.2 + build.mingw.bat package lua-5.3.6 + build.mingw.bat package lua-5.2.4 + build.mingw.bat package lua-5.1.5 echo Building complete. dir bin\Debug From dab61d1e7e3c9579c2b1a645f1eeea105441ca08 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sat, 16 Oct 2021 23:38:08 -0400 Subject: [PATCH 26/34] Trying to use another script to avoid unexpected call behavior --- ci/ci.mingw.bat | 74 +------------------------------ ci/github.mingw.bat | 104 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 73 deletions(-) create mode 100644 ci/github.mingw.bat diff --git a/ci/ci.mingw.bat b/ci/ci.mingw.bat index 68a3058..c0c0b6b 100644 --- a/ci/ci.mingw.bat +++ b/ci/ci.mingw.bat @@ -24,81 +24,9 @@ setlocal - REM Init - echo ^> PREREQS - prereqs.bat download - - - REM Building - echo ^> BUILDING - set debug=1 - build.mingw.bat driver luajit - build.mingw.bat package lua-5.4.2 - build.mingw.bat package lua-5.3.6 - build.mingw.bat package lua-5.2.4 - build.mingw.bat package lua-5.1.5 - echo Building complete. - - dir bin\Debug - - - REM Testing - echo ^> TESTING - pushd bin\Debug - echo Test 1 - luaw -e "print('Everything went okay')" - - echo Test 2 - luaw -w luajit -e "print('Everything went okay')" - - echo Test 3 - luaw -w lua-5.3.6 -e "print('Everything went okay')" - - echo Test 4 - luaw -w lua-5.2.4 -e "print('Everything went okay')" - - echo Test 5 - luaw -w lua-5.1.5 -e "print('Everything went okay')" - - echo Test 6 - luaw res\testing.lua -Dtest=5 -n a b c - echo Test 6 end - - echo Test 7 - luaw -b res\testing.lua testing.luac - luaw testing.luac -Dtest=5 -n a b c - echo Test 7 end - - echo Test 8 - luaw -w luajit -c -o testing.luac "res\testing.lua" - luaw -w luajit -ltesting.luac -Dtest=5 -n a b c - echo Test 8 end - - echo Test 9 - luaw -w lua-5.4.2 -c -o testing.luac "res\testing.lua" - luaw -w lua-5.4.2 -ltesting.luac -Dtest=5 -n a b c - echo Test 9 end - - echo Test 10 - luaw -w lua-5.3.6 -c -o testing.luac "res\testing.lua" - luaw -w lua-5.3.6 -ltesting.luac -Dtest=5 -n a b c - echo Test 10 end - - echo Test 11 - luaw -w lua-5.2.4 -c -o testing.luac "res\testing.lua" - luaw -w lua-5.2.4 -ltesting.luac -Dtest=5 -n a b c - echo Test 11 end - - echo Test 12 - luaw -w lua-5.1.5 -c -o testing.luac "res\testing.lua" - luaw -w lua-5.1.5 -ltesting.luac -Dtest=5 -n a b c - echo Test 12 end - - echo Testing complete. - popd + github.mingw.bat endlocal exit /b 0 - diff --git a/ci/github.mingw.bat b/ci/github.mingw.bat new file mode 100644 index 0000000..68a3058 --- /dev/null +++ b/ci/github.mingw.bat @@ -0,0 +1,104 @@ +@REM MIT License +@REM +@REM Copyright (c) 2017-2021 Cody Tilkins +@REM +@REM Permission is hereby granted, free of charge, to any person obtaining a copy +@REM of this software and associated documentation files (the "Software"), to deal +@REM in the Software without restriction, including without limitation the rights +@REM to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +@REM copies of the Software, and to permit persons to whom the Software is +@REM furnished to do so, subject to the following conditions: +@REM +@REM The above copyright notice and this permission notice shall be included in all +@REM copies or substantial portions of the Software. +@REM +@REM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +@REM IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +@REM FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +@REM AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +@REM LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +@REM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +@REM SOFTWARE. + +@echo off + +setlocal + + REM Init + echo ^> PREREQS + prereqs.bat download + + + REM Building + echo ^> BUILDING + set debug=1 + build.mingw.bat driver luajit + build.mingw.bat package lua-5.4.2 + build.mingw.bat package lua-5.3.6 + build.mingw.bat package lua-5.2.4 + build.mingw.bat package lua-5.1.5 + echo Building complete. + + dir bin\Debug + + + REM Testing + echo ^> TESTING + pushd bin\Debug + echo Test 1 + luaw -e "print('Everything went okay')" + + echo Test 2 + luaw -w luajit -e "print('Everything went okay')" + + echo Test 3 + luaw -w lua-5.3.6 -e "print('Everything went okay')" + + echo Test 4 + luaw -w lua-5.2.4 -e "print('Everything went okay')" + + echo Test 5 + luaw -w lua-5.1.5 -e "print('Everything went okay')" + + echo Test 6 + luaw res\testing.lua -Dtest=5 -n a b c + echo Test 6 end + + echo Test 7 + luaw -b res\testing.lua testing.luac + luaw testing.luac -Dtest=5 -n a b c + echo Test 7 end + + echo Test 8 + luaw -w luajit -c -o testing.luac "res\testing.lua" + luaw -w luajit -ltesting.luac -Dtest=5 -n a b c + echo Test 8 end + + echo Test 9 + luaw -w lua-5.4.2 -c -o testing.luac "res\testing.lua" + luaw -w lua-5.4.2 -ltesting.luac -Dtest=5 -n a b c + echo Test 9 end + + echo Test 10 + luaw -w lua-5.3.6 -c -o testing.luac "res\testing.lua" + luaw -w lua-5.3.6 -ltesting.luac -Dtest=5 -n a b c + echo Test 10 end + + echo Test 11 + luaw -w lua-5.2.4 -c -o testing.luac "res\testing.lua" + luaw -w lua-5.2.4 -ltesting.luac -Dtest=5 -n a b c + echo Test 11 end + + echo Test 12 + luaw -w lua-5.1.5 -c -o testing.luac "res\testing.lua" + luaw -w lua-5.1.5 -ltesting.luac -Dtest=5 -n a b c + echo Test 12 end + + echo Testing complete. + popd + +endlocal + + +exit /b 0 + From 5c5270586166cf985ab98d1afef1af909e2772ae Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sat, 16 Oct 2021 23:40:50 -0400 Subject: [PATCH 27/34] Oh my it doesn't use the current batch file as current directory --- ci/ci.mingw.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/ci.mingw.bat b/ci/ci.mingw.bat index c0c0b6b..6be8783 100644 --- a/ci/ci.mingw.bat +++ b/ci/ci.mingw.bat @@ -24,7 +24,7 @@ setlocal - github.mingw.bat + ci\github.mingw.bat endlocal From e5df6d0c84a83d1428a7a38aaca1e3529434bea0 Mon Sep 17 00:00:00 2001 From: Cody Tilkins Date: Sun, 17 Oct 2021 01:43:09 -0400 Subject: [PATCH 28/34] Add .circleci/config.yml (#33) --- .circleci/config.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..6acb818 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,26 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. +# See: https://circleci.com/docs/2.0/configuration-reference +version: 2.1 + +# Define a job to be invoked later in a workflow. +# See: https://circleci.com/docs/2.0/configuration-reference/#jobs +jobs: + build: + machine: + image: windows-default + resource_class: windows.medium + steps: + - checkout + - run: + name: build + shell: cmd.exe + command: ci\ci.mingw.bat + + +# Invoke jobs via workflows +# See: https://circleci.com/docs/2.0/configuration-reference/#workflows +workflows: + mingw: + jobs: + - build + From eb770dc267f16e43df96ee487fe63d0e782b9a94 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sun, 17 Oct 2021 01:58:53 -0400 Subject: [PATCH 29/34] Evidently examples dont work easily --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6acb818..7dbc784 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,13 +2,13 @@ # See: https://circleci.com/docs/2.0/configuration-reference version: 2.1 +orbs: + win: circleci/windows@2.2.0 + # Define a job to be invoked later in a workflow. # See: https://circleci.com/docs/2.0/configuration-reference/#jobs jobs: build: - machine: - image: windows-default - resource_class: windows.medium steps: - checkout - run: From 23b3bc76d31b010d215b94c572aef35be7a66b53 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sun, 17 Oct 2021 02:00:35 -0400 Subject: [PATCH 30/34] Evidently examples dont work easily --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7dbc784..1ccea32 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,9 @@ orbs: # See: https://circleci.com/docs/2.0/configuration-reference/#jobs jobs: build: + machine: + image: windows-default + resource_class: windows.medium steps: - checkout - run: From 8e3c68fba2faa31f8dda955db10aa6e4eb9357f7 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sun, 17 Oct 2021 02:01:35 -0400 Subject: [PATCH 31/34] Evidently examples dont work easily --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1ccea32..cdb36a2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,8 +9,9 @@ orbs: # See: https://circleci.com/docs/2.0/configuration-reference/#jobs jobs: build: - machine: - image: windows-default + executor: + name: win/default + shell: cmd.exe resource_class: windows.medium steps: - checkout From d44e1393bacb3c1bc7781931a2b5ee3e52e32a1b Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sun, 17 Oct 2021 02:02:42 -0400 Subject: [PATCH 32/34] Evidently examples dont work easily --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cdb36a2..cbcd6ff 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,7 +12,6 @@ jobs: executor: name: win/default shell: cmd.exe - resource_class: windows.medium steps: - checkout - run: From 922aae512ac825faabc99f4333dc17c68ed62619 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sun, 11 Dec 2022 08:54:12 -0500 Subject: [PATCH 33/34] Fixed pathing for langfile on windows and windows build system --- build.mingw.bat | 16 +++++++++------- src/luadriver.c | 43 ++++++++++++++++++++++++++++++++----------- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/build.mingw.bat b/build.mingw.bat index 48d3bbd..bbba673 100644 --- a/build.mingw.bat +++ b/build.mingw.bat @@ -80,6 +80,9 @@ setlocal echo Remove %CWD%\lib\*.a del %CWD%\lib\*.a rmdir /S /Q %CWD%\bin + pushd %CWD%\luajit-2.0\src + %MAKE% clean LUAJIT_A=libmingw_luajit.dll.a + popd echo Done. exit /b 0 @@ -231,8 +234,7 @@ setlocal REM -------------------------------------------------------------------- - echo This shouldn't be reached! - goto failure + goto help REM -------------------------------------------------------------------- @@ -243,11 +245,10 @@ setlocal echo Locally building luajit %CWD%\luajit-2.0 ... pushd %CWD%\luajit-2.0\src - IF EXIST "mingw_libluajit.dll" ( + IF EXIST "mingw_libluajit.dll.a" ( echo libluajit.dll already cached. ) ELSE ( - %MAKE% -j%NUMBER_OF_PROCESSORS% - move lua51.dll mingw_libluajit.dll + %MAKE% -j%NUMBER_OF_PROCESSORS% TARGET_DLLNAME=libluajit.dll TARGET_DLLDOTANAME=libmingw_luajit.dll.a ) echo Locally installing luajit %CWD% ... @@ -256,7 +257,8 @@ setlocal copy /Y lualib.h %incdir%\lualib.h copy /Y lauxlib.h %incdir%\lauxlib.h copy /Y luajit.h %incdir%\luajit.h - copy /Y mingw_libluajit.dll %dlldir%\libluajit.dll + copy /Y libluajit.dll %dlldir%\libluajit.dll + copy /Y libmingw_luajit.dll.a ..\..\lib\libmingw_luajit.dll.a popd echo Finished locally building / installing luajit. @@ -315,7 +317,7 @@ setlocal setlocal IF [%1] == [luajit] ( set luaverdef=-DLUA_JIT_51 - set luaverout=-lluajit + set luaverout=-lmingw_luajit.dll ) ELSE ( set luaverout=-l%1 ) diff --git a/src/luadriver.c b/src/luadriver.c index e5290ab..c5d67b5 100644 --- a/src/luadriver.c +++ b/src/luadriver.c @@ -77,10 +77,29 @@ static inline void check_error(int cond, const char* str) { } } +static inline size_t strip_filename(char* buffer, char delim) +{ + char* iter = buffer; + char* last_slash = 0; + while (*iter++ != 0) + { + if (*iter == delim) + last_slash = iter; + } + iter = last_slash; + while (*iter != 0) + { + *iter = 0; + iter++; + } + return strlen(buffer); +} + int main(int argc, char** argv) { const char* language = 0; + char langbuf[260]; #if defined(_WIN32) || defined(_WIN64) const char english[] = "lang/english.txt"; const char chinese[] = "lang/chinese.txt"; @@ -90,37 +109,40 @@ int main(int argc, char** argv) { setlocale(LC_ALL, ""); + DWORD length = GetModuleFileName(NULL, langbuf, 260); + length = strip_filename(langbuf, '\\'); switch(GetUserDefaultUILanguage() | 0xFF) { // first byte is lang id case 0x09: // english - language = "lang/english.txt"; + language = "/lang/english.txt"; break; case 0x04: // chinese - language = "lang/chinese.txt"; + language = "/lang/chinese.txt"; break; case 0x11: // japanese - language = "lang/japanese.txt"; + language = "/lang/japanese.txt"; break; case 0x19: // russian - language = "lang/russian.txt"; + language = "/lang/russian.txt"; break; case 0x16: // portuguese - language = "lang/portuguese.txt"; + language = "/lang/portuguese.txt"; break; case 0x0A: // spanish - language = "lang/spanish.txt"; + language = "/lang/spanish.txt"; break; default: // needs translation >:( - language = "lang/english.txt"; + language = "/lang/english.txt"; break; } + strcat(langbuf, language); #else - language = "lang/english.txt"; + language = "/lang/english.txt"; #endif - language = "lang/english.txt"; + language = "/lang/english.txt"; // load language file - lang = langfile_load(language); + lang = langfile_load(langbuf); if(lang == 0) { puts("Failed to load lang file!"); return EXIT_FAILURE; @@ -280,7 +302,6 @@ int main(int argc, char** argv) { } #if defined(_WIN32) || defined(_WIN64) - printf("Loading %s\n", ARGS.luaver == 0 ? DEFAULT_LUA : luastr); HMODULE luacxt; luacxt = LoadLibrary(ARGS.luaver == 0 ? DEFAULT_LUA : luastr); check_error(luacxt == 0, _("LC_DLL_MIA")); From f9365fa0fdcf110c60e7795a07639b4d4d493122 Mon Sep 17 00:00:00 2001 From: tilkinsc Date: Sun, 11 Dec 2022 19:22:33 -0500 Subject: [PATCH 34/34] Did the following: - finally fixed locale code - linux now builds correctly - linux now installs - makefile fixed - added uninstaller to makefile and linux - dll path is searched relative to executable --- Makefile | 22 +++----------- build.linux.sh | 80 +++++++++++++++++++++++++++++++++++-------------- prereqs.sh | 2 +- src/luadriver.c | 80 ++++++++++++++++++++++++++++++++++++------------- 4 files changed, 122 insertions(+), 62 deletions(-) diff --git a/Makefile b/Makefile index a1310bb..6ce4a86 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ debug=0 debug_coverage=0 -GCC=gcc +CC=gcc OBJCOPY=objcopy AR=ar MAKE=make @@ -39,7 +39,6 @@ PLATS=Windows MSVS Unix MacOS Linux FE_Windows=.bat FE_MSVS=.msvs.bat -FE_MSVC=.msvs.bat FE_Unix=.sh FE_Linux=.sh FE_MacOS=.sh @@ -50,10 +49,8 @@ PRE_Unix=./ PRE_Linux=./ PRE_MacOS=./ - # No need to modify below none: - $(warning Make is a joke) @echo "Please do 'make PLAT=plat' where `plat` is one of these:" @echo " $(PLATS)" @echo "Use these targets: clean-prereqs prereqs clean-build build" @@ -71,37 +68,26 @@ default: none prereqs: - $(warning Make is a joke) $(PRE_$(PLAT))prereqs$(FE_$(PLAT)) download driver: - $(warning Make is a joke) $(PRE_$(PLAT))build$(FE_$(PLAT)) driver $(LUA_VER) package: - $(warning Make is a joke) $(PRE_$(PLAT))build$(FE_$(PLAT)) package $(LUA_VER) - clean-build: - $(warning Make is a joke) $(PRE_$(PLAT))build$(FE_$(PLAT)) clean clean-prereqs: - $(warning Make is a joke) $(PRE_$(PLAT))prereqs$(FE_$(PLAT)) clean - reset-prereqs: - $(warning Make is a joke) $(PRE_$(PLAT))prereqs$(FE_$(PLAT)) reset +install: + $(PRE_$(PLAT))build$(FE_$(PLAT)) install $(PREFIX) uninstall: - $(warning Make is a joke) - $(error This program deletes by manual removal. Please delete it yourself.) - -install: - $(warning Make is a joke) - $($PRE_$(PLAT))build$(FE_$(PLAT)) install $(PREFIX) + $(PRE_$(PLAT))build$(FE_$(PLAT)) uninstall $(PREFIX) diff --git a/build.linux.sh b/build.linux.sh index a198bfd..b616c87 100755 --- a/build.linux.sh +++ b/build.linux.sh @@ -48,10 +48,11 @@ help_message() { printf """ Usage: - build build lua-x.x.x Builds the driver with a default package + build driver lua-x.x.x Builds the driver with a default package build package lua-x.x.x Creates packages for the driver build clean Cleans the environment of built files - build install {directory} Installs to a pre-created directory + build install {directory} Installs to a directory + build uninstall {directory} Uninstalls an installation build -? /? --help Shows this help message build and package accepts: @@ -69,8 +70,9 @@ Listens to these variables: GCC_VER - stdlib version Default: gnu99 Notes: - After building, you may need to configure LD_LIBRARY_PATH to bin/Release/* to test - + After building, you may need to configure LD_LIBRARY_PATH=. or bin/Release/* to test + Uninstall will delete the directory you give it and the installed libraries + When uninstalling it's helpful to pipe yes in """ exit 0 } @@ -117,22 +119,6 @@ if [[ "${1}" == "clean" ]]; then exit 0 fi - -# - Basic Installer -------------------------------------------------- - - -if [[ "${1}" == "install" ]]; then - [[ -z "${2}" ]] && error "please specify where to install to" $LINENO - [[ -d "${2}" ]] || error "please create the destination folder first" $LINENO - - printf "Installing to directory (${2})...\n" - cp -r -i ${CWD}/bin/Release/* "${2}" - - printf "Done.\n" - exit 0 -fi - - # - Basic GCC Setup -------------------------------------------------- @@ -156,6 +142,56 @@ incdir="${CWD}/include" dirs="-L${srcdir} -L${libdir} -L${dlldir} -I${srcdir} -I${incdir}" +# - Basic Installer -------------------------------------------------- + + +if [[ "${1}" == "install" ]]; then + installdir=${2} + if [[ -z "${2}" ]]; then + installdir=/usr/local/bin/LuaConsole + fi + + printf "Installing to directory (${installdir})...\n" + install -D -T "${root}/luaw" "${installdir}/luaw" + install -D -T "${root}/lua.ico" "${installdir}/lua.ico" + install ${root}/liblua*.* "/usr/local/lib" + install ${root}/liblc* "${installdir}" + install -D ${root}/lang/* -t "${installdir}/lang" + pushd ${root} + echo liblua*.* > "${installdir}/installation.config" + popd + ldconfig + + printf "Done. Don't forget to add '${installdir}' to your PATH.\n" + exit 0 +fi + + +# - Basic Uninstaller -------------------------------------------------- + + +if [[ "${1}" == "uninstall" ]]; then + if [[ -z "${2}" ]]; then + installdir=/usr/local/bin/LuaConsole + else + installdir="${2}" + fi + printf "Deleting installed dependencies\n" + if [[ ! -f "${installdir}/installation.config" ]]; then + error "installation file missing. uninstallation failed" $LINENO + fi + for dep in $(cat "${installdir}/installation.config"); do + rm -i "/usr/local/lib/$dep" + done + printf "Deleting installation directory (${installdir})...\n" + rm -r -i "${installdir}" + ldconfig + + printf "Done.\n" + exit 0 +fi + + # - Basic Cache Checking --------------------------------------------- @@ -182,9 +218,7 @@ build_luajit() { cp lualib.h "${incdir}" cp lauxlib.h "${incdir}" cp luajit.h "${incdir}" - ln libluajit.so libluajit-5.1.so.2 cp libluajit.so "${dlldir}" - cp libluajit-5.1.so.2 "${dlldir}" popd printf "Finished locally building & installing luajit.\n" @@ -349,5 +383,5 @@ if [[ "$1" == "package" ]]; then exit 0 fi -error "This shouldn't be reached!\n" $LINENO +help_message diff --git a/prereqs.sh b/prereqs.sh index 9fcba0c..a086247 100755 --- a/prereqs.sh +++ b/prereqs.sh @@ -164,7 +164,7 @@ if [[ "${1}" == "download" ]]; then if [[ ! -d "${CWD}/lua-all" ]]; then printf "Not found. Unpacking...\n" [[ "${ZIP}" == "tar" ]] && tar xzf "${CWD}/lua-all.tar.gz" - [[ "${ZIP}" == "7zip" ]] && 7z x "${CWD}/lua-all.tar.gz" + [[ "${ZIP}" == "7zip" ]] && 7z x "${CWD}/lua-all.tar.gz" && 7z x "${CWD}/lua-all.tar" [[ -d "${CWD}/lua-all" ]] || error "failed to unpack '${CWD}/lua-all' using ${ZIP}" $LINENO fi printf "Cached.\n" diff --git a/src/luadriver.c b/src/luadriver.c index c5d67b5..b72d02a 100644 --- a/src/luadriver.c +++ b/src/luadriver.c @@ -41,6 +41,7 @@ #include #include #include +#include #if defined(_WIN32) || defined(_WIN64) # define WIN32_LEAN_AND_MEAN @@ -100,12 +101,14 @@ int main(int argc, char** argv) { const char* language = 0; char langbuf[260]; + memset(langbuf, 0, 260); + const char english[] = "/lang/english.txt"; + const char chinese[] = "/lang/chinese.txt"; + const char japanese[] = "/lang/japanese.txt"; + const char russian[] = "/lang/russian.txt"; + const char portuguese[] = "/lang/portuguese.txt"; + const char spanish[] = "/lang/spanish.txt"; #if defined(_WIN32) || defined(_WIN64) - const char english[] = "lang/english.txt"; - const char chinese[] = "lang/chinese.txt"; - const char russian[] = "lang/russian.txt"; - const char portuguese[] = "lang/portuguese.txt"; - const char spanish[] = "lang/spanish.txt"; setlocale(LC_ALL, ""); @@ -113,33 +116,66 @@ int main(int argc, char** argv) { length = strip_filename(langbuf, '\\'); switch(GetUserDefaultUILanguage() | 0xFF) { // first byte is lang id case 0x09: // english - language = "/lang/english.txt"; + language = english; break; case 0x04: // chinese - language = "/lang/chinese.txt"; + language = chinese; break; case 0x11: // japanese - language = "/lang/japanese.txt"; + language = japanese; break; case 0x19: // russian - language = "/lang/russian.txt"; + language = russian; break; case 0x16: // portuguese - language = "/lang/portuguese.txt"; + language = portuguese; break; case 0x0A: // spanish - language = "/lang/spanish.txt"; + language = spanish; break; default: // needs translation >:( - language = "/lang/english.txt"; + language = english; break; } - strcat(langbuf, language); #else - language = "/lang/english.txt"; + char pathbuf[260]; + memset(pathbuf, 0, 260); + size_t length = readlink("/proc/self/exe", pathbuf, 260); + dirname(pathbuf); + strncpy(langbuf, pathbuf, length); + + char* shortcode = getenv("LANG"); + if (shortcode != NULL) { + uint16_t code = *(uint16_t*) shortcode; + switch (code) + { + case 0x656E: // english + language = english; + break; + case 0x7A68: // chinese + language = chinese; + break; + case 0x6A61: // japanese + language = japanese; + break; + case 0x7275: // russian + language = russian; + break; + case 0x7074: // portuguese + language = portuguese; + break; + case 0x6573: // spanish + language = spanish; + break; + default: // needs translations >:( + language = english; + break; + } + } else { + language = "/lang/english.txt"; + } #endif - - language = "/lang/english.txt"; + strcat(langbuf, language); // load language file lang = langfile_load(langbuf); @@ -290,8 +326,12 @@ int main(int argc, char** argv) { luacon_loaddll _luacon_loaddll = (luacon_loaddll) 0; char luastr[260]; - if(ARGS.luaver != 0) { - memset(luastr, 0, 260); + memset(luastr, 0, 260); + strcat(luastr, pathbuf); + strcat(luastr, "/"); + if (ARGS.luaver == 0) { + strcat(luastr, DEFAULT_LUA); + } else { strcat(luastr, "liblc"); strcat(luastr, ARGS.luaver); #if defined(_WIN32) || defined(_WIN64) @@ -303,14 +343,14 @@ int main(int argc, char** argv) { #if defined(_WIN32) || defined(_WIN64) HMODULE luacxt; - luacxt = LoadLibrary(ARGS.luaver == 0 ? DEFAULT_LUA : luastr); + luacxt = LoadLibrary(luastr); check_error(luacxt == 0, _("LC_DLL_MIA")); _luacon_loaddll = (luacon_loaddll) GetProcAddress(luacxt, "luacon_loaddll"); check_error(_luacon_loaddll == 0, _("LC_DLL_NO_FUNC")); #else void* luacxt; - luacxt = dlopen(ARGS.luaver == 0 ? DEFAULT_LUA : luastr, RTLD_NOW); + luacxt = dlopen(luastr, RTLD_NOW); check_error(luacxt == 0, dlerror()); _luacon_loaddll = dlsym(luacxt, "luacon_loaddll");