Add Linux related build scripts

including following changes:
- Linux build scripts from SuperSlicer project;
- Update BuildLinux dev dependencies, remove unused bits;
- Update BuildLinuxImage to use nproc for cpus;
- CMake: render BuildLinuxImage and build_appimage templates;
- Fix "DSO missing" linking problems;
- Add Podman Containerfile for building;
- Update BuildLinux.sh to work better in container build;
- fixes to create AppImage inside container;
- add env to build environment;
- Update build instructions in Containerfile;

Change-Id: I73e30ab488cda8c1b0886cd34858e125596f282b
(cherry picked from commit 83fc26670ca592c91c7af1d4033a04b587cfd4cd)
This commit is contained in:
DeftDawg 2022-08-12 23:57:54 -04:00 committed by Lane.Wei
parent 014152f078
commit f5a4862da5
7 changed files with 376 additions and 0 deletions

View file

@ -0,0 +1,57 @@
#!/bin/bash
export ROOT=$(echo $ROOT | grep . || pwd)
export NCORES=`nproc --all`
while getopts ":ih" opt; do
case ${opt} in
i )
export BUILD_IMAGE="1"
;;
h ) echo "Usage: ./BuildLinuxImage.sh [-i]"
echo " -i: Generate Appimage (optional)"
exit 0
;;
esac
done
echo -n "[9/9] Generating Linux app..."
#{
# create directory and copy into it
if [ -d "package" ]
then
rm -rf package/*
rm -rf package/.* 2&>/dev/null
else
mkdir package
fi
mkdir package/bin
# copy Resources
cp -Rf ../resources package/resources
cp -f src/@SLIC3R_APP_CMD@ package/bin/@SLIC3R_APP_CMD@
# remove unneeded po from resources
## find package/resources/localization -name "*.po" -type f -delete ## FIXME: DD - do we need this?
# create bin
echo -e '#!/bin/bash\nDIR=$(readlink -f "$0" | xargs dirname)\nexport LD_LIBRARY_PATH="$DIR/bin"\nexec "$DIR/bin/@SLIC3R_APP_CMD@" "$@"' >@SLIC3R_APP_CMD@
chmod ug+x @SLIC3R_APP_CMD@
cp -f @SLIC3R_APP_CMD@ package/@SLIC3R_APP_CMD@
pushd package
tar -cvf ../@SLIC3R_APP_KEY@.tar . &>/dev/null
popd
#} &> $ROOT/Build.log # Capture all command output
echo "done"
if [[ -n "$BUILD_IMAGE" ]]
then
echo -n "Creating Appimage for distribution..."
#{
pushd package
chmod +x ../build_appimage.sh
../build_appimage.sh
popd
mv package/"@SLIC3R_APP_KEY@_ubu64.AppImage" "@SLIC3R_APP_KEY@_ubu64.AppImage"
#} &> $ROOT/Build.log # Capture all command output
echo "done"
fi

View file

@ -0,0 +1,30 @@
#!/bin/sh
APPIMAGETOOLURL="https://github.com/AppImage/AppImageKit/releases/latest/download/appimagetool-x86_64.AppImage"
APP_IMAGE="@SLIC3R_APP_KEY@_ubu64.AppImage"
wget ${APPIMAGETOOLURL} -O ../appimagetool.AppImage
chmod +x ../appimagetool.AppImage
sed -i -e 's#/usr#././#g' bin/@SLIC3R_APP_CMD@
mv @SLIC3R_APP_CMD@ AppRun
chmod +x AppRun
cp resources/images/@SLIC3R_APP_KEY@_192px.png @SLIC3R_APP_KEY@.png
mkdir -p usr/share/icons/hicolor/192x192/apps
cp resources/images/@SLIC3R_APP_KEY@_192px.png usr/share/icons/hicolor/192x192/apps/@SLIC3R_APP_KEY@.png
cat <<EOF > @SLIC3R_APP_KEY@.desktop
[Desktop Entry]
Name=@SLIC3R_APP_KEY@
Exec=AppRun %F
Icon=@SLIC3R_APP_KEY@
Type=Application
Categories=Utility;
MimeType=model/stl;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;application/x-amf;
EOF
../appimagetool.AppImage . $([ ! -z "${container}" ] && echo '--appimage-extract-and-run')
mv @SLIC3R_APP_KEY@-x86_64.AppImage ${APP_IMAGE}
chmod +x ${APP_IMAGE}