This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# build-dependencies: mono-devel subversion imagemagick | |
# build system: Ubuntu 16.04 | |
set -e | |
set -x | |
export LANG=C | |
APP="gMKVExtractGUI" | |
from_source=yes | |
mkdir ${APP}.tmp | |
cd ${APP}.tmp | |
wget -q --trust-server-names https://sourceforge.net/projects/gmkvextractgui/files/latest/download | |
ls gMKVExtractGUI.v*.7z | sed 's|gMKVExtractGUI\.v||; s|\.7z||' > VERSION | |
VERSION=$(cat VERSION) | |
MTXVER=$(wget -q -O- https://raw.githubusercontent.com/darealshinji/hybrid-debian/tools/packages.txt | grep '^mkvtoolnix' | awk '{print $2}') | |
if [ "x$from_source" = "xyes" ]; then | |
svn checkout https://svn.code.sf.net/p/gmkvextractgui/code/ gmkvextractgui-code | |
cd gmkvextractgui-code | |
VERSION="${VERSION}+rev$(svn info | sed -n 's|^Revision: ||p')" | |
echo "$VERSION" > ../VERSION | |
sed -i 's|<TargetFrameworkVersion>v4\.0<\/TargetFrameworkVersion>|<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>|g' ./*/*.csproj | |
xbuild /p:Configuration=Release gMKVExtractGUI.sln | |
mkdir ../gmkvextractgui | |
cp gMKVExtractGUI/bin/Release/*.{exe,dll} ../gmkvextractgui | |
cd ../gmkvextractgui | |
else | |
cd gmkvextractgui | |
7z e ../gMKVExtractGUI.v*.7z | |
fi | |
monopath="/usr/lib/mono/4.5" | |
need="/tmp/need.log" | |
file="gMKVExtractGUI.exe" | |
out="bundle" | |
mkdir $out | |
monodis --assemblyref "$file" | sed -n 's@^\tName=@@p' > $need | |
cp -vf "$file" $out | |
while [ -f $need ]; do | |
for a in `cat $need` ; do | |
if [ -e "${a}.dll" ]; then | |
cp -vf "${a}.dll" $out | |
elif [ -e "$monopath/${a}.dll" ]; then | |
cp -vf "$monopath/${a}.dll" $out | |
fi | |
sed -i "/^${a}$/d" $need | |
if [ -e "$out/${a}.dll" ]; then | |
deps=$(monodis --assemblyref "$out/${a}.dll" | sed -n 's@^\tName=@@p') | |
for d in $deps ; do | |
if [ ! -e "$out/${d}.dll" ] && [ "x$(grep -Fx $d $need)" = "x" ]; then | |
echo "$d" >> $need | |
fi | |
done | |
else | |
echo "Missing: ${a}.dll" | |
exit 1 | |
fi | |
sort $need | uniq > ${need}_ | |
mv -f ${need}_ $need | |
if [ "x$(wc -l <$need)" = "x0" ]; then | |
rm -f $need | |
fi | |
done | |
done | |
cd $out | |
mkdir lib | |
sed -e 's@/usr/lib/@@g' /etc/mono/config > config | |
cp -vf /usr/bin/mono-sgen . | |
cp -vf /usr/lib/libMonoPosixHelper.so lib | |
cp -vf /usr/lib/libgdiplus.so.0 lib | |
wget -q "https://raw.githubusercontent.com/AppImage/AppImages/master/functions.sh" | |
. ./functions.sh | |
copy_deps | |
move_lib | |
delete_blacklisted | |
mkdir lib | |
mv -vf `find ./usr -type f` lib | |
ln -s libgdiplus.so.0 lib/libgdiplus.so | |
rm -rvf functions.sh usr | |
wget -q "https://sourceforge.net/projects/hybrid-tools/files/x86_64-linux-gnu/mkvtoolnix/mkvtoolnix-${MTXVER}-bin.tar.xz" | |
tar xf mkvtoolnix-${MTXVER}-bin.tar.xz | |
rm -f mkvtoolnix-${MTXVER}-bin.tar.xz | |
cd ../.. | |
mkdir -p gMKVExtractGUI.AppDir/usr/bin | |
mv gmkvextractgui/$out gMKVExtractGUI.AppDir/usr/gmkvextractgui | |
cd gMKVExtractGUI.AppDir | |
cat <<EOF> ./usr/gmkvextractgui/gMKVExtractGUI.sh | |
#/bin/sh | |
cd "\$(dirname "\$(readlink -f "\$0")")" | |
LD_LIBRARY_PATH="\$PWD/lib" MONO_PATH="\$PWD" ./mono-sgen --config config gMKVExtractGUI.exe --mkvtoolnix="\$PWD" | |
EOF | |
chmod a+x ./usr/gmkvextractgui/gMKVExtractGUI.sh | |
ln -s ../gmkvextractgui/gMKVExtractGUI.sh ./usr/bin/gmkvextractgui | |
wget -q -O gMKVExtractGUI.ico 'https://sourceforge.net/p/gmkvextractgui/code/HEAD/tree/gMKVExtractGUI/Images/gMkvExtractGuiIcon.ico?format=raw' | |
convert gMKVExtractGUI.ico gMKVExtractGUI.png | |
mv gMKVExtractGUI-6.png gMKVExtractGUI.png | |
rm -f gMKVExtractGUI-?.png gMKVExtractGUI.ico | |
cat <<EOF> gmkvextractgui.desktop | |
[Desktop Entry] | |
Type=Application | |
Name=gMKVExtractGUI | |
GenericName=Matroska files extractor | |
Icon=gMKVExtractGUI | |
Categories=AudioVideo;AudioVideoEditing; | |
Exec=gmkvextractgui | |
EOF | |
get_apprun | |
cd .. | |
generate_type2_appimage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment