100 lines
3.2 KiB
Bash
Executable File
100 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
export XBPS_ARCH=${1:-armv7l}
|
|
void_repository=https://alpha.us.repo.voidlinux.org/
|
|
|
|
set -eo pipefail
|
|
command -v curl tar zstd xz 7z zcat sudo rsync
|
|
if [ ! -f external/freshplayerplugin/CMakeLists.txt ] || [ ! -f external/nspluginwrapper/configure ] ; then
|
|
echo "Missing build files for freshplayerplugin and/or nspluginwrapper."
|
|
echo "Do you need to run git submodule update --init --recursive ?"
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p workdir
|
|
cd workdir
|
|
|
|
if [ ! -x usr/bin/xbps-install.static ] ; then
|
|
mkdir -p etc/xbps.d
|
|
cat > etc/xbps.d/00-repository-main.conf <<EOF
|
|
repository=$void_repository/current
|
|
ignorepkg=rpi-userland
|
|
EOF
|
|
curl $void_repository/static/xbps-static-latest.$XBPS_ARCH-musl.tar.xz | tar xJ
|
|
fi
|
|
|
|
if [ ! -f ../dist/lib/plugins/libpepflashplayer.so ] ; then
|
|
chromeos_url=`curl https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.conf | grep -o 'https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_.*_elm_recovery_stable-channel_mp-v2.bin.zip'`
|
|
curl "$chromeos_url" | zcat > chromeos.bin
|
|
7z e chromeos.bin ROOT-A.img -y
|
|
test -f ROOT-A.img
|
|
rm chromeos.bin
|
|
7z e ROOT-A.img libpepflashplayer.so -r -y
|
|
test -f libpepflashplayer.so
|
|
rm ROOT-A.img
|
|
mkdir -p ../dist/lib/plugins
|
|
mv libpepflashplayer.so ../dist/lib/plugins/
|
|
fi
|
|
|
|
if [ ! -f ../dist/lib/alsa-lib/libasound_module_pcm_pulse.so ] ; then
|
|
cat ../pkglist | xargs usr/bin/xbps-install.static -r $PWD -SDy
|
|
|
|
set +e
|
|
for i in var/cache/xbps/*.xbps; do
|
|
tar --wildcards -xf $i ./usr/lib/\* 2>/dev/null
|
|
done
|
|
set -e
|
|
tar --wildcards -xf var/cache/xbps/bc-*.xbps ./usr/bin/\*bc
|
|
|
|
mkdir -p ../dist/lib/alsa-lib ../dist/bin
|
|
cp usr/bin/*bc ../dist/bin/bc
|
|
cp usr/lib/lib*.so.* ../dist/lib/
|
|
rm ../dist/lib/lib*.so.*.*
|
|
cp usr/lib/ld-linux-armhf.so.3 ../dist/lib/
|
|
cp usr/lib/pulseaudio/libpulsecommon-*.so ../dist/lib/
|
|
cp usr/lib/alsa-lib/libasound_module_pcm_pulse.so ../dist/lib/alsa-lib/
|
|
chmod -x ../dist/lib/lib* ../dist/lib/alsa-lib/libasound_module_pcm_pulse.so
|
|
fi
|
|
|
|
if [ ! -x /lib/ld-linux-armhf.so.3 ] ; then
|
|
echo "/lib/ld-linux-armhf.so.3 not found, installing..."
|
|
sudo cp -v ../dist/lib/ld-linux-armhf.so.3 /lib/
|
|
fi
|
|
|
|
if [ ! -x ../dist/bin/npplayer ] ; then
|
|
cat ../devpkglist | xargs usr/bin/xbps-install.static -r $PWD -Sy
|
|
ln -sf usr/lib .
|
|
ln -sf usr/bin .
|
|
mkdir -p src tmp dev
|
|
touch dev/null
|
|
cp -al ../external/* src/
|
|
|
|
cat > inner-build.sh <<EOF
|
|
#!/usr/bin/bash
|
|
set -e
|
|
cd /src/freshplayerplugin
|
|
cmake -B_build -H. -DWITH_GLES2=TRUE -DWITH_{HWDEC,JACK,PULSEAUDIO,LIBV4L2}=FALSE
|
|
make -C_build -j`nproc`
|
|
cd /src/nspluginwrapper
|
|
linux32 ./configure --target-cpu=arm
|
|
make -j`nproc` npplayer
|
|
EOF
|
|
chmod +x inner-build.sh
|
|
userspec="$USER:$(id -gn)"
|
|
sudo -n true || echo "need sudo to chroot for the compile..."
|
|
set -x
|
|
sudo mount -o bind /dev/null dev/null
|
|
cleanup() {
|
|
sudo umount dev/null
|
|
}
|
|
trap cleanup EXIT
|
|
sudo chroot --userspec=$userspec . /inner-build.sh
|
|
set +x
|
|
|
|
cp src/freshplayerplugin/_build/libfreshwrapper-flashplayer.so ../dist/lib/plugins/
|
|
chmod -x ../dist/lib/plugins/libfreshwrapper-flashplayer.so
|
|
cp src/nspluginwrapper/npplayer ../dist/bin/
|
|
fi
|
|
|
|
rsync -av ../sourcefiles/ ../dist
|