Use dynamic implib wrapper for all X11 libs

This commit is contained in:
BtbN 2021-12-20 17:32:39 +01:00
parent 3938a661be
commit 1fcefa4a08
18 changed files with 124 additions and 33 deletions

View file

@ -27,8 +27,11 @@ RUN \
-delete && \ -delete && \
mkdir /opt/ffbuild mkdir /opt/ffbuild
RUN git clone --filter=blob:none --depth=1 https://github.com/yugr/Implib.so /opt/implib
ADD toolchain.cmake /toolchain.cmake ADD toolchain.cmake /toolchain.cmake
ADD cross.meson /cross.meson ADD cross.meson /cross.meson
ADD gen-implib.sh /usr/bin/gen-implib
ENV PATH="/opt/ct-ng/bin:${PATH}" \ ENV PATH="/opt/ct-ng/bin:${PATH}" \
FFBUILD_TARGET_FLAGS="--pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux" \ FFBUILD_TARGET_FLAGS="--pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux" \

View file

@ -0,0 +1,17 @@
#!/bin/bash
set -e
if [[ $# != 2 ]]; then
echo "Invalid arguments"
exit 1
fi
IN="$1"
OUT="$2"
TMPDIR="$(mktemp -d)"
trap "rm -rf '$TMPDIR'" EXIT
cd "$TMPDIR"
set -x
python3 /opt/implib/implib-gen.py --target x86_64-linux-gnu --dlopen --lazy-load --verbose "$IN"
${FFBUILD_CROSS_PREFIX}gcc $CFLAGS $STAGE_CFLAGS -c *.tramp.S *.init.c
${FFBUILD_CROSS_PREFIX}ar -rcs "$OUT" *.tramp.o *.init.o

View file

@ -1,6 +1,9 @@
#!/bin/bash #!/bin/bash
set -xe set -xe
export RAW_CFLAGS="$CFLAGS"
export RAW_CXXFLAGS="$CXXFLAGS"
export RAW_LDFLAGS="$LDFLAGS"
[[ -n "$STAGE_CFLAGS" ]] && export CFLAGS="$CFLAGS $STAGE_CFLAGS" [[ -n "$STAGE_CFLAGS" ]] && export CFLAGS="$CFLAGS $STAGE_CFLAGS"
[[ -n "$STAGE_CXXFLAGS" ]] && export CXXFLAGS="$CXXFLAGS $STAGE_CXXFLAGS" [[ -n "$STAGE_CXXFLAGS" ]] && export CXXFLAGS="$CXXFLAGS $STAGE_CXXFLAGS"
[[ -n "$STAGE_LDFLAGS" ]] && export LDFLAGS="$LDFLAGS $STAGE_LDFLAGS" [[ -n "$STAGE_LDFLAGS" ]] && export LDFLAGS="$LDFLAGS $STAGE_LDFLAGS"

View file

@ -16,8 +16,8 @@ ffbuild_dockerbuild() {
local myconf=( local myconf=(
--prefix="$FFBUILD_PREFIX" --prefix="$FFBUILD_PREFIX"
--disable-shared --enable-shared
--enable-static --disable-static
--with-pic --with-pic
) )
@ -30,7 +30,12 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export CFLAGS="$RAW_CFLAGS"
export LDFLAFS="$RAW_LDFLAGS"
./configure "${myconf[@]}" ./configure "${myconf[@]}"
make -j$(nproc) make -j$(nproc)
make install make install
gen-implib "$FFBUILD_PREFIX"/lib/{libXau.so.6,libXau.a}
} }

View file

@ -16,8 +16,8 @@ ffbuild_dockerbuild() {
local myconf=( local myconf=(
--prefix="$FFBUILD_PREFIX" --prefix="$FFBUILD_PREFIX"
--disable-shared --enable-shared
--enable-static --disable-static
--with-pic --with-pic
--disable-devel-docs --disable-devel-docs
) )
@ -31,9 +31,16 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export CFLAGS="$RAW_CFLAGS"
export LDFLAFS="$RAW_LDFLAGS"
./configure "${myconf[@]}" ./configure "${myconf[@]}"
make -j$(nproc) make -j$(nproc)
make install make install
for LIBNAME in "$FFBUILD_PREFIX"/lib/libxcb*.so.?; do
gen-implib "$LIBNAME" "${LIBNAME%%.*}.a"
done
} }
ffbuild_configure() { ffbuild_configure() {

View file

@ -16,8 +16,8 @@ ffbuild_dockerbuild() {
local myconf=( local myconf=(
--prefix="$FFBUILD_PREFIX" --prefix="$FFBUILD_PREFIX"
--disable-shared --enable-shared
--enable-static --disable-static
--with-pic --with-pic
--without-xmlto --without-xmlto
--without-fop --without-fop
@ -36,9 +36,15 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export CFLAGS="$RAW_CFLAGS"
export LDFLAFS="$RAW_LDFLAGS"
./configure "${myconf[@]}" ./configure "${myconf[@]}"
make -j$(nproc) make -j$(nproc)
make install make install
echo "Libs.private: -ldl" >> "$FFBUILD_PREFIX"/lib/pkgconfig/x11.pc echo "Libs: -ldl" >> "$FFBUILD_PREFIX"/lib/pkgconfig/x11.pc
gen-implib "$FFBUILD_PREFIX"/lib/{libX11-xcb.so.1,libX11-xcb.a}
gen-implib "$FFBUILD_PREFIX"/lib/{libX11.so.6,libX11.a}
} }

View file

@ -16,8 +16,8 @@ ffbuild_dockerbuild() {
local myconf=( local myconf=(
--prefix="$FFBUILD_PREFIX" --prefix="$FFBUILD_PREFIX"
--disable-shared --enable-shared
--enable-static --disable-static
--with-pic --with-pic
--without-xmlto --without-xmlto
--without-fop --without-fop
@ -34,7 +34,12 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export CFLAGS="$RAW_CFLAGS"
export LDFLAFS="$RAW_LDFLAGS"
./configure "${myconf[@]}" ./configure "${myconf[@]}"
make -j$(nproc) make -j$(nproc)
make install make install
gen-implib "$FFBUILD_PREFIX"/lib/{libXext.so.6,libXext.a}
} }

View file

@ -16,8 +16,8 @@ ffbuild_dockerbuild() {
local myconf=( local myconf=(
--prefix="$FFBUILD_PREFIX" --prefix="$FFBUILD_PREFIX"
--disable-shared --enable-shared
--enable-static --disable-static
--with-pic --with-pic
) )
@ -30,7 +30,12 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export CFLAGS="$RAW_CFLAGS"
export LDFLAFS="$RAW_LDFLAGS"
./configure "${myconf[@]}" ./configure "${myconf[@]}"
make -j$(nproc) make -j$(nproc)
make install make install
gen-implib "$FFBUILD_PREFIX"/lib/{libXfixes.so.3,libXfixes.a}
} }

View file

@ -16,8 +16,8 @@ ffbuild_dockerbuild() {
local myconf=( local myconf=(
--prefix="$FFBUILD_PREFIX" --prefix="$FFBUILD_PREFIX"
--disable-shared --enable-shared
--enable-static --disable-static
--with-pic --with-pic
) )
@ -30,7 +30,12 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export CFLAGS="$RAW_CFLAGS"
export LDFLAFS="$RAW_LDFLAGS"
./configure "${myconf[@]}" ./configure "${myconf[@]}"
make -j$(nproc) make -j$(nproc)
make install make install
gen-implib "$FFBUILD_PREFIX"/lib/{libXi.so.6,libXi.a}
} }

View file

@ -16,8 +16,8 @@ ffbuild_dockerbuild() {
local myconf=( local myconf=(
--prefix="$FFBUILD_PREFIX" --prefix="$FFBUILD_PREFIX"
--disable-shared --enable-shared
--enable-static --disable-static
--with-pic --with-pic
) )
@ -30,7 +30,12 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export CFLAGS="$RAW_CFLAGS"
export LDFLAFS="$RAW_LDFLAGS"
./configure "${myconf[@]}" ./configure "${myconf[@]}"
make -j$(nproc) make -j$(nproc)
make install make install
gen-implib "$FFBUILD_PREFIX"/lib/{libXinerama.so.1,libXinerama.a}
} }

View file

@ -16,8 +16,8 @@ ffbuild_dockerbuild() {
local myconf=( local myconf=(
--prefix="$FFBUILD_PREFIX" --prefix="$FFBUILD_PREFIX"
--disable-shared --enable-shared
--enable-static --disable-static
--with-pic --with-pic
) )
@ -30,7 +30,12 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export CFLAGS="$RAW_CFLAGS"
export LDFLAFS="$RAW_LDFLAGS"
./configure "${myconf[@]}" ./configure "${myconf[@]}"
make -j$(nproc) make -j$(nproc)
make install make install
gen-implib "$FFBUILD_PREFIX"/lib/{libXrender.so.1,libXrender.a}
} }

View file

@ -16,8 +16,8 @@ ffbuild_dockerbuild() {
local myconf=( local myconf=(
--prefix="$FFBUILD_PREFIX" --prefix="$FFBUILD_PREFIX"
--disable-shared --enable-shared
--enable-static --disable-static
--with-pic --with-pic
) )
@ -30,7 +30,12 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export CFLAGS="$RAW_CFLAGS"
export LDFLAFS="$RAW_LDFLAGS"
./configure "${myconf[@]}" ./configure "${myconf[@]}"
make -j$(nproc) make -j$(nproc)
make install make install
gen-implib "$FFBUILD_PREFIX"/lib/{libXss.so.1,libXss.a}
} }

View file

@ -16,8 +16,8 @@ ffbuild_dockerbuild() {
local myconf=( local myconf=(
--prefix="$FFBUILD_PREFIX" --prefix="$FFBUILD_PREFIX"
--disable-shared --enable-shared
--enable-static --disable-static
--with-pic --with-pic
) )
@ -30,7 +30,12 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export CFLAGS="$RAW_CFLAGS"
export LDFLAFS="$RAW_LDFLAGS"
./configure "${myconf[@]}" ./configure "${myconf[@]}"
make -j$(nproc) make -j$(nproc)
make install make install
gen-implib "$FFBUILD_PREFIX"/lib/{libXxf86vm.so.1,libXxf86vm.a}
} }

View file

@ -36,11 +36,7 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export LDFLAGS="$LDFLAGS -lxcb -lXau"
meson "${myconf[@]}" .. meson "${myconf[@]}" ..
ninja -j"$(nproc)" ninja -j"$(nproc)"
ninja install ninja install
rm "$FFBUILD_PREFIX"/lib/lib*.so*
} }

View file

@ -16,8 +16,8 @@ ffbuild_dockerbuild() {
local myconf=( local myconf=(
--prefix="$FFBUILD_PREFIX" --prefix="$FFBUILD_PREFIX"
--disable-shared --enable-shared
--enable-static --disable-static
--with-pic --with-pic
) )
@ -30,7 +30,12 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export CFLAGS="$RAW_CFLAGS"
export LDFLAFS="$RAW_LDFLAGS"
./configure "${myconf[@]}" ./configure "${myconf[@]}"
make -j$(nproc) make -j$(nproc) VERBOSE=1
make install make install
gen-implib "$FFBUILD_PREFIX"/lib/{libXcursor.so.1,libXcursor.a}
} }

View file

@ -16,8 +16,8 @@ ffbuild_dockerbuild() {
local myconf=( local myconf=(
--prefix="$FFBUILD_PREFIX" --prefix="$FFBUILD_PREFIX"
--disable-shared --enable-shared
--enable-static --disable-static
--with-pic --with-pic
) )
@ -30,7 +30,12 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export CFLAGS="$RAW_CFLAGS"
export LDFLAFS="$RAW_LDFLAGS"
./configure "${myconf[@]}" ./configure "${myconf[@]}"
make -j$(nproc) make -j$(nproc)
make install make install
gen-implib "$FFBUILD_PREFIX"/lib/{libXrandr.so.2,libXrandr.a}
} }

View file

@ -17,8 +17,8 @@ ffbuild_dockerbuild() {
local myconf=( local myconf=(
--prefix="$FFBUILD_PREFIX" --prefix="$FFBUILD_PREFIX"
--disable-shared --enable-shared
--enable-static --disable-static
--with-pic --with-pic
--without-lint --without-lint
) )
@ -32,9 +32,14 @@ ffbuild_dockerbuild() {
return -1 return -1
fi fi
export CFLAGS="$RAW_CFLAGS"
export LDFLAFS="$RAW_LDFLAGS"
./configure "${myconf[@]}" ./configure "${myconf[@]}"
make -j$(nproc) make -j$(nproc)
make install make install
gen-implib "$FFBUILD_PREFIX"/lib/{libXv.so.1,libXv.a}
} }
ffbuild_configure() { ffbuild_configure() {

View file

@ -11,5 +11,9 @@ ffbuild_dockerlayer() {
} }
ffbuild_dockerbuild() { ffbuild_dockerbuild() {
true rm "$FFBUILD_PREFIX"/lib/lib*.so*
}
ffbuild_libs() {
echo -ldl
} }