diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-10-08 22:54:47 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-10-08 22:57:00 +0200 |
| commit | 8d8179d3b412cdd2c1af60539b9aec89631f3fe6 (patch) | |
| tree | 21cfc4b49d68226ee1c00e826aedf99152dc18c5 | |
| parent | 10e42591ac72285736d5cc4ee5e7c2f68dbf1e4b (diff) | |
Allow building thumbnail from the top-level build
| -rw-r--r-- | CMakeLists.txt | 6 | ||||
| -rw-r--r-- | README.md | 3 | ||||
| -rwxr-xr-x | configure | 21 | ||||
| -rw-r--r-- | thumbnail/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | thumbnail/Makefile | 3 |
5 files changed, 34 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c3e4ea1..ef31a03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required(VERSION 3.13) project(slcl LANGUAGES C VERSION 0.2.0) +option(THUMBNAIL "Build thumbnail generator") add_executable(${PROJECT_NAME} auth.c cftw.c @@ -42,3 +43,8 @@ target_link_libraries(${PROJECT_NAME} PRIVATE web dynstr cjson libsodium target_link_libraries(usergen PRIVATE dynstr cjson libsodium) install(TARGETS ${PROJECT_NAME} usergen) add_subdirectory(doc) + +if(THUMBNAIL) + add_subdirectory(thumbnail) + install(TARGETS thumbnail) +endif() @@ -58,6 +58,7 @@ to `slcl`. If required, encryption should be done before uploading e.g.: using (provided as a `git` submodule). - [`fdzipstream`](https://github.com/CTrabant/fdzipstream.git) (provided as a `git` submodule). +- ImageMagick >= 6.0 (optional, for [`thumbnail`](thumbnail/) only). - CMake (optional). ### Ubuntu / Debian @@ -71,7 +72,7 @@ sudo apt install build-essential libcjson-dev libssl-dev m4 zlib1g #### Optional packages ```sh -sudo apt install cmake +sudo apt install cmake libmagickcore-6.q16-dev ``` ## How to use @@ -14,12 +14,15 @@ CFLAGS=${CFLAGS:-"$default_CFLAGS $default_NPCFLAGS"} LDFLAGS=${LDFLAGS:-$default_LDFLAGS} USERGEN_LDFLAGS=${LDFLAGS} +build_thumbnail=0 + help() { cat <<-EOF $0 [OPTION ...] --prefix Set installation directory [$default_prefix] +--thumbnail Build thumbnail generator Some influential environment variables: CC C compiler [$default_CC] @@ -43,6 +46,7 @@ while true; do case "$key" in --prefix ) prefix="$value"; shift; test $split_arg -eq 0 && shift ;; + --thumbnail ) build_thumbnail=1; shift ;; -h | --help ) help; exit 0 ;; * ) test "$1" != "" && help && exit 1 || break ;; esac @@ -180,6 +184,16 @@ $(FDZIPSTREAM): FORCE $(DYNSTR) EOF fi +if [ $build_thumbnail -ne 0 ] +then +cat <<"EOF" >> $F +THUMBNAIL = thumbnail/thumbnail +thumbnail $(PROJECT): $(THUMBNAIL) +$(THUMBNAIL): FORCE + +cd thumbnail && $(MAKE) CC=$(CC) +EOF +fi + cat <<"EOF" >> $F clean: rm -f $(OBJECTS) $(DEPS) @@ -228,6 +242,13 @@ cat <<"EOF" >> $F EOF fi +if [ $build_thumbnail -ne 0 ] +then +cat <<"EOF" >> $F + +cd thumbnail && $(MAKE) distclean +EOF +fi + cat <<"EOF" >> $F -include $(DEPS) EOF diff --git a/thumbnail/CMakeLists.txt b/thumbnail/CMakeLists.txt index 9df2f34..d4edf8d 100644 --- a/thumbnail/CMakeLists.txt +++ b/thumbnail/CMakeLists.txt @@ -1,9 +1,7 @@ cmake_minimum_required(VERSION 3.13) -project(thumbnail) +project(thumbnail LANGUAGES C) add_executable(${PROJECT_NAME} cftw.c crealpath.c main.c) -add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../libweb/dynstr - ${CMAKE_BINARY_DIR}/dynstr) -target_include_directories(${PROJECT_NAME} PRIVATE ..) +target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}) target_compile_definitions(${PROJECT_NAME} PRIVATE _FILE_OFFSET_BITS=64) include(FindPkgConfig) pkg_check_modules(ImageMagick REQUIRED IMPORTED_TARGET ImageMagick) diff --git a/thumbnail/Makefile b/thumbnail/Makefile index d921e85..2d7b100 100644 --- a/thumbnail/Makefile +++ b/thumbnail/Makefile @@ -20,6 +20,9 @@ all: $(PROJECT) clean: rm -f $(OBJECTS) $(DEPS) +distclean: clean + rm -f $(PROJECT) + $(PROJECT): $(OBJECTS) $(DYNSTR) $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@ |
