Package Details: brunsli 0.1-2

Git Clone URL: https://aur.archlinux.org/brunsli.git (read-only, click to copy)
Package Base: brunsli
Description: Lossless JPEG repacker
Upstream URL: https://github.com/google/brunsli/
Licenses: MIT
Submitter: dbermond
Maintainer: dbermond
Last Packager: dbermond
Votes: 4
Popularity: 0.69
First Submitted: 2020-02-01 01:43 (UTC)
Last Updated: 2022-11-14 14:27 (UTC)

Latest Comments

micwoj92 commented on 2025-02-27 01:52 (UTC)

I didn't even see other changes. I just glanced over it...

Would you be interested in changing to system binaries if it works? For me the biggest gripe with this is unnecessary download size for these additional repos.

dbermond commented on 2025-02-26 16:00 (UTC)

@micwoj92 Simply dropping a patch without any explanation or context is not a good practice, and usually will be ignored. That being said, I do not like this patch, as it changes the C/C++ compiler, disables upstream CXX extensions, and so on. Besides, not sure if it is a good idea to exchange a source brotli/gtest for a binary brotli/gtest in a project that does not see a single upstream commit in one year and have no new upstream releases in six years. I prefer to stay with upstream sources currently, unless these sources become broken with newer versions of compiler and/or cmake.

micwoj92 commented on 2025-02-25 23:45 (UTC)

@dbermond could you take a look at patch below to use system packages?

entshuld commented on 2024-05-07 15:30 (UTC)


From cab9a4cd8e743473b5a055fb51fd84855aaea6b1 Mon Sep 17 00:00:00 2001
From: entshuld <no-reply@aur.org>
Date: Tue, 7 May 2024
Subject: [PATCH] there are packages for brotli, googletest and highwayhash

---
 .SRCINFO                        |  10 +--
 PKGBUILD                        |  32 ++++----
 no_compile_aur_submodules.patch | 125 ++++++++++++++++++++++++++++++++
 3 files changed, 145 insertions(+), 22 deletions(-)
 create mode 100644 no_compile_aur_submodules.patch

diff --git a/.SRCINFO b/.SRCINFO
index 7517fec..4b8a1ad 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -7,14 +7,12 @@ pkgbase = brunsli
    license = MIT
    makedepends = git
    makedepends = cmake
+   makedepends = highwayhash
+   makedepends = gtest
    depends = gcc-libs
    source = git+https://github.com/google/brunsli.git#tag=v0.1
-   source = git+https://github.com/google/brotli.git
-   source = git+https://github.com/google/googletest.git
-   source = git+https://github.com/google/highwayhash.git
-   sha256sums = SKIP
-   sha256sums = SKIP
-   sha256sums = SKIP
+   source = no_compile_aur_submodules.patch
    sha256sums = SKIP
+   sha256sums = e17a4555ad9c62bdd50ae5d2d2833c578879a2dc8a204b7dcd55228b21a4ec69

 pkgname = brunsli
diff --git a/PKGBUILD b/PKGBUILD
index 5dd09f0..521f13f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,29 +8,29 @@ arch=('x86_64')
 url='https://github.com/google/brunsli/'
 license=('MIT')
 depends=('gcc-libs')
-makedepends=('git' 'cmake')
+makedepends=('git' 'cmake' "highwayhash" "gtest")
 source=("git+https://github.com/google/brunsli.git#tag=v${pkgver}"
-        'git+https://github.com/google/brotli.git'
-        'git+https://github.com/google/googletest.git'
-        'git+https://github.com/google/highwayhash.git')
+        "no_compile_aur_submodules.patch")
 sha256sums=('SKIP'
-            'SKIP'
-            'SKIP'
-            'SKIP')
+           "e17a4555ad9c62bdd50ae5d2d2833c578879a2dc8a204b7dcd55228b21a4ec69")

 prepare() {
-    git -C brunsli submodule init
-    git -C brunsli config --local submodule.third_party/brotli.url "${srcdir}/brotli"
-    git -C brunsli config --local submodule.third_party/googletest.url "${srcdir}/googletest"
-    git -C brunsli config --local submodule.third_party/highwayhash.url "${srcdir}/highwayhash"
-    git -C brunsli -c protocol.file.allow='always' submodule update
+    cd brunsli
+    patch -Np1 -i ../no_compile_aur_submodules.patch
+    rm -fr {.,java}/{WORKSPACE.bazel,.bazelrc} compiler_config_setting.bzl BUILD.bazel
 }

 build() {
-    cmake -B build -S brunsli \
-        -DCMAKE_BUILD_TYPE:STRING='None' \
-        -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
-        -Wno-dev
+    CONFOPTS=(
+      -B build -S brunsli
+      -DCMAKE_BUILD_TYPE:STRING='None'
+      -DCMAKE_INSTALL_PREFIX:PATH='/usr'
+      -DCMAKE_C_COMPILER=mpicc
+      -DCMAKE_CXX_COMPILER=mpicxx
+      -Wno-dev
+    )
+    cmake ${CONFOPTS[@]}
+
     make -C build
 }

diff --git a/no_compile_aur_submodules.patch b/no_compile_aur_submodules.patch
new file mode 100644
index 0000000..bd26e5e
--- /dev/null
+++ b/no_compile_aur_submodules.patch
@@ -0,0 +1,125 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7d785be..f1c8f10 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -26,7 +26,5 @@ set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_EXTENSIONS OFF)
+ set(CMAKE_CXX_STANDARD_REQUIRED YES)
+ 
+-add_subdirectory(third_party)
+-
+ # The Brunsli library definition.
+ include(brunsli.cmake)
+diff --git a/Makefile b/Makefile
+index fc90f4e..f828ef8 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,8 +1,8 @@
+ OS := $(shell uname)
+ BINDIR = bin
+ OBJDIR = $(BINDIR)/obj
+-BROTLI_DIR = third_party/brotli
+-BROTLI_INCLUDE = $(BROTLI_DIR)/c/include
++BROTLI_DIR = /usr
++BROTLI_INCLUDE = $(BROTLI_DIR)/include
+ BRUNSLI_INCLUDE = c/include
+ SOURCES = $(wildcard c/common/*.cc) $(wildcard c/dec/*.cc) \
+           $(wildcard c/enc/*.cc)
+@@ -13,7 +13,7 @@ CBRUNSLI = $(addprefix $(OBJDIR)/, c/tools/cbrunsli.o)
+ DBRUNSLI = $(addprefix $(OBJDIR)/, c/tools/dbrunsli.o)
+ DIRS = $(OBJDIR)/c/common $(OBJDIR)/c/dec $(OBJDIR)/c/enc \
+        $(OBJDIR)/c/tools
+-LIBBROTLI=brotli
++LIBBROTLI=brotlicommon
+ CFLAGS += -O2 -std=c++11 -ffunction-sections
+ LDFLAGS += -Wl,-gc-sections
+ ifeq ($(os), Darwin)
+@@ -35,7 +35,7 @@ endif
+ all: cbrunsli dbrunsli
+   @:
+ 
+-.PHONY: all clean libbrotli cbrunsli dbrunsli
++.PHONY: all clean cbrunsli dbrunsli
+ 
+ $(DIRS):
+   mkdir -p $@
+diff --git a/brunsli.cmake b/brunsli.cmake
+index 1e87527..130dd02 100644
+--- a/brunsli.cmake
++++ b/brunsli.cmake
+@@ -56,8 +56,17 @@ add_library(brunslidec-static STATIC
+   ${BRUNSLI_DEC_SOURCES}
+   ${BRUNSLI_DEC_HEADERS}
+ )
++
++# https://stackoverflow.com/a/29316084
++find_package(PkgConfig REQUIRED)
++pkg_check_modules(BROTLI REQUIRED libbrotlicommon)
++pkg_check_modules(BROTLI_DEC REQUIRED libbrotlidec)
++pkg_check_modules(BROTLI_ENC REQUIRED libbrotlienc)
++
++target_include_directories(brunslidec-static PRIVATE
++  ${BROTLI_DEC_DIRS})
+ target_link_libraries(brunslidec-static PRIVATE
+-  brotlidec-static
++  ${BROTLI_DEC_LIBRARIES}
+   brunslicommon-static
+ )
+ 
+@@ -65,8 +74,11 @@ add_library(brunslienc-static STATIC
+   ${BRUNSLI_ENC_SOURCES}
+   ${BRUNSLI_ENC_HEADERS}
+ )
++
++target_include_directories(brunslienc-static PRIVATE
++  ${BROTLI_ENC_DIRS})
+ target_link_libraries(brunslienc-static PRIVATE
+-  brotlienc-static
++  ${BROTLI_ENC_LIBRARIES}
+   brunslicommon-static
+ )
+ 
+@@ -77,10 +89,13 @@ add_library(brunslidec-c SHARED
+   c/dec/decode.cc
+ )
+ target_link_libraries(brunslidec-c PRIVATE brunslidec-static)
++target_link_libraries(brunslidec-c PRIVATE ${BROTLI_LIBRARIES})
++target_link_libraries(brunslidec-c PRIVATE ${BROTLI_DEC_LIBRARIES})
+ add_library(brunslienc-c SHARED
+   c/enc/encode.cc
+ )
+ target_link_libraries(brunslienc-c PRIVATE brunslienc-static)
++target_link_libraries(brunslienc-c PRIVATE ${BROTLI_ENC_LIBRARIES})
+ list(APPEND BRUNSLI_LIBRARIES brunslidec-c brunslienc-c)
+ endif()  # BRUNSLI_EMSCRIPTEN
+ 
+diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
+index 683837d..8c763b6 100644
+--- a/third_party/CMakeLists.txt
++++ b/third_party/CMakeLists.txt
+@@ -4,14 +4,14 @@
+ # license that can be found in the LICENSE file or at
+ # https://opensource.org/licenses/MIT.
+ 
+-# brotli
+-if (NOT TARGET brotlicommon-static)
+-  if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/brotli/c/include/brotli/decode.h")
+-    message(SEND_ERROR "Brotli is required to build brunsli, run \"git submodule update --init\" to get it, then run cmake again")
+-  endif ()
+-  add_subdirectory(brotli EXCLUDE_FROM_ALL)
+-endif ()
+-
+-if (NOT TARGET gtest_main)
+-  add_subdirectory(googletest EXCLUDE_FROM_ALL)
+-endif ()
++# # brotli
++# if (NOT TARGET brotlicommon-static)
++#   if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/brotli/c/include/brotli/decode.h")
++#     message(SEND_ERROR "Brotli is required to build brunsli, run \"git submodule update --init\" to get it, then run cmake again")
++#   endif ()
++#   add_subdirectory(brotli EXCLUDE_FROM_ALL)
++# endif ()
++#
++# if (NOT TARGET gtest_main)
++#   add_subdirectory(googletest EXCLUDE_FROM_ALL)
++# endif ()

base-commit: ff82ca9d7ed17c6e3d7d6c8178d945a9ce24fbe7
-- 
2.45.0