From 59c5f593d22823d9072a3f7f92754dd21862bc21 Mon Sep 17 00:00:00 2001 From: Lars Viklund Date: Tue, 26 Mar 2024 15:30:07 +0100 Subject: [PATCH 1/3] Revert "Clean up build tree, bump vcpkg version" This reverts commit 40532101af7f25238baf6690ba6ec143a07babcd. # Conflicts: # CMakeLists.txt # stb_image_resize.h --- CMakeLists.txt | 1 - vcpkg-configuration.json | 10 +- .../2022-08-11_1/001-fix-build-path.patch | 120 ++++++++++++++++++ .../2022-08-11_1/002-fix-crt-linkage.patch | 44 +++++++ ...-do-not-set-macosx-deployment-target.patch | 14 ++ .../ports/luajit/2022-08-11_1/portfile.cmake | 109 ++++++++++++++++ .../ports/luajit/2022-08-11_1/vcpkg.json | 9 ++ vcpkg-ports/versions/baseline.json | 5 + vcpkg-ports/versions/l-/luajit.json | 9 ++ 9 files changed, 319 insertions(+), 2 deletions(-) create mode 100644 vcpkg-ports/ports/luajit/2022-08-11_1/001-fix-build-path.patch create mode 100644 vcpkg-ports/ports/luajit/2022-08-11_1/002-fix-crt-linkage.patch create mode 100644 vcpkg-ports/ports/luajit/2022-08-11_1/003-do-not-set-macosx-deployment-target.patch create mode 100644 vcpkg-ports/ports/luajit/2022-08-11_1/portfile.cmake create mode 100644 vcpkg-ports/ports/luajit/2022-08-11_1/vcpkg.json create mode 100644 vcpkg-ports/versions/baseline.json create mode 100644 vcpkg-ports/versions/l-/luajit.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 373faa5..5ba40ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,7 +150,6 @@ target_link_libraries(imgui PUBLIC target_include_directories(SimpleGraphic PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dep/glad/include - ${CMAKE_CURRENT_SOURCE_DIR}/dep/stb ${JPEG_INCLUDE_DIR} ) diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index 1bf838b..9b5ff45 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -2,5 +2,13 @@ "default-registry": { "kind": "builtin", "baseline": "4cfabe769eaceb209ea37267e8c50c43b86a4a7b" - } + }, + "registries": [ + { + "kind": "filesystem", + "path": "vcpkg-ports", + "baseline": "2022-08-14", + "packages": [] + } + ] } \ No newline at end of file diff --git a/vcpkg-ports/ports/luajit/2022-08-11_1/001-fix-build-path.patch b/vcpkg-ports/ports/luajit/2022-08-11_1/001-fix-build-path.patch new file mode 100644 index 0000000..09085af --- /dev/null +++ b/vcpkg-ports/ports/luajit/2022-08-11_1/001-fix-build-path.patch @@ -0,0 +1,120 @@ +diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat +index aab4ef1..ff9df57 100644 +--- a/src/msvcbuild.bat ++++ b/src/msvcbuild.bat +@@ -15,19 +15,20 @@ + @setlocal + @rem Add more debug flags here, e.g. DEBUGCFLAGS=/DLUA_USE_APICHECK + @set DEBUGCFLAGS= +-@set LJCOMPILE=cl /nologo /c /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_STDIO_INLINE=__declspec(dllexport)__inline ++@set SOURCEDIR=%1 ++@set LJCOMPILE=cl /nologo /c /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_STDIO_INLINE=__declspec(dllexport)__inline /I%SOURCEDIR% + @set LJLINK=link /nologo + @set LJMT=mt /nologo + @set LJLIB=lib /nologo /nodefaultlib +-@set DASMDIR=..\dynasm ++@set DASMDIR=%SOURCEDIR%\..\dynasm + @set DASM=%DASMDIR%\dynasm.lua + @set DASC=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 %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% ++minilua %DASM% -LN %DASMFLAGS% -o %SOURCEDIR%\host\buildvm_arch.h %SOURCEDIR%\%DASC% + @if errorlevel 1 goto :BAD + +-%LJCOMPILE% /I "." /I %DASMDIR% host\buildvm*.c ++%LJCOMPILE% /I "." /I %DASMDIR% %SOURCEDIR%\host\buildvm*.c /Fdbuildvm.pdb + @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^ + + buildvm -m peobj -o lj_vm.obj + @if errorlevel 1 goto :BAD +-buildvm -m bcdef -o lj_bcdef.h %ALL_LIB% ++buildvm -m bcdef -o %SOURCEDIR%\lj_bcdef.h %ALL_LIB% + @if errorlevel 1 goto :BAD +-buildvm -m ffdef -o lj_ffdef.h %ALL_LIB% ++buildvm -m ffdef -o %SOURCEDIR%\lj_ffdef.h %ALL_LIB% + @if errorlevel 1 goto :BAD +-buildvm -m libdef -o lj_libdef.h %ALL_LIB% ++buildvm -m libdef -o %SOURCEDIR%\lj_libdef.h %ALL_LIB% + @if errorlevel 1 goto :BAD +-buildvm -m recdef -o lj_recdef.h %ALL_LIB% ++buildvm -m recdef -o %SOURCEDIR%\lj_recdef.h %ALL_LIB% + @if errorlevel 1 goto :BAD +-buildvm -m vmdef -o jit\vmdef.lua %ALL_LIB% ++buildvm -m vmdef -o %SOURCEDIR%\jit\vmdef.lua %ALL_LIB% + @if errorlevel 1 goto :BAD +-buildvm -m folddef -o lj_folddef.h lj_opt_fold.c ++buildvm -m folddef -o %SOURCEDIR%\lj_folddef.h %SOURCEDIR%\lj_opt_fold.c + @if errorlevel 1 goto :BAD + +-@if "%1" neq "debug" goto :NODEBUG ++@set LJLINK=%LJLINK% /debug ++@if "%2" neq "debug" goto :NODEBUG + @shift + @set BUILDTYPE=debug + @set LJCOMPILE=%LJCOMPILE% /Zi %DEBUGCFLAGS% +-@set LJLINK=%LJLINK% /opt:ref /opt:icf /incremental:no + :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 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 + @if errorlevel 1 goto :BAD + %LJLIB% /OUT:%LJLIBNAME% lj_*.obj lib_*.obj + @if errorlevel 1 goto :BAD + @goto :MTDLL + :AMALGDLL +-%LJCOMPILE% /MD /DLUA_BUILD_AS_DLL ljamalg.c ++%LJCOMPILE% /MD /DLUA_BUILD_AS_DLL %SOURCEDIR%\ljamalg.c + @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 + if exist %LJDLLNAME%.manifest^ + %LJMT% -manifest %LJDLLNAME%.manifest -outputresource:%LJDLLNAME%;2 + +-%LJCOMPILE% luajit.c ++%LJCOMPILE% %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^ + %LJMT% -manifest luajit.exe.manifest -outputresource:luajit.exe + + @del *.obj *.manifest minilua.exe buildvm.exe +-@del host\buildvm_arch.h +-@del lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h ++@del %SOURCEDIR%\host\buildvm_arch.h ++@del %SOURCEDIR%\lj_bcdef.h %SOURCEDIR%\lj_ffdef.h %SOURCEDIR%\lj_libdef.h %SOURCEDIR%\lj_recdef.h %SOURCEDIR%\lj_folddef.h + @echo. + @echo === Successfully built LuaJIT for Windows/%LJARCH% === + +@@ -124,4 +125,5 @@ if exist luajit.exe.manifest^ + @goto :END + :FAIL + @echo You must open a "Visual Studio Command Prompt" to run this script ++exit 1 + :END diff --git a/vcpkg-ports/ports/luajit/2022-08-11_1/002-fix-crt-linkage.patch b/vcpkg-ports/ports/luajit/2022-08-11_1/002-fix-crt-linkage.patch new file mode 100644 index 0000000..e3fe7fc --- /dev/null +++ b/vcpkg-ports/ports/luajit/2022-08-11_1/002-fix-crt-linkage.patch @@ -0,0 +1,44 @@ +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 diff --git a/vcpkg-ports/ports/luajit/2022-08-11_1/003-do-not-set-macosx-deployment-target.patch b/vcpkg-ports/ports/luajit/2022-08-11_1/003-do-not-set-macosx-deployment-target.patch new file mode 100644 index 0000000..42e0eca --- /dev/null +++ b/vcpkg-ports/ports/luajit/2022-08-11_1/003-do-not-set-macosx-deployment-target.patch @@ -0,0 +1,14 @@ +diff --git a/src/Makefile b/src/Makefile +index 30d64be..b753ea1 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -316,9 +316,6 @@ ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector + TARGET_XCFLAGS+= -fno-stack-protector + endif + ifeq (Darwin,$(TARGET_SYS)) +- ifeq (,$(MACOSX_DEPLOYMENT_TARGET)) +- $(error missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY) +- endif + TARGET_STRIP+= -x + TARGET_XCFLAGS+= -DLUAJIT_UNWIND_EXTERNAL + TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC diff --git a/vcpkg-ports/ports/luajit/2022-08-11_1/portfile.cmake b/vcpkg-ports/ports/luajit/2022-08-11_1/portfile.cmake new file mode 100644 index 0000000..fcba2d1 --- /dev/null +++ b/vcpkg-ports/ports/luajit/2022-08-11_1/portfile.cmake @@ -0,0 +1,109 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO LuaJIT/LuaJIT + REF 633f265f67f322cbe2c5fd11d3e46d968ac220f7 #2022-08-11 + SHA512 0a1d79ab7d2de6894bcff33309e015fdba0ea67cf0425d75b9301a30006039e81b527178dbb3485e1adea177ffe062e6fcef74307f8e725678e70562d57d1a5b + HEAD_REF master + PATCHES + 001-fix-build-path.patch + 002-fix-crt-linkage.patch + 003-do-not-set-macosx-deployment-target.patch +) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set (LJIT_STATIC "") +else() + set (LJIT_STATIC "static") +endif() + +if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug) + message(STATUS "Building ${TARGET_TRIPLET}-dbg") + file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") + file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") + + if (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + vcpkg_execute_required_process_repeat( + COUNT 1 + COMMAND "${SOURCE_PATH}/src/msvcbuild.bat" ${SOURCE_PATH}/src ${VCPKG_CRT_LINKAGE} debug ${LJIT_STATIC} + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" + LOGNAME build-${TARGET_TRIPLET}-dbg + ) + + 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( + COMMAND make -j${VCPKG_CONCURRENCY} -f ${SOURCE_PATH}/Makefile clean + WORKING_DIRECTORY ${SOURCE_PATH} + LOGNAME clean-${TARGET_TRIPLET}-debug + ) + vcpkg_execute_build_process( + COMMAND make -j${VCPKG_CONCURRENCY} -f ${SOURCE_PATH}/Makefile PREFIX=${CURRENT_PACKAGES_DIR}/debug CCDEBUG=-g3 CFLAGS=-O0 BUILDMODE=${VCPKG_LIBRARY_LINKAGE} install + WORKING_DIRECTORY ${SOURCE_PATH} + LOGNAME build-${TARGET_TRIPLET}-debug + ) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/lua") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin") + endif() +endif() + +if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release) + message(STATUS "Building ${TARGET_TRIPLET}-rel") + file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") + file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") + + if (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + vcpkg_execute_required_process_repeat( + COUNT 1 + COMMAND "${SOURCE_PATH}/src/msvcbuild.bat" ${SOURCE_PATH}/src ${VCPKG_CRT_LINKAGE} ${LJIT_STATIC} + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" + LOGNAME build-${TARGET_TRIPLET}-rel + ) + + 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( + COMMAND make -j${VCPKG_CONCURRENCY} -f ${SOURCE_PATH}/Makefile clean + WORKING_DIRECTORY ${SOURCE_PATH} + LOGNAME clean-${TARGET_TRIPLET}-rel + ) + vcpkg_execute_build_process( + COMMAND make -j${VCPKG_CONCURRENCY} -f ${SOURCE_PATH}/Makefile PREFIX=${CURRENT_PACKAGES_DIR} CCDEBUG= BUILDMODE=${VCPKG_LIBRARY_LINKAGE} install + WORKING_DIRECTORY ${SOURCE_PATH} + LOGNAME build-${TARGET_TRIPLET}-rel + ) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/lua" "${CURRENT_PACKAGES_DIR}/lib/lua") + endif() +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +file(INSTALL "${SOURCE_PATH}/src/lua.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT}") +file(INSTALL "${SOURCE_PATH}/src/luajit.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT}") +file(INSTALL "${SOURCE_PATH}/src/luaconf.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT}") +file(INSTALL "${SOURCE_PATH}/src/lualib.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT}") +file(INSTALL "${SOURCE_PATH}/src/lauxlib.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT}") +file(INSTALL "${SOURCE_PATH}/src/lua.hpp" DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT}") + +vcpkg_fixup_pkgconfig() + +file(INSTALL "${SOURCE_PATH}/COPYRIGHT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg-ports/ports/luajit/2022-08-11_1/vcpkg.json b/vcpkg-ports/ports/luajit/2022-08-11_1/vcpkg.json new file mode 100644 index 0000000..a1090cf --- /dev/null +++ b/vcpkg-ports/ports/luajit/2022-08-11_1/vcpkg.json @@ -0,0 +1,9 @@ +{ + "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", + "supports": "!uwp" +} diff --git a/vcpkg-ports/versions/baseline.json b/vcpkg-ports/versions/baseline.json new file mode 100644 index 0000000..81afca3 --- /dev/null +++ b/vcpkg-ports/versions/baseline.json @@ -0,0 +1,5 @@ +{ + "2022-08-14": { + "luajit": { "baseline": "2022-08-11", "port-version": 1 } + } +} \ No newline at end of file diff --git a/vcpkg-ports/versions/l-/luajit.json b/vcpkg-ports/versions/l-/luajit.json new file mode 100644 index 0000000..30e80dc --- /dev/null +++ b/vcpkg-ports/versions/l-/luajit.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "version-date": "2022-08-11", + "port-version": 1, + "path": "$/ports/luajit/2022-08-11_1" + } + ] +} \ No newline at end of file From 7f48a16cbf554da07631591774c925540903ef9a Mon Sep 17 00:00:00 2001 From: Lars Viklund Date: Tue, 26 Mar 2024 16:08:59 +0100 Subject: [PATCH 2/3] fix: vendor build for older and faster LuaJIT There's some regression in LuaJIT performance where the key metric that indicates if a build is slow or fast is file size, where smaller DLLs are faster. Use a specific older commit c7db8255e1eb59f933fac7bc9322f0e4f8ddc6e6 of LuaJIT in a local vcpkg-ports tree to mitigate runtime problems with gem dropdowns for now. --- vcpkg-configuration.json | 4 +- ...-do-not-set-macosx-deployment-target.patch | 14 +++ .../005-do-not-pass-ld-e-macosx.patch | 11 ++ .../ports/luajit/2023-04-16/Makefile.nmake | 20 ++++ vcpkg-ports/ports/luajit/2023-04-16/configure | 86 ++++++++++++++ .../ports/luajit/2023-04-16/luajit.pc.win.in | 24 ++++ .../ports/luajit/2023-04-16/msvcbuild.patch | 31 +++++ .../ports/luajit/2023-04-16/portfile.cmake | 108 ++++++++++++++++++ .../ports/luajit/2023-04-16/vcpkg.json | 49 ++++++++ vcpkg-ports/versions/baseline.json | 3 + vcpkg-ports/versions/l-/luajit.json | 5 + 11 files changed, 353 insertions(+), 2 deletions(-) create mode 100644 vcpkg-ports/ports/luajit/2023-04-16/003-do-not-set-macosx-deployment-target.patch create mode 100644 vcpkg-ports/ports/luajit/2023-04-16/005-do-not-pass-ld-e-macosx.patch create mode 100644 vcpkg-ports/ports/luajit/2023-04-16/Makefile.nmake create mode 100644 vcpkg-ports/ports/luajit/2023-04-16/configure create mode 100644 vcpkg-ports/ports/luajit/2023-04-16/luajit.pc.win.in create mode 100644 vcpkg-ports/ports/luajit/2023-04-16/msvcbuild.patch create mode 100644 vcpkg-ports/ports/luajit/2023-04-16/portfile.cmake create mode 100644 vcpkg-ports/ports/luajit/2023-04-16/vcpkg.json diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index 9b5ff45..fc08bde 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -7,8 +7,8 @@ { "kind": "filesystem", "path": "vcpkg-ports", - "baseline": "2022-08-14", - "packages": [] + "baseline": "2024-03-26", + "packages": ["luajit"] } ] } \ No newline at end of file diff --git a/vcpkg-ports/ports/luajit/2023-04-16/003-do-not-set-macosx-deployment-target.patch b/vcpkg-ports/ports/luajit/2023-04-16/003-do-not-set-macosx-deployment-target.patch new file mode 100644 index 0000000..90be61e --- /dev/null +++ b/vcpkg-ports/ports/luajit/2023-04-16/003-do-not-set-macosx-deployment-target.patch @@ -0,0 +1,14 @@ +diff --git a/src/Makefile b/src/Makefile +index c4d0b14d..2c9769b9 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -302,9 +302,6 @@ ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector + TARGET_XCFLAGS+= -fno-stack-protector + endif + ifeq (Darwin,$(TARGET_SYS)) +- ifeq (,$(MACOSX_DEPLOYMENT_TARGET)) +- $(error missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY) +- endif + TARGET_STRIP+= -x + TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC + TARGET_DYNXLDOPTS= diff --git a/vcpkg-ports/ports/luajit/2023-04-16/005-do-not-pass-ld-e-macosx.patch b/vcpkg-ports/ports/luajit/2023-04-16/005-do-not-pass-ld-e-macosx.patch new file mode 100644 index 0000000..8f2f615 --- /dev/null +++ b/vcpkg-ports/ports/luajit/2023-04-16/005-do-not-pass-ld-e-macosx.patch @@ -0,0 +1,11 @@ +diff --git a/etc/luajit.pc b/etc/luajit.pc +index 39e1e57..3837d3b 100644 +--- a/etc/luajit.pc ++++ b/etc/luajit.pc +@@ -21,5 +21,5 @@ URL: https://luajit.org + Version: ${version} + Requires: + Libs: -L${libdir} -l${libname} +-Libs.private: -Wl,-E -lm -ldl ++Libs.private: -lm -ldl + Cflags: -I${includedir} diff --git a/vcpkg-ports/ports/luajit/2023-04-16/Makefile.nmake b/vcpkg-ports/ports/luajit/2023-04-16/Makefile.nmake new file mode 100644 index 0000000..5dadd97 --- /dev/null +++ b/vcpkg-ports/ports/luajit/2023-04-16/Makefile.nmake @@ -0,0 +1,20 @@ +all: + @echo _CL_ = $(_CL_) + @echo _LINK_ = $(_LINK_) + cd src && .\msvcbuild.bat $(MSVCBUILD_OPTIONS) + +install: src/luajit.exe + -mkdir "$(INSTALLDIR)" + -mkdir "$(INSTALLDIR)\bin" + copy src\luajit.exe "$(INSTALLDIR)\bin\" + if exist src\lua51.dll copy src\lua51.dll "$(INSTALLDIR)\bin\" + -mkdir "$(INSTALLDIR)\lib" + copy src\lua51.lib "$(INSTALLDIR)\lib\" + -mkdir "$(INSTALLDIR)\include" + -mkdir "$(INSTALLDIR)\include\luajit" + copy src/lua.h "$(INSTALLDIR)\include\luajit\" + copy src/luajit.h "$(INSTALLDIR)\include\luajit\" + copy src/luaconf.h "$(INSTALLDIR)\include\luajit\" + copy src/lualib.h "$(INSTALLDIR)\include\luajit\" + copy src/lauxlib.h "$(INSTALLDIR)\include\luajit\" + copy src/lua.hpp "$(INSTALLDIR)\include\luajit\" diff --git a/vcpkg-ports/ports/luajit/2023-04-16/configure b/vcpkg-ports/ports/luajit/2023-04-16/configure new file mode 100644 index 0000000..0384100 --- /dev/null +++ b/vcpkg-ports/ports/luajit/2023-04-16/configure @@ -0,0 +1,86 @@ +#!/bin/sh + +set -e + +LJARCH= +LUAJIT_BUILDMODE= +LUAJIT_BUILDVM_X= +LUAJIT_DASM_ARCHS= +LUAJIT_PREFIX= +for OPTION; do + case "${OPTION}" in + --prefix=*) + LUAJIT_PREFIX="${OPTION#--prefix=}" + ;; + BUILDMODE=*) + LUAJIT_BUILDMODE="${OPTION#BUILDMODE=}" + ;; + BUILDVM_X=*) + LUAJIT_BUILDVM_X="${OPTION#BUILDVM_X=}" + ;; + DASM_ARCHS=*) + LUAJIT_DASM_ARCHS="${OPTION#DASM_ARCHS=}" + ;; + LJARCH=*) + LJARCH="${OPTION#LJARCH=}" + ;; + esac +done + +cat > Makefile.vcpkg < [-m32] -E src/lj_arch.h -dM' +TARGET_TESTARCH_COMMON += 'LJ_LE 1' 'LJ_HASJIT 1' 'LJ_HASFFI 1' 'LJ_ARCH_HASFPU 1' 'LJ_ABI_SOFTFP 0' +TARGET_TESTARCH_COMMON_32 += \$(TARGET_TESTARCH_COMMON) 'LJ_ARCH_BITS 32' +TARGET_TESTARCH_COMMON_64 += \$(TARGET_TESTARCH_COMMON) 'LJ_ARCH_BITS 64' 'LJ_TARGET_GC64 1' +TARGET_TESTARCH_arm = \$(TARGET_TESTARCH_COMMON_32) LJ_TARGET_ARM +TARGET_TESTARCH_arm64 = \$(TARGET_TESTARCH_COMMON_64) LJ_TARGET_ARM64 'LJ_ARCH_VERSION 80' +TARGET_TESTARCH_x86 = \$(TARGET_TESTARCH_COMMON_32) LJ_TARGET_X86 +TARGET_TESTARCH_x64 = \$(TARGET_TESTARCH_COMMON_64) LJ_TARGET_X64 'LJ_FR2 1' + +all: + \$(MAKE) clean \$(COMMON_OPTIONS) \$(BUILD_OPTIONS) + \$(MAKE) all \$(COMMON_OPTIONS) \$(BUILD_OPTIONS) + for DA in \$(DASM_ARCHS); do \\ + rm -f src/host/buildvm_arch.h src/host/*.o; \\ + case "\$\$DA" in \\ + arm) TARGET_TESTARCH="\$(TARGET_TESTARCH_arm)" ;; \\ + arm64) TARGET_TESTARCH="\$(TARGET_TESTARCH_arm64)" ;; \\ + x86) TARGET_TESTARCH="\$(TARGET_TESTARCH_x86)" ;; \\ + x64) TARGET_TESTARCH="\$(TARGET_TESTARCH_x64)" ;; \\ + esac ; \\ + \$(MAKE) -C src host/buildvm-\$\$DA\$(EXECUTABLE_SUFFIX) \$(COMMON_OPTIONS) \$(BUILD_OPTIONS) \\ + BUILDVM_T=host/buildvm-\$\$DA\$(EXECUTABLE_SUFFIX) "TARGET_TESTARCH=\$\${TARGET_TESTARCH}" \\ + || exit 1; \\ + done + +install: + \$(MAKE) install \$(COMMON_OPTIONS) + for DA in \$(DASM_ARCHS); do \\ + mkdir -p "\$\${DESTDIR}\$(BUILDVM_PREFIX)"; \\ + install -m 0755 "src/host/buildvm-\$\$DA\$(EXECUTABLE_SUFFIX)" "\$\${DESTDIR}\$(BUILDVM_PREFIX)/buildvm-\$\$DA\$(EXECUTABLE_SUFFIX)" || exit 1 ; \\ + done + +END_MAKEFILE diff --git a/vcpkg-ports/ports/luajit/2023-04-16/luajit.pc.win.in b/vcpkg-ports/ports/luajit/2023-04-16/luajit.pc.win.in new file mode 100644 index 0000000..b90d065 --- /dev/null +++ b/vcpkg-ports/ports/luajit/2023-04-16/luajit.pc.win.in @@ -0,0 +1,24 @@ +# Package information for LuaJIT to be used by pkg-config. +majver=2 +minver=1 +relver=0 +version=${majver}.${minver}.${relver}-beta3 +abiver=51 + +prefix=@PREFIX@ +multilib=lib +exec_prefix=${prefix} +libdir=${exec_prefix}/${multilib} +libname=lua${abiver} +includedir=${prefix}/include/luajit + +INSTALL_LMOD=${prefix}/share/lua/${abiver} +INSTALL_CMOD=${prefix}/${multilib}/lua/${abiver} + +Name: LuaJIT +Description: Just-in-time compiler for Lua +URL: https://luajit.org +Version: ${version} +Requires: +Libs: -L${libdir} -l${libname} +Cflags: -I${includedir} @LJIT_MSVC_PC_CFLAGS@ diff --git a/vcpkg-ports/ports/luajit/2023-04-16/msvcbuild.patch b/vcpkg-ports/ports/luajit/2023-04-16/msvcbuild.patch new file mode 100644 index 0000000..4537578 --- /dev/null +++ b/vcpkg-ports/ports/luajit/2023-04-16/msvcbuild.patch @@ -0,0 +1,31 @@ +diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat +index 045965f8..8b0a4ace 100644 +--- a/src/msvcbuild.bat ++++ b/src/msvcbuild.bat +@@ -69,10 +69,9 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c + @set BUILDTYPE=debug + @set LJCOMPILE=%LJCOMPILE% /Zi %DEBUGCFLAGS% + :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 ++%LJCOMPILE% /MD /DLUA_BUILD_AS_DLL lj_*.c lib_*.c /Fdlua51.pdb + @if errorlevel 1 goto :BAD + %LJLINK% /DLL /out:%LJDLLNAME% lj_*.obj lib_*.obj + @if errorlevel 1 goto :BAD +@@ -92,7 +91,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% luajit.c /Fdluajit.pdb + @if errorlevel 1 goto :BAD + %LJLINK% /out:luajit.exe luajit.obj %LJLIBNAME% + @if errorlevel 1 goto :BAD +@@ -114,4 +113,5 @@ if exist luajit.exe.manifest^ + @goto :END + :FAIL + @echo You must open a "Visual Studio Command Prompt" to run this script ++exit 1 + :END diff --git a/vcpkg-ports/ports/luajit/2023-04-16/portfile.cmake b/vcpkg-ports/ports/luajit/2023-04-16/portfile.cmake new file mode 100644 index 0000000..cbb91f3 --- /dev/null +++ b/vcpkg-ports/ports/luajit/2023-04-16/portfile.cmake @@ -0,0 +1,108 @@ +set(extra_patches "") +if (VCPKG_TARGET_IS_OSX) + list(APPEND extra_patches 005-do-not-pass-ld-e-macosx.patch) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO LuaJIT/LuaJIT + REF c7db8255e1eb59f933fac7bc9322f0e4f8ddc6e6 #2023-04-16 + SHA512 fffe87ea87cbf9e9614d1bd0d95746655528787ea92a4aa26f9dcd8e5c02fb330ce0092419e8444c3a2f8bcd575c2d580bbcc81295d8fe6bd4d9b48072ff2609 + HEAD_REF master + PATCHES + msvcbuild.patch + 003-do-not-set-macosx-deployment-target.patch + ${extra_patches} +) + +vcpkg_cmake_get_vars(cmake_vars_file) +include("${cmake_vars_file}") + +if(VCPKG_DETECTED_MSVC) + # Due to lack of better MSVC cross-build support, just always build the host + # minilua tool with the target toolchain. This will work for native builds and + # for targeting x86 from x64 hosts. (UWP and ARM64 is unsupported.) + vcpkg_list(SET options) + set(PKGCONFIG_CFLAGS "") + if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") + list(APPEND options "MSVCBUILD_OPTIONS=static") + else() + set(PKGCONFIG_CFLAGS "/DLUA_BUILD_AS_DLL=1") + endif() + + vcpkg_install_nmake(SOURCE_PATH "${SOURCE_PATH}" + PROJECT_NAME "${CMAKE_CURRENT_LIST_DIR}/Makefile.nmake" + OPTIONS + ${options} + ) + + configure_file("${CMAKE_CURRENT_LIST_DIR}/luajit.pc.win.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/luajit.pc" @ONLY) + if(NOT VCPKG_BUILD_TYPE) + configure_file("${CMAKE_CURRENT_LIST_DIR}/luajit.pc.win.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/luajit.pc" @ONLY) + endif() + + vcpkg_copy_pdbs() +else() + vcpkg_list(SET options) + if(VCPKG_CROSSCOMPILING) + list(APPEND options + "LJARCH=${VCPKG_TARGET_ARCHITECTURE}" + "BUILDVM_X=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}/buildvm-${VCPKG_TARGET_ARCHITECTURE}${VCPKG_HOST_EXECUTABLE_SUFFIX}" + ) + endif() + + vcpkg_list(SET make_options "EXECUTABLE_SUFFIX=${VCPKG_TARGET_EXECUTABLE_SUFFIX}") + set(strip_options "") # cf. src/Makefile + if(VCPKG_TARGET_IS_OSX) + vcpkg_list(APPEND make_options "TARGET_SYS=Darwin") + set(strip_options " -x") + elseif(VCPKG_TARGET_IS_IOS) + vcpkg_list(APPEND make_options "TARGET_SYS=iOS") + set(strip_options " -x") + elseif(VCPKG_TARGET_IS_LINUX) + vcpkg_list(APPEND make_options "TARGET_SYS=Linux") + elseif(VCPKG_TARGET_IS_WINDOWS) + vcpkg_list(APPEND make_options "TARGET_SYS=Windows") + set(strip_options " --strip-unneeded") + endif() + + set(dasm_archs "") + if("buildvm-32" IN_LIST FEATURES) + string(APPEND dasm_archs " arm x86") + endif() + if("buildvm-64" IN_LIST FEATURES) + string(APPEND dasm_archs " arm64 x64") + endif() + + file(COPY "${CMAKE_CURRENT_LIST_DIR}/configure" DESTINATION "${SOURCE_PATH}") + vcpkg_configure_make(SOURCE_PATH "${SOURCE_PATH}" + COPY_SOURCE + OPTIONS + "BUILDMODE=${VCPKG_LIBRARY_LINKAGE}" + ${options} + OPTIONS_RELEASE + "DASM_ARCHS=${dasm_archs}" + ) + vcpkg_install_make( + MAKEFILE "Makefile.vcpkg" + OPTIONS + ${make_options} + "TARGET_AR=${VCPKG_DETECTED_CMAKE_AR} rcus" + "TARGET_STRIP=${VCPKG_DETECTED_CMAKE_STRIP}${strip_options}" + ) +endif() + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/lib/lua" + "${CURRENT_PACKAGES_DIR}/debug/share" + "${CURRENT_PACKAGES_DIR}/lib/lua" + "${CURRENT_PACKAGES_DIR}/share/lua" + "${CURRENT_PACKAGES_DIR}/share/man" +) + +vcpkg_copy_tools(TOOL_NAMES luajit AUTO_CLEAN) + +vcpkg_fixup_pkgconfig() + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYRIGHT") diff --git a/vcpkg-ports/ports/luajit/2023-04-16/vcpkg.json b/vcpkg-ports/ports/luajit/2023-04-16/vcpkg.json new file mode 100644 index 0000000..7170aa2 --- /dev/null +++ b/vcpkg-ports/ports/luajit/2023-04-16/vcpkg.json @@ -0,0 +1,49 @@ +{ + "name": "luajit", + "version-date": "2023-04-16", + "port-version": 0, + "description": "LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.", + "homepage": "https://github.com/LuaJIT/LuaJIT", + "license": "MIT", + "supports": "!uwp & !(arm64 & windows)", + "dependencies": [ + { + "name": "luajit", + "host": true, + "features": [ + "buildvm-64" + ], + "platform": "!native & (arm64 | x64) & (!windows | mingw)" + }, + { + "name": "luajit", + "host": true, + "features": [ + "buildvm-32" + ], + "platform": "!native & ((arm & !arm64) | x86) & (!windows | mingw)" + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + { + "name": "vcpkg-cmake-get-vars", + "host": true + } + ], + "features": { + "buildvm-32": { + "description": "Install host tools for 32 bit targets", + "supports": "native & ((arm & !arm64) | x86) & (!windows | mingw)" + }, + "buildvm-64": { + "description": "Install host tools for 64 bit targets", + "supports": "native & (arm64 | x64) & (!windows | mingw)" + } + } +} diff --git a/vcpkg-ports/versions/baseline.json b/vcpkg-ports/versions/baseline.json index 81afca3..bb35a3c 100644 --- a/vcpkg-ports/versions/baseline.json +++ b/vcpkg-ports/versions/baseline.json @@ -1,5 +1,8 @@ { "2022-08-14": { "luajit": { "baseline": "2022-08-11", "port-version": 1 } + }, + "2024-03-26": { + "luajit": { "baseline": "2023-04-16", "port-version": 0 } } } \ No newline at end of file diff --git a/vcpkg-ports/versions/l-/luajit.json b/vcpkg-ports/versions/l-/luajit.json index 30e80dc..fc43c9f 100644 --- a/vcpkg-ports/versions/l-/luajit.json +++ b/vcpkg-ports/versions/l-/luajit.json @@ -1,5 +1,10 @@ { "versions": [ + { + "version-date": "2023-04-16", + "port-version": 0, + "path": "$/ports/luajit/2023-04-16" + }, { "version-date": "2022-08-11", "port-version": 1, From 8b8d5750019f59512afc09ccf3eef560536e73f6 Mon Sep 17 00:00:00 2001 From: Lars Viklund Date: Tue, 26 Mar 2024 17:37:21 +0100 Subject: [PATCH 3/3] fix: re-add mismerged stb include in CMake While recovering the vcpkg-ports tree from an earlier commit via revert some unrelated changes slipped through despite auditing the merge and wasn't caught by an incremental rebuild. Re-add the include directory for the vendored stb libraries. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ba40ed..373faa5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,6 +150,7 @@ target_link_libraries(imgui PUBLIC target_include_directories(SimpleGraphic PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dep/glad/include + ${CMAKE_CURRENT_SOURCE_DIR}/dep/stb ${JPEG_INCLUDE_DIR} )