forked from microsoft/vcpkg
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libcap] Normalize (microsoft#33923)
* [libcap] Normalize * Update license * Finish WIP
- Loading branch information
Showing
7 changed files
with
78 additions
and
144 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,50 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
linkage=shared | ||
prefix= | ||
for OPTION; do | ||
case "${OPTION}" in | ||
--prefix=*) | ||
prefix="${OPTION#--prefix=}" | ||
;; | ||
--enable-static) | ||
linkage=static | ||
;; | ||
esac | ||
done | ||
|
||
cat > Makefile.vcpkg <<END_MAKEFILE ; | ||
BUILD_OPTIONS = \ | ||
"AR=$AR" \ | ||
"BUILD_CC=$CC_FOR_BUILD" \ | ||
"CC=$CC" \ | ||
"RANLIB=$RANLIB" \ | ||
"lib=lib" \ | ||
"prefix=$prefix" | ||
ifeq ($linkage,shared) | ||
libs := libcap.so libpsx.so | ||
BUILD_OPTIONS += SHARED=yes | ||
else | ||
libs := libcap.a libpsx.a | ||
BUILD_OPTIONS += SHARED=no | ||
endif | ||
all: libcap/cap_names.h | ||
\$(MAKE) -C libcap pcs \$(libs) \$(BUILD_OPTIONS) | ||
libcap/cap_names.h: | ||
\$(MAKE) -C libcap cap_names.h \$(BUILD_OPTIONS) | ||
install: install-cap_names | ||
\$(MAKE) -C libcap install-$linkage \$(BUILD_OPTIONS) | ||
install-cap_names: | ||
mkdir -p -m 0755 "\$(DESTDIR)$prefix/include/sys/libcap-private" | ||
install -m 0644 libcap/cap_names.h "\$(DESTDIR)$prefix/include/sys/libcap-private" | ||
install -m 0644 libcap/cap_names.list.h "\$(DESTDIR)$prefix/include/sys/libcap-private" | ||
END_MAKEFILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,29 @@ | ||
vcpkg_from_git( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
URL git://git.kernel.org/pub/scm/libs/libcap/libcap.git | ||
FETCH_REF "libcap-${VERSION}" | ||
REF 3c7dda330bd9a154bb5b878d31fd591e4951fe17 | ||
PATCHES | ||
cap_names.separation.patch | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
URL git://git.kernel.org/pub/scm/libs/libcap/libcap.git | ||
FETCH_REF "libcap-${VERSION}" | ||
REF 3c7dda330bd9a154bb5b878d31fd591e4951fe17 | ||
) | ||
# Note: if libcap version is updated, the according cap_names.h should be updated if necessary. | ||
|
||
# SKIP_CONFIGURE is broken https://github.com/microsoft/vcpkg/issues/14389 | ||
# so we use patch to create empty configure executable | ||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/configure" DESTINATION "${SOURCE_PATH}") | ||
|
||
# This needs to be called before configure | ||
vcpkg_cmake_get_vars(cmake_vars_file) | ||
|
||
if(VCPKG_CROSSCOMPILING) | ||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/cap_names.h" DESTINATION "${SOURCE_PATH}/libcap/") | ||
endif () | ||
file(TOUCH "${SOURCE_PATH}/libcap/_makenames") | ||
file(COPY "${CURRENT_HOST_INSTALLED_DIR}/include/sys/libcap-private/cap_names.list.h" DESTINATION "${SOURCE_PATH}/libcap/") | ||
file(COPY "${CURRENT_HOST_INSTALLED_DIR}/include/sys/libcap-private/cap_names.h" DESTINATION "${SOURCE_PATH}/libcap/") | ||
file(TOUCH "${SOURCE_PATH}/libcap/cap_names.h") | ||
endif() | ||
|
||
vcpkg_configure_make( | ||
SOURCE_PATH "${SOURCE_PATH}" | ||
COPY_SOURCE | ||
SOURCE_PATH "${SOURCE_PATH}" | ||
COPY_SOURCE | ||
DETERMINE_BUILD_TRIPLET | ||
) | ||
|
||
include("${cmake_vars_file}") | ||
list(APPEND libcap_OPTIONS "prefix=${CURRENT_INSTALLED_DIR}" "CC=${VCPKG_DETECTED_CMAKE_C_COMPILER}" "AR=${VCPKG_DETECTED_CMAKE_AR}" "RANLIB=${VCPKG_DETECTED_CMAKE_RANLIB}") | ||
|
||
if (NOT VCPKG_CROSSCOMPILING) | ||
# patch decouples cap_names.h target from libcap.* for cross compile compatibility, | ||
# so for host=target build we manually make it | ||
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET cap_names.h | ||
LOGFILE_ROOT "configure" | ||
OPTIONS | ||
${libcap_OPTIONS} | ||
) | ||
endif () | ||
|
||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") | ||
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET libcap.a | ||
LOGFILE_ROOT "build" | ||
OPTIONS | ||
${libcap_OPTIONS} | ||
) | ||
else() | ||
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET libcap.so | ||
LOGFILE_ROOT "build" | ||
OPTIONS | ||
${libcap_OPTIONS} | ||
) | ||
endif() | ||
|
||
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET libcap.pc | ||
LOGFILE_ROOT "pkgconfig" | ||
OPTIONS | ||
${libcap_OPTIONS} | ||
vcpkg_install_make( | ||
MAKEFILE "Makefile.vcpkg" | ||
) | ||
vcpkg_fixup_pkgconfig() | ||
|
||
file(INSTALL "${SOURCE_PATH}/libcap/include/" DESTINATION "${CURRENT_PACKAGES_DIR}/include" FILES_MATCHING PATTERN "*.h") | ||
|
||
set(BUILD_DIR_RELEASE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") | ||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") | ||
file(INSTALL "${BUILD_DIR_RELEASE}/libcap/libcap.a" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") | ||
else() | ||
file(INSTALL "${BUILD_DIR_RELEASE}/libcap/libcap.so" DESTINATION "${CURRENT_PACKAGES_DIR}/lib" FOLLOW_SYMLINK_CHAIN) | ||
endif() | ||
|
||
set(BUILD_DIR_DEBUG "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") | ||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") | ||
file(INSTALL "${BUILD_DIR_DEBUG}/libcap/libcap.a" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") | ||
else() | ||
file(INSTALL "${BUILD_DIR_DEBUG}/libcap/libcap.so" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib" FOLLOW_SYMLINK_CHAIN) | ||
endif() | ||
|
||
file(INSTALL "${BUILD_DIR_RELEASE}/libcap/libcap.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") | ||
file(INSTALL "${BUILD_DIR_DEBUG}/libcap/libcap.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig") | ||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") | ||
|
||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/License") | ||
|
||
vcpkg_fixup_pkgconfig() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters