[luajit] Fix build failure that resulted in no output. (#26360)

This commit is contained in:
Billy O'Neal 2022-08-15 19:24:49 -07:00 committed by GitHub
parent 5f83f03a1c
commit acc3bcf76b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 70 deletions

View File

@ -1,44 +0,0 @@
diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat
index ff9df57..912bdc9 100644
--- a/src/msvcbuild.bat
+++ b/src/msvcbuild.bat
@@ -74,22 +74,25 @@ buildvm -m vmdef -o %SOURCEDIR%\jit\vmdef.lua %ALL_LIB%
buildvm -m folddef -o %SOURCEDIR%\lj_folddef.h %SOURCEDIR%\lj_opt_fold.c
@if errorlevel 1 goto :BAD
+@if "%2"=="static" set CRT_LINKAGE=/MT
+@if "%2"=="dynamic" set CRT_LINKAGE=/MD
@set LJLINK=%LJLINK% /debug
-@if "%2" neq "debug" goto :NODEBUG
+@if "%3" neq "debug" goto :NODEBUG
@shift
@set BUILDTYPE=debug
@set LJCOMPILE=%LJCOMPILE% /Zi %DEBUGCFLAGS%
+@set CRT_LINKAGE=%CRT_LINKAGE%d
:NODEBUG
@set LJLINK=%LJLINK% /%BUILDTYPE%
-@if "%2"=="amalg" goto :AMALGDLL
-@if "%2"=="static" goto :STATIC
-%LJCOMPILE% /MD /DLUA_BUILD_AS_DLL %SOURCEDIR%\lj_*.c %SOURCEDIR%\lib_*.c /Fdlua51.pdb
+@if "%3"=="amalg" goto :AMALGDLL
+@if "%3"=="static" goto :STATIC
+%LJCOMPILE% %CRT_LINKAGE% /DLUA_BUILD_AS_DLL %SOURCEDIR%\lj_*.c %SOURCEDIR%\lib_*.c /Fdlua51.pdb
@if errorlevel 1 goto :BAD
%LJLINK% /DLL /out:%LJDLLNAME% lj_*.obj lib_*.obj
@if errorlevel 1 goto :BAD
@goto :MTDLL
:STATIC
-%LJCOMPILE% %SOURCEDIR%\lj_*.c %SOURCEDIR%\lib_*.c /Fdlua51.pdb
+%LJCOMPILE% %CRT_LINKAGE% %SOURCEDIR%\lj_*.c %SOURCEDIR%\lib_*.c /Fdlua51.pdb
@if errorlevel 1 goto :BAD
%LJLIB% /OUT:%LJLIBNAME% lj_*.obj lib_*.obj
@if errorlevel 1 goto :BAD
@@ -103,7 +106,7 @@ buildvm -m folddef -o %SOURCEDIR%\lj_folddef.h %SOURCEDIR%\lj_opt_fold.c
if exist %LJDLLNAME%.manifest^
%LJMT% -manifest %LJDLLNAME%.manifest -outputresource:%LJDLLNAME%;2
-%LJCOMPILE% %SOURCEDIR%\luajit.c /Fdluajit.pdb
+%LJCOMPILE% %CRT_LINKAGE% %SOURCEDIR%\luajit.c /Fdluajit.pdb
@if errorlevel 1 goto :BAD
%LJLINK% /out:luajit.exe luajit.obj %LJLIBNAME%
@if errorlevel 1 goto :BAD

View File

@ -1,5 +1,5 @@
diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat
index aab4ef1..ff9df57 100644
index d323d8d..6e61150 100644
--- a/src/msvcbuild.bat
+++ b/src/msvcbuild.bat
@@ -15,19 +15,20 @@
@ -15,20 +15,37 @@ index aab4ef1..ff9df57 100644
-@set DASMDIR=..\dynasm
+@set DASMDIR=%SOURCEDIR%\..\dynasm
@set DASM=%DASMDIR%\dynasm.lua
@set DASC=vm_x64.dasc
-@set DASC=vm_x64.dasc
+@set DASC=%SOURCEDIR%\vm_x64.dasc
@set LJDLLNAME=lua51.dll
@set LJLIBNAME=lua51.lib
@set BUILDTYPE=release
-@set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c lib_buffer.c
+@set ALL_LIB=%SOURCEDIR%\lib_base.c %SOURCEDIR%\lib_math.c %SOURCEDIR%\lib_bit.c %SOURCEDIR%\lib_string.c %SOURCEDIR%\lib_table.c %SOURCEDIR%\lib_io.c %SOURCEDIR%\lib_os.c %SOURCEDIR%\lib_package.c %SOURCEDIR%\lib_debug.c %SOURCEDIR%\lib_jit.c %SOURCEDIR%\lib_ffi.c
+@set ALL_LIB=%SOURCEDIR%\lib_base.c %SOURCEDIR%\lib_math.c %SOURCEDIR%\lib_bit.c %SOURCEDIR%\lib_string.c %SOURCEDIR%\lib_table.c %SOURCEDIR%\lib_io.c %SOURCEDIR%\lib_os.c %SOURCEDIR%\lib_package.c %SOURCEDIR%\lib_debug.c %SOURCEDIR%\lib_jit.c %SOURCEDIR%\lib_ffi.c %SOURCEDIR%\lib_buffer.c
-%LJCOMPILE% host\minilua.c
+%LJCOMPILE% %SOURCEDIR%\host\minilua.c /Fdminilua.pdb
@if errorlevel 1 goto :BAD
%LJLINK% /out:minilua.exe minilua.obj
@if errorlevel 1 goto :BAD
@@ -51,7 +52,7 @@ if exist minilua.exe.manifest^
minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h %DASC%
@@ -38,20 +39,20 @@ if exist minilua.exe.manifest^
@set LJARCH=x64
@minilua
@if errorlevel 8 goto :X64
-@set DASC=vm_x86.dasc
+@set DASC=%SOURCEDIR%\vm_x86.dasc
@set DASMFLAGS=-D WIN -D JIT -D FFI
@set LJARCH=x86
@set LJCOMPILE=%LJCOMPILE% /arch:SSE2
:X64
@if "%1" neq "nogc64" goto :GC64
@shift
-@set DASC=vm_x86.dasc
+@set DASC=%SOURCEDIR%\vm_x86.dasc
@set LJCOMPILE=%LJCOMPILE% /DLUAJIT_DISABLE_GC64
:GC64
-minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h %DASC%
+minilua %DASM% -LN %DASMFLAGS% -o %SOURCEDIR%\host\buildvm_arch.h %DASC%
@if errorlevel 1 goto :BAD
-%LJCOMPILE% /I "." /I %DASMDIR% host\buildvm*.c
@ -36,7 +53,7 @@ index aab4ef1..ff9df57 100644
@if errorlevel 1 goto :BAD
%LJLINK% /out:buildvm.exe buildvm*.obj
@if errorlevel 1 goto :BAD
@@ -60,41 +61,41 @@ if exist buildvm.exe.manifest^
@@ -60,41 +61,44 @@ if exist buildvm.exe.manifest^
buildvm -m peobj -o lj_vm.obj
@if errorlevel 1 goto :BAD
@ -60,27 +77,30 @@ index aab4ef1..ff9df57 100644
@if errorlevel 1 goto :BAD
-@if "%1" neq "debug" goto :NODEBUG
+@if "%2"=="static" set CRT_LINKAGE=/MT
+@if "%2"=="dynamic" set CRT_LINKAGE=/MD
+@set LJLINK=%LJLINK% /debug
+@if "%2" neq "debug" goto :NODEBUG
+@if "%3" neq "debug" goto :NODEBUG
@shift
@set BUILDTYPE=debug
@set LJCOMPILE=%LJCOMPILE% /Zi %DEBUGCFLAGS%
-@set LJLINK=%LJLINK% /opt:ref /opt:icf /incremental:no
+@set CRT_LINKAGE=%CRT_LINKAGE%d
:NODEBUG
@set LJLINK=%LJLINK% /%BUILDTYPE%
-@if "%1"=="amalg" goto :AMALGDLL
-@if "%1"=="static" goto :STATIC
-%LJCOMPILE% /MD /DLUA_BUILD_AS_DLL lj_*.c lib_*.c
+@if "%2"=="amalg" goto :AMALGDLL
+@if "%2"=="static" goto :STATIC
+%LJCOMPILE% /MD /DLUA_BUILD_AS_DLL %SOURCEDIR%\lj_*.c %SOURCEDIR%\lib_*.c /Fdlua51.pdb
+@if "%3"=="amalg" goto :AMALGDLL
+@if "%3"=="static" goto :STATIC
+%LJCOMPILE% %CRT_LINKAGE% /DLUA_BUILD_AS_DLL %SOURCEDIR%\lj_*.c %SOURCEDIR%\lib_*.c /Fdlua51.pdb
@if errorlevel 1 goto :BAD
%LJLINK% /DLL /out:%LJDLLNAME% lj_*.obj lib_*.obj
@if errorlevel 1 goto :BAD
@goto :MTDLL
:STATIC
-%LJCOMPILE% lj_*.c lib_*.c
+%LJCOMPILE% %SOURCEDIR%\lj_*.c %SOURCEDIR%\lib_*.c /Fdlua51.pdb
+%LJCOMPILE% %CRT_LINKAGE% %SOURCEDIR%\lj_*.c %SOURCEDIR%\lib_*.c /Fdlua51.pdb
@if errorlevel 1 goto :BAD
%LJLIB% /OUT:%LJLIBNAME% lj_*.obj lib_*.obj
@if errorlevel 1 goto :BAD
@ -91,16 +111,16 @@ index aab4ef1..ff9df57 100644
@if errorlevel 1 goto :BAD
%LJLINK% /DLL /out:%LJDLLNAME% ljamalg.obj lj_vm.obj
@if errorlevel 1 goto :BAD
@@ -102,7 +103,7 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
@@ -102,7 +106,7 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
if exist %LJDLLNAME%.manifest^
%LJMT% -manifest %LJDLLNAME%.manifest -outputresource:%LJDLLNAME%;2
-%LJCOMPILE% luajit.c
+%LJCOMPILE% %SOURCEDIR%\luajit.c /Fdluajit.pdb
+%LJCOMPILE% %CRT_LINKAGE% %SOURCEDIR%\luajit.c /Fdluajit.pdb
@if errorlevel 1 goto :BAD
%LJLINK% /out:luajit.exe luajit.obj %LJLIBNAME%
@if errorlevel 1 goto :BAD
@@ -110,8 +111,8 @@ if exist luajit.exe.manifest^
@@ -110,8 +114,8 @@ if exist luajit.exe.manifest^
%LJMT% -manifest luajit.exe.manifest -outputresource:luajit.exe
@del *.obj *.manifest minilua.exe buildvm.exe
@ -111,7 +131,7 @@ index aab4ef1..ff9df57 100644
@echo.
@echo === Successfully built LuaJIT for Windows/%LJARCH% ===
@@ -124,4 +125,5 @@ if exist luajit.exe.manifest^
@@ -124,4 +128,5 @@ if exist luajit.exe.manifest^
@goto :END
:FAIL
@echo You must open a "Visual Studio Command Prompt" to run this script

View File

@ -5,9 +5,8 @@ vcpkg_from_github(
SHA512 0a1d79ab7d2de6894bcff33309e015fdba0ea67cf0425d75b9301a30006039e81b527178dbb3485e1adea177ffe062e6fcef74307f8e725678e70562d57d1a5b
HEAD_REF master
PATCHES
001-fix-build-path.patch
002-fix-crt-linkage.patch
003-do-not-set-macosx-deployment-target.patch
004-fix-build-path-and-crt-linkage.patch
)
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
@ -29,9 +28,17 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug)
LOGNAME build-${TARGET_TRIPLET}-dbg
)
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/minilua.exe" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/tools")
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/minilua.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
# Note that luajit's build system responds to failure by producing no output; in particular a likely outcome is
# only 'minilua.exe' being produced. This reuslted in:
# https://github.com/microsoft/vcpkg/pull/25856#issuecomment-1214285736
# Please ensure luajit.exe is actually produced when making future changes.
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/luajit.exe" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/tools")
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lua51.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lua51.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
file(COPY "${CURRENT_PACKAGES_DIR}/debug/bin/lua51.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/tools")
endif()
vcpkg_copy_pdbs()
else()
vcpkg_execute_build_process(
@ -64,9 +71,13 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release)
LOGNAME build-${TARGET_TRIPLET}-rel
)
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/minilua.exe" DESTINATION "${CURRENT_PACKAGES_DIR}/tools")
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/minilua.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/luajit.exe" DESTINATION "${CURRENT_PACKAGES_DIR}/tools")
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lua51.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lua51.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools)
endif()
vcpkg_copy_pdbs()
else()
vcpkg_execute_build_process(

View File

@ -1,6 +1,7 @@
{
"name": "luajit",
"version-date": "2022-08-11",
"port-version": 1,
"description": "LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.",
"homepage": "https://github.com/LuaJIT/LuaJIT",
"license": "MIT",

View File

@ -4398,7 +4398,7 @@
},
"luajit": {
"baseline": "2022-08-11",
"port-version": 0
"port-version": 1
},
"luasec": {
"baseline": "1.1.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "bacc33ec723d7fc2b895a1351a2042c5c6fb6971",
"version-date": "2022-08-11",
"port-version": 1
},
{
"git-tree": "4c2d21d9bf0e5cedc0f7540a7e473c2e86f2c5ef",
"version-date": "2022-08-11",