termux-packages/scripts/build/configure/termux_step_configure_cmake.sh

52 lines
2.0 KiB
Bash
Raw Normal View History

termux_step_configure_cmake() {
2019-08-12 22:39:35 +00:00
if [ "$TERMUX_CMAKE_BUILD" = Ninja ]; then
MAKE_PROGRAM_PATH=$(command -v ninja)
else
2019-08-12 22:39:35 +00:00
MAKE_PROGRAM_PATH=$(command -v make)
fi
BUILD_TYPE=Release
test "$TERMUX_DEBUG_BUILD" == "true" && BUILD_TYPE=Debug
CMAKE_PROC=$TERMUX_ARCH
test $CMAKE_PROC == "arm" && CMAKE_PROC='armv7-a'
local CMAKE_ADDITIONAL_ARGS=()
if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then
CXXFLAGS+=" --target=$CCTERMUX_HOST_PLATFORM"
CFLAGS+=" --target=$CCTERMUX_HOST_PLATFORM"
LDFLAGS+=" --target=$CCTERMUX_HOST_PLATFORM"
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_CROSSCOMPILING=True")
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_LINKER=$TERMUX_STANDALONE_TOOLCHAIN/bin/$LD $LDFLAGS")
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_SYSTEM_NAME=Android")
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_SYSTEM_VERSION=$TERMUX_PKG_API_LEVEL")
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_SYSTEM_PROCESSOR=$CMAKE_PROC")
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=$TERMUX_STANDALONE_TOOLCHAIN")
else
2019-08-12 22:39:35 +00:00
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_LINKER=$(command -v $LD) $LDFLAGS")
fi
# XXX: CMAKE_{AR,RANLIB} needed for at least jsoncpp build to not
# pick up cross compiled binutils tool in $TERMUX_PREFIX/bin:
cmake -G "$TERMUX_CMAKE_BUILD" "$TERMUX_PKG_SRCDIR" \
2019-08-12 22:39:35 +00:00
-DCMAKE_AR="$(command -v $AR)" \
-DCMAKE_UNAME="$(command -v uname)" \
-DCMAKE_RANLIB="$(command -v $RANLIB)" \
-DCMAKE_STRIP="$(command -v $STRIP)" \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_C_FLAGS="$CFLAGS $CPPFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS $CPPFLAGS" \
-DCMAKE_FIND_ROOT_PATH=$TERMUX_PREFIX \
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-DCMAKE_INSTALL_PREFIX=$TERMUX_PREFIX \
termux_step_configure_cmake: Revert CMAKE_INSTALL_LIBDIR old behaviour changed in 2af00064 Absolute paths are still allowed in `DCMAKE_INSTALL_LIBDIR` as per https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html Different packages have different way of handling `DCMAKE_INSTALL_LIBDIR`. The `libprotobuf` is appending an absolute path to `build` directory (#10068), while `libjpeg-turbo` is not appending a relative `lib` path to `DCMAKE_INSTALL_PREFIX` and instead appending to `build` directory and so all the lib files stay at `/home/builder/.termux-build/libjpeg-turbo/build/lib` and hence won't get added to the `deb`, which results in `openjdk-17` failing if `-i` is not passed to `build-package.sh`, since it can't find `libjpeg.so` with `-L${TERMUX_PREFIX}/lib` after compilation from source, unless `-L$TERMUX_TOPDIR/libjpeg-turbo/build/lib` is passed. Considering that most packages would likely be considering an absolute path passed in `DCMAKE_INSTALL_LIBDIR` to actually be absolute, the default behaviour should be reverted, specially considering it is what's been working, otherwise lot of packages would need testing, like from https://github.com/termux/termux-packages/commit/9155acd040. ``` checking for which libjpeg to use... system checking jpeglib.h usability... yes configure: WARNING: jpeglib.h: accepted by the compiler, rejected by the preprocessor! checking jpeglib.h presence... no checking for jpeglib.h... yes configure: WARNING: jpeglib.h: proceeding with the compiler's result configure: error: --with-libjpeg=system specified, but no libjpeg found checking for jpeg_CreateDecompress in -ljpeg... no configure exiting with result code 1 ``` ``` [0/1] Install the project... -- Install configuration: "Release" -- Installing: /home/builder/.termux-build/libjpeg-turbo/build/lib/libturbojpeg.so -- Installing: /data/data/com.termux/files/usr/bin/tjbench -- Installing: /home/builder/.termux-build/libjpeg-turbo/build/lib/libturbojpeg.a -- Installing: /data/data/com.termux/files/usr/include/turbojpeg.h -- Installing: /home/builder/.termux-build/libjpeg-turbo/build/lib/libjpeg.a -- Installing: /data/data/com.termux/files/usr/bin/rdjpgcom -- Installing: /data/data/com.termux/files/usr/bin/wrjpgcom -- Installing: /data/data/com.termux/files/usr/share/doc/libjpeg-turbo/README.ijg -- Installing: /data/data/com.termux/files/usr/share/doc/libjpeg-turbo/README.md -- Installing: /data/data/com.termux/files/usr/share/doc/libjpeg-turbo/example.txt -- Installing: /data/data/com.termux/files/usr/share/doc/libjpeg-turbo/tjexample.c -- Installing: /data/data/com.termux/files/usr/share/doc/libjpeg-turbo/libjpeg.txt -- Installing: /data/data/com.termux/files/usr/share/doc/libjpeg-turbo/structure.txt -- Installing: /data/data/com.termux/files/usr/share/doc/libjpeg-turbo/usage.txt -- Installing: /data/data/com.termux/files/usr/share/doc/libjpeg-turbo/wizard.txt -- Installing: /data/data/com.termux/files/usr/share/doc/libjpeg-turbo/LICENSE.md -- Installing: /data/data/com.termux/files/usr/share/man/man1/cjpeg.1 -- Installing: /data/data/com.termux/files/usr/share/man/man1/djpeg.1 -- Installing: /data/data/com.termux/files/usr/share/man/man1/jpegtran.1 -- Installing: /data/data/com.termux/files/usr/share/man/man1/rdjpgcom.1 -- Installing: /data/data/com.termux/files/usr/share/man/man1/wrjpgcom.1 -- Installing: /home/builder/.termux-build/libjpeg-turbo/build/lib/pkgconfig/libjpeg.pc -- Installing: /home/builder/.termux-build/libjpeg-turbo/build/lib/pkgconfig/libturbojpeg.pc -- Installing: /home/builder/.termux-build/libjpeg-turbo/build/lib/cmake/libjpeg-turbo/libjpeg-turboConfig.cmake -- Installing: /home/builder/.termux-build/libjpeg-turbo/build/lib/cmake/libjpeg-turbo/libjpeg-turboConfigVersion.cmake -- Installing: /home/builder/.termux-build/libjpeg-turbo/build/lib/cmake/libjpeg-turbo/libjpeg-turboTargets.cmake -- Installing: /home/builder/.termux-build/libjpeg-turbo/build/lib/cmake/libjpeg-turbo/libjpeg-turboTargets-release.cmake -- Installing: /data/data/com.termux/files/usr/include/jconfig.h -- Installing: /data/data/com.termux/files/usr/include/jerror.h -- Installing: /data/data/com.termux/files/usr/include/jmorecfg.h -- Installing: /data/data/com.termux/files/usr/include/jpeglib.h -- Installing: /home/builder/.termux-build/libjpeg-turbo/build/lib/libjpeg.so -- Installing: /data/data/com.termux/files/usr/bin/cjpeg -- Installing: /data/data/com.termux/files/usr/bin/djpeg -- Installing: /data/data/com.termux/files/usr/bin/jpegtran ...
2022-07-23 14:33:33 +00:00
-DCMAKE_INSTALL_LIBDIR=$TERMUX_PREFIX/lib \
-DCMAKE_MAKE_PROGRAM=$MAKE_PROGRAM_PATH \
-DCMAKE_SKIP_INSTALL_RPATH=ON \
-DCMAKE_USE_SYSTEM_LIBRARIES=True \
-DDOXYGEN_EXECUTABLE= \
-DBUILD_TESTING=OFF \
"${CMAKE_ADDITIONAL_ARGS[@]}" \
$TERMUX_PKG_EXTRA_CONFIGURE_ARGS
}