Skip to content

Commit

Permalink
Merge pull request xbmc#25078 from fuzzard/depends_brotli
Browse files Browse the repository at this point in the history
[tools/depends][target] Add brotli lib for curl
  • Loading branch information
fuzzard authored May 3, 2024
2 parents 7454a6f + 82f44f0 commit 3916fa3
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 3 deletions.
12 changes: 11 additions & 1 deletion cmake/modules/FindCurl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ if(${CURL_LIBRARY} MATCHES ".+\.a$" AND PC_CURL_STATIC_LDFLAGS)
pkg_check_modules(PC_NGHTTP2 libnghttp2 QUIET)
find_library(NGHTTP2_LIBRARY NAMES libnghttp2 nghttp2
HINTS ${PC_NGHTTP2_LIBDIR})

pkg_check_modules(PC_BROTLIDEC libbrotlidec QUIET)
find_library(BROTLIDEC_LIBRARY NAMES brotlidec
HINTS ${PC_BROTLIDEC_LIBDIR})

pkg_check_modules(PC_BROTLICOMMON libbrotlicommon QUIET)
find_library(BROTLICOMMON_LIBRARY NAMES brotlicommon
HINTS ${PC_BROTLICOMMON_LIBDIR})
set(BROTLI_LIBRARIES ${BROTLIDEC_LIBRARY} ${BROTLICOMMON_LIBRARY})

endif()

include(FindPackageHandleStandardArgs)
Expand All @@ -47,7 +57,7 @@ find_package_handle_standard_args(Curl

if(CURL_FOUND)
set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
set(CURL_LIBRARIES ${CURL_LIBRARY} ${NGHTTP2_LIBRARY})
set(CURL_LIBRARIES ${CURL_LIBRARY} ${NGHTTP2_LIBRARY} ${BROTLI_LIBRARIES})

if(NOT TARGET Curl::Curl)
add_library(Curl::Curl ${CURL_LIB_TYPE} IMPORTED)
Expand Down
3 changes: 2 additions & 1 deletion tools/depends/target/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ endif

# Keep in alphabetical order
DEPENDS = \
brotli \
bzip2 \
curl \
dav1d \
Expand Down Expand Up @@ -150,7 +151,7 @@ $(DOWNLOAD_TARGETS):
download: $(DOWNLOAD_TARGETS)

crossguid: $(LIBUUID)
curl: openssl nghttp2 $(ZLIB)
curl: brotli openssl nghttp2 $(ZLIB)
dbus: expat
ffmpeg: $(ICONV) $(ZLIB) bzip2 gnutls dav1d $(LIBVA)
fontconfig: freetype2 expat $(ICONV) $(LIBUUID)
Expand Down
28 changes: 28 additions & 0 deletions tools/depends/target/brotli/01-all-disable-exe.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -169,15 +169,19 @@
endif()

# Build the brotli executable
-add_executable(brotli c/tools/brotli.c)
-target_link_libraries(brotli ${BROTLI_LIBRARIES})
+if(NOT BROTLI_DISABLE_EXE)
+ add_executable(brotli c/tools/brotli.c)
+ target_link_libraries(brotli ${BROTLI_LIBRARIES})
+endif()

# Installation
if(NOT BROTLI_BUNDLED_MODE)
- install(
- TARGETS brotli
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
- )
+ if(NOT BROTLI_DISABLE_EXE)
+ install(
+ TARGETS brotli
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ )
+ endif()

install(
TARGETS ${BROTLI_LIBRARIES_CORE}
5 changes: 5 additions & 0 deletions tools/depends/target/brotli/BROTLI-VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LIBNAME=brotli
VERSION=1.1.0
ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
SHA512=6eb280d10d8e1b43d22d00fa535435923c22ce8448709419d676ff47d4a644102ea04f488fc65a179c6c09fee12380992e9335bad8dfebd5d1f20908d10849d9
BYPRODUCT=libbrotlidec.a
33 changes: 33 additions & 0 deletions tools/depends/target/brotli/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
include ../../Makefile.include BROTLI-VERSION ../../download-files.include
DEPS = ../../Makefile.include Makefile BROTLI-VERSION ../../download-files.include \
01-all-disable-exe.patch

LIBDYLIB=$(PLATFORM)/build/$(BYPRODUCT)

CMAKE_OPTIONS=-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=$(PREFIX) \
-DCMAKE_BUILD_TYPE=Release \
-DBROTLI_DISABLE_TESTS=ON \
-DBROTLI_DISABLE_EXE=ON

all: .installed-$(PLATFORM)

$(PLATFORM): $(DEPS) | $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE)
rm -rf $(PLATFORM); mkdir -p $(PLATFORM)/build
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
cd $(PLATFORM); patch -p1 -i ../01-all-disable-exe.patch
cd $(PLATFORM)/build; $(CMAKE) ${CMAKE_OPTIONS} ..

$(LIBDYLIB): $(PLATFORM)
$(MAKE) -C $(PLATFORM)/build

.installed-$(PLATFORM): $(LIBDYLIB)
$(MAKE) -C $(PLATFORM)/build install
touch $@

clean:
rm -rf $(PLATFORM) .installed-$(PLATFORM)

distclean::
rm -rf $(PLATFORM) .installed-$(PLATFORM)

2 changes: 1 addition & 1 deletion tools/depends/target/curl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
--without-libidn2 \
--with-ca-fallback \
--with-ssl=$(PREFIX) \
--with-brotli=$(PREFIX) \
--with-nghttp2=$(PREFIX) \
--with-zlib \
--without-libpsl \
--without-zstd \
--without-brotli \
--without-gssapi \
--without-gsasl \
--without-hyper \
Expand Down
1 change: 1 addition & 0 deletions tools/depends/target/gnutls/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ CONFIGURE=./configure --prefix=$(PREFIX) \
--disable-guile \
--disable-tools \
--without-idn \
--without-brotli \
$(CONFIGURE_OPTIONS)

# LLVM 15 has raised this to error by default. drop back to warning
Expand Down

0 comments on commit 3916fa3

Please sign in to comment.