Add linux compatibility to stage scripts

This commit is contained in:
BtbN 2021-05-13 02:17:17 +02:00
parent d0f6bd727f
commit 3d21025056
39 changed files with 118 additions and 44 deletions

View file

@ -8,8 +8,6 @@ ffbuild_enabled() {
}
ffbuild_dockerbuild() {
mkdir iconv
cd iconv
wget -O iconv.tar.gz "$ICONV_SRC"
tar xaf iconv.tar.gz
rm iconv.tar.gz
@ -27,7 +25,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -23,7 +23,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -23,7 +23,7 @@ ffbuild_dockerbuild() {
if [[ $TARGET == win* ]]; then
export CC="${FFBUILD_CROSS_PREFIX}gcc"
export AR="${FFBUILD_CROSS_PREFIX}ar"
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -37,7 +37,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -25,7 +25,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -26,7 +26,7 @@ ffbuild_dockerbuild() {
myconf+=(
--cross-file=/cross.meson
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -7,9 +7,6 @@ ffbuild_enabled() {
}
ffbuild_dockerbuild() {
mkdir gmp
cd gmp
wget "$GMP_SRC" -O gmp.tar.xz
tar xaf gmp.tar.xz
rm gmp.tar.xz
@ -27,7 +24,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -24,7 +24,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -31,6 +31,10 @@ ffbuild_dockerbuild() {
--cross-compile-prefix="$FFBUILD_CROSS_PREFIX"
mingw
)
elif [[ $TARGET == linux64 ]]; then
myconf+=(
linux-x86_64
)
else
echo "Unknown target"
return -1

View file

@ -26,7 +26,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -28,7 +28,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi
@ -36,6 +36,8 @@ ffbuild_dockerbuild() {
./configure "${myconf[@]}"
make -j$(nproc)
make install
sed -i 's/Libs.private:/Libs.private: -lintl/' "$FFBUILD_PREFIX"/lib/pkgconfig/fontconfig.pc
}
ffbuild_configure() {

View file

@ -22,7 +22,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -24,7 +24,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -24,7 +24,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -31,7 +31,7 @@ ffbuild_dockerbuild() {
myconf+=(
--cross-file=/cross.meson
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -4,6 +4,9 @@ LOADER_REPO="https://github.com/KhronosGroup/Vulkan-Loader.git"
LOADER_COMMIT="7ea01c139ffc7c33cd12bd258c1bc8bf530c6d2d"
ffbuild_enabled() {
# The various graphics systems(xcb, xlib, wayland, ...) need figured out first
[[ $TARGET == linux* ]] && return -1
return 0
}

View file

@ -23,7 +23,7 @@ ffbuild_dockerbuild() {
myconf+=(
--cross-file=/cross.meson
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -26,7 +26,7 @@ ffbuild_dockerbuild() {
--host="$FFBUILD_TOOLCHAIN"
--cross-prefix="$FFBUILD_CROSS_PREFIX"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -4,6 +4,9 @@ GLSLANG_REPO="https://github.com/KhronosGroup/glslang.git"
GLSLANG_COMMIT="5878bcb17e43bf22cecaf6095900a33ff7f53445"
ffbuild_enabled() {
# Pointless without Vulkan
[[ $TARGET == linux* ]] && return -1
return 0
}

View file

@ -24,7 +24,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -31,7 +31,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -28,7 +28,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -24,7 +24,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -29,7 +29,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -32,7 +32,7 @@ ffbuild_dockerbuild() {
--target=x86-win32-gcc
)
export CROSS="$FFBUILD_CROSS_PREFIX"
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -33,7 +33,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -24,7 +24,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -30,7 +30,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -12,12 +12,20 @@ ffbuild_dockerbuild() {
git-mini-clone "$RAV1E_REPO" "$RAV1E_COMMIT" rav1e
cd rav1e
cargo cinstall \
--target="$FFBUILD_RUST_TARGET" \
local myconf=(
--prefix="$FFBUILD_PREFIX" \
--library-type=staticlib \
--crt-static \
--release
)
if [[ -n "$FFBUILD_RUST_TARGET" ]]; then
myconf+=(
--target="$FFBUILD_RUST_TARGET"
)
fi
cargo cinstall "${myconf[@]}"
}
ffbuild_configure() {

View file

@ -31,7 +31,7 @@ ffbuild_dockerbuild() {
myconf+=(
--cross-file=/cross.meson
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -27,7 +27,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -14,7 +14,13 @@ ffbuild_dockerbuild() {
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=OFF ..
if [[ $VARIANT == *shared* && $TARGET == linux* ]]; then
USE_OMP="OFF"
else
USE_OMP="ON"
fi
cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DWITH_OPENMP="$USE_OMP" -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=OFF ..
make -j$(nproc)
make install
}
@ -32,5 +38,5 @@ ffbuild_ldflags() {
}
ffbuild_libs() {
echo -lgomp
[[ $VARIANT == *shared* && $TARGET == linux* ]] || echo -lgomp
}

View file

@ -26,7 +26,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -15,7 +15,13 @@ ffbuild_dockerbuild() {
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_SHARED_LIBS=OFF ..
if [[ $VARIANT == *shared* && $TARGET == linux* ]]; then
USE_OMP="OFF"
else
USE_OMP="ON"
fi
cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_SHARED_LIBS=OFF -DUSE_OMP="$USE_OMP" ..
make -j$(nproc)
make install
}

View file

@ -26,7 +26,7 @@ ffbuild_dockerbuild() {
--host="$FFBUILD_TOOLCHAIN"
--cross-prefix="$FFBUILD_CROSS_PREFIX"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -33,7 +33,7 @@ ffbuild_dockerbuild() {
--host="$FFBUILD_TOOLCHAIN"
--cross-prefix="$FFBUILD_CROSS_PREFIX"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

View file

@ -33,7 +33,7 @@ ffbuild_dockerbuild() {
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi
@ -42,8 +42,12 @@ ffbuild_dockerbuild() {
make -j$(nproc)
make install
if [[ $TARGET == win* ]]; then
rm "$FFBUILD_PREFIX"/{bin/xvidcore.dll,lib/xvidcore.dll.a}
mv "$FFBUILD_PREFIX"/lib/{,lib}xvidcore.a
elif [[ $TARGET == linux* ]]; then
rm "$FFBUILD_PREFIX"/lib/libxvidcore.so*
fi
}
ffbuild_configure() {

View file

@ -17,13 +17,14 @@ ffbuild_dockerbuild() {
--prefix="$FFBUILD_PREFIX"
--disable-shared
--enable-static
--with-pic
)
if [[ $TARGET == win* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
elif [[ $TARGET != linux* ]]; then
echo "Unknown target"
return -1
fi

42
scripts.d/99-staticify.sh Executable file
View file

@ -0,0 +1,42 @@
#!/bin/bash
ffbuild_enabled() {
[[ $TARGET == linux* ]]
}
ffbuild_dockerfinal() {
to_df "RUN find /lib /usr/lib -maxdepth 1 -and -type l -and -name '*.so' -delete"
}
ffbuild_dockerlayer() {
return 0
}
ffbuild_dockerstage() {
return 0
}
ffbuild_dockerbuild() {
return 0
}
ffbuild_ldflags() {
if [[ $VARIANT == *shared* ]]; then
#if [[ $TARGET == *64* ]]; then
# echo "-Wl,--dynamic-linker=/lib64/ld-linux-x86-64.so.2"
#else
# echo "-Wl,--dynamic-linker=/lib/ld-linux.so.2"
#fi
return 0
else
echo "-pie -fPIE -static"
fi
}
ffbuild_configure() {
# Any dynamic executables linked against musl need its dynamic loader to run
# Thus it's impossible to build both the libraries and the programs, since
# with shared libs, the programs need to be dynamic, and in turn needs the musl
# dynamic loader at runtime.
[[ $VARIANT == *shared* ]] && echo --disable-programs
}