Is there a argument to meson setup
to not link with system library?
#14654
-
I'm trying to build freetype by using autotools (freetype does support meson, but forget this detail, I just want to learn). freetype has harfbuzz has a dependency (which use meson). I tried to use this bash file to build both of them: #!/bin/bash
# If an error occurs, stop the script
set -eu
# Base directory (where the script is located)
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Build directory
mkdir -p "build"
BUILD_DIR="$SCRIPT_DIR/build"
# Function to build HarfBuzz library
build_harfbuzz() {
echo "Building HarfBuzz..."
cd "$BUILD_DIR"
if [ ! -d harfbuzz-11.0.0 ]; then
wget -O harfbuzz-11.0.0.tar.xz https://github.com/harfbuzz/harfbuzz/releases/download/11.0.0/harfbuzz-11.0.0.tar.xz
tar -xf harfbuzz-11.0.0.tar.xz
fi
cd harfbuzz-11.0.0
meson setup build \
--prefix=/usr/local \
--buildtype=release \
--default-library=static \
--wrap-mode=nodownload \
-Dtests=disabled \
-Ddocs=disabled
ninja -C build
DESTDIR="$ABS_BUILD_PATH" ninja -C build install
#rm -rf build
cd "$BUILD_DIR"
rm -f harfbuzz-11.0.0.tar.xz
}
# Function to build FreeType library
build_freetype() {
echo "Building FreeType..."
cd "$BUILD_DIR"
if [ ! -d freetype-2.13.3 ]; then
wget -O freetype-2.13.3.tar.xz https://downloads.sourceforge.net/freetype/freetype-2.13.3.tar.xz
tar -xf freetype-2.13.3.tar.xz
fi
cd freetype-2.13.3
./autogen.sh
./configure --enable-static \
--disable-shared \
--with-pic \
--with-harfbuzz=yes \
--with-zlib=no
make -j$(nproc)
make DESTDIR="$ABS_BUILD_PATH" install
make distclean
cd "$BUILD_DIR"
rm -f freetype-2.13.3.tar.xz
}
# Function to build freetype and its dependencies
main() {
local build_path="$BUILD_DIR/test"
ABS_BUILD_PATH=$(realpath "$build_path")
# PKG_CONFIG configuration
export PKG_CONFIG_PATH=$ABS_BUILD_PATH
export PKG_CONFIG_LIBDIR="$ABS_BUILD_PATH/usr/local/lib/pkgconfig"
echo "--------------------------------------------------------------"
build_harfbuzz
echo "--------------------------------------------------------------"
build_freetype
}
main The problem is that harfbuzz tries to use my system libraries, so it link it with the system freetype and icu (i don't want it to link to them). I know it link it self to system libraries because I used [{"name": "Freetype", "type": "cmake", "version": "2.13.3", "compile_args": ["-I/usr/include/freetype2"], "link_args": ["/usr/lib/x86_64-linux-gnu/libfreetype.so"], "include_directories": [], "sources": [], "extra_files": [], "dependencies": [], "depends": [], "meson_variables": ["freetype_dep", "check_deps"]}, {"name": "ICU", "type": "cmake", "version": "75.1", "compile_args": ["-I/usr/include"], "link_args": ["/usr/lib/x86_64-linux-gnu/libicuuc.so"], "include_directories": [], "sources": [], "extra_files": [], "dependencies": [], "depends": [], "meson_variables": ["icu_dep"]}, {"name": "threads", "type": "system", "version": "unknown", "compile_args": ["-pthread"], "link_args": ["-pthread"], "include_directories": [], "sources": [], "extra_files": [], "dependencies": [], "depends": [], "meson_variables": ["thread_dep"]}, {"name": "m", "type": "library", "version": "unknown", "compile_args": [], "link_args": ["-lm"], "include_directories": [], "sources": [], "extra_files": [], "dependencies": [], "depends": [], "meson_variables": ["m_dep"]}, {"name": "dep136945822507872", "type": "internal", "version": "11.0.0", "compile_args": [], "link_args": [], "include_directories": ["/home/moi15moi/Documents/GitHub/pylibass/build/harfbuzz-11.0.0/src/.", "/home/moi15moi/Documents/GitHub/pylibass/build/harfbuzz-11.0.0/build/src/."], "sources": [], "extra_files": [], "dependencies": ["threads", "m", "Freetype"], "depends": ["25a6634@@harfbuzz@sta"], "meson_variables": ["libharfbuzz_dep"]}, {"name": "dep136945818922224", "type": "internal", "version": "11.0.0", "compile_args": [], "link_args": [], "include_directories": ["/home/moi15moi/Documents/GitHub/pylibass/build/harfbuzz-11.0.0/src/.", "/home/moi15moi/Documents/GitHub/pylibass/build/harfbuzz-11.0.0/build/src/."], "sources": [], "extra_files": [], "dependencies": ["m"], "depends": ["25a6634@@harfbuzz-subset@sta"], "meson_variables": ["libharfbuzz_subset_dep"]}, {"name": "dep136945819071024", "type": "internal", "version": "11.0.0", "compile_args": [], "link_args": [], "include_directories": ["/home/moi15moi/Documents/GitHub/pylibass/build/harfbuzz-11.0.0/src/.", "/home/moi15moi/Documents/GitHub/pylibass/build/harfbuzz-11.0.0/build/src/."], "sources": [], "extra_files": [], "dependencies": ["ICU"], "depends": ["25a6634@@harfbuzz-icu@sta"], "meson_variables": ["libharfbuzz_icu_dep"]}] Is there a way, without specifying the dependency manually (ex: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Since you built harfbuzz first, there is no freetype in your PKG_CONFIG_PATH to find. |
Beta Was this translation helpful? Give feedback.
-
Notice that it is reporting it is a "cmake" type dependency. Harfbuzz has logic to find freetype using meson's The reliable and expected way to totally disable a feature is indeed to pass the setup option to do so. Just changing the dependency search path, is a good way to force a specific version to be found -- but not very good at forcing it to be marked as missing. There are, broadly speaking, four different ways to locate a dependency:
You may be able to cripple the second of these, by exporting |
Beta Was this translation helpful? Give feedback.
Notice that it is reporting it is a "cmake" type dependency. Harfbuzz has logic to find freetype using meson's
FindXXX.cmake
support, and this is being autodetected as a fallback even if you modify the pkg-config search path so that meson tries and fails to find it using pkg-config.The reliable and expected way to totally disable a feature is indeed to pass the setup option to do so. Just changing the dependency search path, is a good way to force a specific version to be found -- but not very good at forcing it to be marked as missing.
There are, broadly speaking, four different ways to locate a dependency: