[libcap] Normalize (#33923)

* [libcap] Normalize

* Update license

* Finish WIP
This commit is contained in:
Kai Pastor 2023-09-24 07:06:01 +02:00 committed by GitHub
parent 2b0cdcb645
commit 559cbd3d15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 78 additions and 144 deletions

View File

@ -1,56 +0,0 @@
/*
* DO NOT EDIT: this file is generated automatically from
*
* <uapi/linux/capability.h>
*/
#define __CAP_BITS 41
#define __CAP_NAME_SIZE 23
#ifdef LIBCAP_PLEASE_INCLUDE_ARRAY
#define LIBCAP_CAP_NAMES { \
/* 0 */ "cap_chown", \
/* 1 */ "cap_dac_override", \
/* 2 */ "cap_dac_read_search", \
/* 3 */ "cap_fowner", \
/* 4 */ "cap_fsetid", \
/* 5 */ "cap_kill", \
/* 6 */ "cap_setgid", \
/* 7 */ "cap_setuid", \
/* 8 */ "cap_setpcap", \
/* 9 */ "cap_linux_immutable", \
/* 10 */ "cap_net_bind_service", \
/* 11 */ "cap_net_broadcast", \
/* 12 */ "cap_net_admin", \
/* 13 */ "cap_net_raw", \
/* 14 */ "cap_ipc_lock", \
/* 15 */ "cap_ipc_owner", \
/* 16 */ "cap_sys_module", \
/* 17 */ "cap_sys_rawio", \
/* 18 */ "cap_sys_chroot", \
/* 19 */ "cap_sys_ptrace", \
/* 20 */ "cap_sys_pacct", \
/* 21 */ "cap_sys_admin", \
/* 22 */ "cap_sys_boot", \
/* 23 */ "cap_sys_nice", \
/* 24 */ "cap_sys_resource", \
/* 25 */ "cap_sys_time", \
/* 26 */ "cap_sys_tty_config", \
/* 27 */ "cap_mknod", \
/* 28 */ "cap_lease", \
/* 29 */ "cap_audit_write", \
/* 30 */ "cap_audit_control", \
/* 31 */ "cap_setfcap", \
/* 32 */ "cap_mac_override", \
/* 33 */ "cap_mac_admin", \
/* 34 */ "cap_syslog", \
/* 35 */ "cap_wake_alarm", \
/* 36 */ "cap_block_suspend", \
/* 37 */ "cap_audit_read", \
/* 38 */ "cap_perfmon", \
/* 39 */ "cap_bpf", \
/* 40 */ "cap_checkpoint_restore", \
}
#endif /* LIBCAP_PLEASE_INCLUDE_ARRAY */
/* END OF FILE */

View File

@ -1,13 +0,0 @@
diff --git a/libcap/Makefile b/libcap/Makefile
index f5dde3e..4eb13aa 100644
--- a/libcap/Makefile
+++ b/libcap/Makefile
@@ -25,7 +25,7 @@ CFLAGS += -fPIC
# executable
MAGIC=-Wl,-e,__so_start
-INCLS=libcap.h cap_names.h $(INCS)
+INCLS=libcap.h $(INCS)
GPERF_OUTPUT = _caps_output.gperf
CAPOBJS=$(addsuffix .o, $(CAPFILES))

View File

@ -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

View File

@ -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()

View File

@ -1,11 +1,16 @@
{
"name": "libcap",
"version": "2.69",
"description": "capability library: includes libcap2 file caps, setcap, getcap and capsh",
"port-version": 1,
"description": "A library for getting and setting POSIX.1e (formerly POSIX 6) draft 15 capabilities.",
"homepage": "https://git.kernel.org/pub/scm/libs/libcap/libcap.git",
"license": "BSD-3-Clause",
"license": "BSD-3-Clause OR GPL-2.0-only",
"supports": "linux",
"dependencies": [
{
"name": "libcap",
"host": true
},
{
"name": "vcpkg-cmake-get-vars",
"host": true

View File

@ -3994,7 +3994,7 @@
},
"libcap": {
"baseline": "2.69",
"port-version": 0
"port-version": 1
},
"libcbor": {
"baseline": "0.10.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "3f8091b1a094e5a0ab51652478289c040e98e7ca",
"version": "2.69",
"port-version": 1
},
{
"git-tree": "78c061106eac6df0a86b27df684998c780c70008",
"version": "2.69",