Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[luajit] Install .pc file for windows #26971

Merged
merged 1 commit into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ports/luajit/005-do-not-pass-ld-e-macosx.patch
Original file line number Diff line number Diff line change
@@ -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}
24 changes: 24 additions & 0 deletions ports/luajit/luajit.pc.win.in
Original file line number Diff line number Diff line change
@@ -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=@LJIT_LIBDIR@
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@
16 changes: 15 additions & 1 deletion ports/luajit/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
if (VCPKG_TARGET_IS_OSX)
set (LJIT_PATCHES 005-do-not-pass-ld-e-macosx.patch)
else()
set (LJIT_PATCHES "")
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO LuaJIT/LuaJIT
Expand All @@ -7,12 +13,15 @@ vcpkg_from_github(
PATCHES
003-do-not-set-macosx-deployment-target.patch
004-fix-build-path-and-crt-linkage.patch
${LJIT_PATCHES}
)

if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set (LJIT_STATIC "")
set (LJIT_MSVC_PC_CFLAGS "/DLUA_BUILD_AS_DLL=1")
else()
set (LJIT_STATIC "static")
set (LJIT_MSVC_PC_CFLAGS "")
endif()

if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug)
Expand All @@ -29,11 +38,13 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug)
)

# 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:
# only 'minilua.exe' being produced. This resulted 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")
set(LJIT_LIBDIR "debug/lib")
configure_file("${CMAKE_CURRENT_LIST_DIR}/luajit.pc.win.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/luajit.pc" @ONLY)

if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lua51.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
Expand All @@ -55,6 +66,7 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug)
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")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/luajit.pc" "multilib=lib" "multilib=debug/lib")
endif()
endif()

Expand All @@ -73,6 +85,8 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release)

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")
set(LJIT_LIBDIR "lib")
configure_file("${CMAKE_CURRENT_LIST_DIR}/luajit.pc.win.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/luajit.pc" @ONLY)

if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lua51.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
Expand Down
2 changes: 1 addition & 1 deletion ports/luajit/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "luajit",
"version-date": "2022-08-11",
"port-version": 1,
"port-version": 2,
"description": "LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.",
"homepage": "https://github.com/LuaJIT/LuaJIT",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4506,7 +4506,7 @@
},
"luajit": {
"baseline": "2022-08-11",
"port-version": 1
"port-version": 2
},
"luasec": {
"baseline": "1.1.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/luajit.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "572eb21690be2a997b4bc4f1a49f93a77dc4a92b",
"version-date": "2022-08-11",
"port-version": 2
},
{
"git-tree": "bacc33ec723d7fc2b895a1351a2042c5c6fb6971",
"version-date": "2022-08-11",
Expand Down