[vlc-commits] [Git][videolan/vlc][master] 2 commits: contrib: mimic the Android CMake toolchain
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Jun 3 11:44:03 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
7e172702 by Steve Lhomme at 2023-06-03T10:38:41+00:00
contrib: mimic the Android CMake toolchain
We need to set ANDROID so that the code can tell it's building for Android.
This is until we use the proper CMake Android configuration.
- - - - -
7179b5ee by Steve Lhomme at 2023-06-03T10:38:41+00:00
contrib: libarchive: build with CMake
That's the target they use in their CI. Although they don't test
cross-compilation to Windows...
We don't need the Android patch anymore.
- - - - -
7 changed files:
- + contrib/src/libarchive/0001-Fix-bcrypt-detection-on-UNIX-cross-compilation.patch
- + contrib/src/libarchive/0001-Fix-build-error-when-cross-compiling-for-Windows.patch
- + contrib/src/libarchive/0001-Fix-compile-on-Android.patch
- + contrib/src/libarchive/0001-Use-the-common-CMake-BUILD_SHARED_LIBS-to-build-shar.patch
- − contrib/src/libarchive/android.patch
- contrib/src/libarchive/rules.mak
- contrib/src/main.mak
Changes:
=====================================
contrib/src/libarchive/0001-Fix-bcrypt-detection-on-UNIX-cross-compilation.patch
=====================================
@@ -0,0 +1,58 @@
+From d11155deb2a8ae33f2d0d293721980ae8fa95e6e Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 25 May 2023 11:47:13 +0200
+Subject: [PATCH] Fix bcrypt detection on UNIX cross-compilation
+
+The Windows SDK uses an uppercase on the B, but mingw-w64 doesn't.
+The autoconf detection already uses a lowercase bcrypt.
+---
+ CMakeLists.txt | 4 ++--
+ build/cmake/config.h.in | 2 +-
+ contrib/android/config/windows_host.h | 2 +-
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index dbb95e34..a174fc2c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -734,9 +734,9 @@ LA_CHECK_INCLUDE_FILE("wchar.h" HAVE_WCHAR_H)
+ LA_CHECK_INCLUDE_FILE("wctype.h" HAVE_WCTYPE_H)
+ LA_CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
+ IF(ENABLE_CNG)
+- LA_CHECK_INCLUDE_FILE("Bcrypt.h" HAVE_BCRYPT_H)
++ LA_CHECK_INCLUDE_FILE("bcrypt.h" HAVE_BCRYPT_H)
+ IF(HAVE_BCRYPT_H)
+- LIST(APPEND ADDITIONAL_LIBS "Bcrypt")
++ LIST(APPEND ADDITIONAL_LIBS "bcrypt")
+ ENDIF(HAVE_BCRYPT_H)
+ ELSE(ENABLE_CNG)
+ UNSET(HAVE_BCRYPT_H CACHE)
+diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in
+index ff74f33f..e4ff6969 100644
+--- a/build/cmake/config.h.in
++++ b/build/cmake/config.h.in
+@@ -366,7 +366,7 @@ typedef uint64_t uintmax_t;
+ /* Define to 1 if you have the <attr/xattr.h> header file. */
+ #cmakedefine HAVE_ATTR_XATTR_H 1
+
+-/* Define to 1 if you have the <Bcrypt.h> header file. */
++/* Define to 1 if you have the <bcrypt.h> header file. */
+ #cmakedefine HAVE_BCRYPT_H 1
+
+ /* Define to 1 if you have the <bsdxml.h> header file. */
+diff --git a/contrib/android/config/windows_host.h b/contrib/android/config/windows_host.h
+index 712b7491..6550e5e8 100644
+--- a/contrib/android/config/windows_host.h
++++ b/contrib/android/config/windows_host.h
+@@ -160,7 +160,7 @@
+ /* Define to 1 if you have the <attr/xattr.h> header file. */
+ /* #undef HAVE_ATTR_XATTR_H */
+
+-/* Define to 1 if you have the <Bcrypt.h> header file. */
++/* Define to 1 if you have the <bcrypt.h> header file. */
+ #define HAVE_BCRYPT_H
+
+ /* Define to 1 if you have the <bzlib.h> header file. */
+--
+2.37.3.windows.1
+
=====================================
contrib/src/libarchive/0001-Fix-build-error-when-cross-compiling-for-Windows.patch
=====================================
@@ -0,0 +1,33 @@
+From eaa608e13ea8c3953fc479af65eab863b94b4cd3 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 25 May 2023 11:33:23 +0200
+Subject: [PATCH] Fix build error when cross-compiling for Windows
+
+CHECK_C_SOURCE_RUNS generates a build error when cross-compiling.
+
+ZLIB_WINAPI is the only one tested. When the run test fails, it's tested again
+with just a compilation.
+---
+ CMakeLists.txt | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index dbb95e34..f0bbfd02 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -370,7 +370,11 @@ MACRO (TRY_MACRO_FOR_LIBRARY INCLUDES LIBRARIES
+ IF("${TRY_TYPE}" MATCHES "COMPILES")
+ CHECK_C_SOURCE_COMPILES("${SAMPLE_SOURCE}" ${VAR})
+ ELSEIF("${TRY_TYPE}" MATCHES "RUNS")
+- CHECK_C_SOURCE_RUNS("${SAMPLE_SOURCE}" ${VAR})
++ IF(CMAKE_CROSSCOMPILING)
++ MESSAGE(WARNING "Cannot test run \"${VAR}\" when cross-compiling")
++ ELSE(CMAKE_CROSSCOMPILING)
++ CHECK_C_SOURCE_RUNS("${SAMPLE_SOURCE}" ${VAR})
++ ENDIF(CMAKE_CROSSCOMPILING)
+ ELSE("${TRY_TYPE}" MATCHES "COMPILES")
+ MESSAGE(FATAL_ERROR "UNKNOWN KEYWORD \"${TRY_TYPE}\" FOR TRY_TYPE")
+ ENDIF("${TRY_TYPE}" MATCHES "COMPILES")
+--
+2.37.3.windows.1
+
=====================================
contrib/src/libarchive/0001-Fix-compile-on-Android.patch
=====================================
@@ -0,0 +1,28 @@
+From 0267cddc89ccd5c8483d2731b50652578ca42d81 Mon Sep 17 00:00:00 2001
+From: BogDan Vatra <bogdan at kde.org>
+Date: Tue, 3 May 2022 13:16:07 +0300
+Subject: [PATCH] Fix compile on Android
+
+Fixes: #890
+---
+ libarchive/CMakeLists.txt | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt
+index e1d76a51..44895ce3 100644
+--- a/libarchive/CMakeLists.txt
++++ b/libarchive/CMakeLists.txt
+@@ -5,6 +5,10 @@
+ #
+ ############################################
+
++if (ANDROID)
++ include_directories(${PROJECT_SOURCE_DIR}/contrib/android/include)
++endif()
++
+ # Public headers
+ SET(include_HEADERS
+ archive.h
+--
+2.37.3.windows.1
+
=====================================
contrib/src/libarchive/0001-Use-the-common-CMake-BUILD_SHARED_LIBS-to-build-shar.patch
=====================================
@@ -0,0 +1,78 @@
+From 2c3c9d5fa18a80c948f7b0dba85ee47be7a5f88b Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 25 May 2023 13:56:00 +0200
+Subject: [PATCH] Use the common CMake BUILD_SHARED_LIBS to build shared
+ library or not
+
+https://cmake.org/cmake/help/v3.0/variable/BUILD_SHARED_LIBS.html
+
+Usually it's built-in but make sure we have it on by default.
+
+We don't need to rename the windows static library when it's the only one built.
+This will also allow proper usage of the pkg-config file in this case. Otherwise
+there is no way to select the static library that way.
+---
+ CMakeLists.txt | 2 ++
+ libarchive/CMakeLists.txt | 22 +++++++++++++++-------
+ 2 files changed, 17 insertions(+), 7 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index dbb95e34..9d1b1404 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -199,6 +199,8 @@ ENDIF (MSVC)
+ # Enable CTest/CDash support
+ include(CTest)
+
++option(BUILD_SHARED_LIBS "Build shared libraries" ON)
++
+ OPTION(ENABLE_MBEDTLS "Enable use of mbed TLS" OFF)
+ OPTION(ENABLE_NETTLE "Enable use of Nettle" OFF)
+ OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON)
+diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt
+index ff7ade00..f7fdfb68 100644
+--- a/libarchive/CMakeLists.txt
++++ b/libarchive/CMakeLists.txt
+@@ -243,10 +243,12 @@ ELSEIF(ARCHIVE_ACL_SUNOS)
+ ENDIF()
+
+ # Libarchive is a shared library
+-ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS})
+-TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .)
+-TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS})
+-SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION})
++IF(BUILD_SHARED_LIBS)
++ ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS})
++ TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .)
++ TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS})
++ SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION})
++ENDIF(BUILD_SHARED_LIBS)
+
+ # archive_static is a static library
+ ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS})
+@@ -254,13 +256,19 @@ TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS})
+ SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS
+ LIBARCHIVE_STATIC)
+ # On Posix systems, libarchive.so and libarchive.a can co-exist.
+-IF(NOT WIN32 OR CYGWIN)
++IF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive)
+-ENDIF(NOT WIN32 OR CYGWIN)
++ENDIF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS)
+
+ IF(ENABLE_INSTALL)
+ # How to install the libraries
+- INSTALL(TARGETS archive archive_static
++ IF(BUILD_SHARED_LIBS)
++ INSTALL(TARGETS archive
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib)
++ ENDIF(BUILD_SHARED_LIBS)
++ INSTALL(TARGETS archive_static
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+--
+2.37.3.windows.1
+
=====================================
contrib/src/libarchive/android.patch deleted
=====================================
@@ -1,19 +0,0 @@
---- libarchive/Makefile.am.orig 2022-02-09 13:24:12.000000000 +0100
-+++ libarchive/Makefile.am 2022-02-14 19:22:31.487152622 +0100
-@@ -89,7 +89,7 @@
- #
- #
-
--include_HEADERS= libarchive/archive.h libarchive/archive_entry.h
-+include_HEADERS= libarchive/archive.h libarchive/archive_entry.h contrib/android/include/android_lf.h
-
- libarchive_la_SOURCES= \
- libarchive/archive_acl.c \
-@@ -284,6 +284,7 @@
-
- # -no-undefined marks that libarchive doesn't rely on symbols
- # defined in the application. This is mandatory for cygwin.
-+libarchive_la_CPPFLAGS= -I$(top_srcdir)/contrib/android/include
- libarchive_la_LDFLAGS= -no-undefined -version-info $(ARCHIVE_LIBTOOL_VERSION) $(GC_SECTIONS)
- libarchive_la_LIBADD= $(LTLIBICONV)
-
=====================================
contrib/src/libarchive/rules.mak
=====================================
@@ -14,13 +14,16 @@ DEPS_libarchive += alloweduwp $(DEPS_alloweduwp)
endif
LIBARCHIVE_CONF := \
- --disable-bsdcpio --disable-bsdtar --disable-bsdcat \
- --without-nettle \
- --without-xml2 --without-lzma --without-iconv --without-expat
+ -DENABLE_CPIO=OFF -DENABLE_TAR=OFF -DENABLE_CAT=OFF \
+ -DENABLE_NETTLE=OFF \
+ -DENABLE_LIBXML2=OFF -DENABLE_LZMA=OFF -DENABLE_ICONV=OFF -DENABLE_EXPAT=OFF \
+ -DENABLE_TEST=OFF
-ifdef HAVE_WIN32
# CNG enables bcrypt on Windows and useless otherwise, it's OK we build for Win7+
-LIBARCHIVE_CONF += --without-openssl --with-cng
+LIBARCHIVE_CONF +=-DENABLE_CNG=ON
+
+ifdef HAVE_WIN32
+LIBARCHIVE_CONF += -DENABLE_OPENSSL=OFF
endif
$(TARBALLS)/libarchive-$(LIBARCHIVE_VERSION).tar.gz:
@@ -30,9 +33,10 @@ $(TARBALLS)/libarchive-$(LIBARCHIVE_VERSION).tar.gz:
libarchive: libarchive-$(LIBARCHIVE_VERSION).tar.gz .sum-libarchive
$(UNPACK)
-ifdef HAVE_ANDROID
- $(APPLY) $(SRC)/libarchive/android.patch
-endif
+ $(APPLY) $(SRC)/libarchive/0001-Fix-compile-on-Android.patch
+ $(APPLY) $(SRC)/libarchive/0001-Fix-build-error-when-cross-compiling-for-Windows.patch
+ $(APPLY) $(SRC)/libarchive/0001-Fix-bcrypt-detection-on-UNIX-cross-compilation.patch
+ $(APPLY) $(SRC)/libarchive/0001-Use-the-common-CMake-BUILD_SHARED_LIBS-to-build-shar.patch
$(APPLY) $(SRC)/libarchive/0001-Use-CreateHardLinkW-and-CreateSymbolicLinkW-directly.patch
$(APPLY) $(SRC)/libarchive/0002-Disable-CreateSymbolicLinkW-use-in-UWP-builds.patch
$(APPLY) $(SRC)/libarchive/0003-fix-the-CreateHardLinkW-signature-to-match-the-real-.patch
@@ -45,10 +49,9 @@ endif
$(call pkg_static,"build/pkgconfig/libarchive.pc.in")
$(MOVE)
-.libarchive: libarchive
- $(RECONF)
- $(MAKEBUILDDIR)
- $(MAKECONFIGURE) $(LIBARCHIVE_CONF)
- +$(MAKEBUILD)
- +$(MAKEBUILD) install
+.libarchive: libarchive toolchain.cmake
+ $(CMAKECLEAN)
+ $(HOSTVARS) $(CMAKE) $(LIBARCHIVE_CONF)
+ +$(CMAKEBUILD)
+ $(CMAKEINSTALL)
touch $@
=====================================
contrib/src/main.mak
=====================================
@@ -456,6 +456,9 @@ CMAKE = cmake -S $< -DCMAKE_TOOLCHAIN_FILE=$(abspath toolchain.cmake) \
ifdef HAVE_WIN32
CMAKE += -DCMAKE_DEBUG_POSTFIX:STRING=
endif
+ifdef HAVE_ANDROID
+CMAKE += -DANDROID:BOOL=ON
+endif
ifdef MSYS_BUILD
CMAKE = PKG_CONFIG_LIBDIR="$(PKG_CONFIG_PATH)" $(CMAKE)
CMAKE += -DCMAKE_LINK_LIBRARY_SUFFIX:STRING=.a
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2fa81b6f15f268e1aaeaf55d93f5bb628714d8cb...7179b5ee6e24641844c2a1ba075187ee12216534
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2fa81b6f15f268e1aaeaf55d93f5bb628714d8cb...7179b5ee6e24641844c2a1ba075187ee12216534
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list