appimage.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/usr/bin/env bash
  2. ########################################################################
  3. # Package the binaries built on Travis-CI as an AppImage
  4. # By Joseph Lenox 2017
  5. # For more information, see http://appimage.org/
  6. # Assumes that the results from make_archive are present.
  7. ########################################################################
  8. source $(dirname $0)/../common/util.sh
  9. set_source_dir $2
  10. set_version
  11. get_commit
  12. set_build_id
  13. set_branch
  14. set_app_name
  15. set_pr_id
  16. SCRIPTDIR=$(dirname $0)
  17. WD=${PWD}/$(dirname $0)
  18. srcfolder="$WD/${appname}"
  19. export ARCH=$(arch)
  20. APP=Slic3r
  21. LOWERAPP=${APP,,}
  22. mkdir -p $WD/${APP}.AppDir/usr/
  23. wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh
  24. . ./functions.sh
  25. cd $WD/${APP}.AppDir
  26. mkdir -p $WD/${APP}.AppDir/usr/bin
  27. # Copy primary Slic3r script here and perl-local, as well as var
  28. for i in {var,slic3r.pl,perl-local}; do
  29. cp -R $srcfolder/$i $WD/${APP}.AppDir/usr/bin/
  30. done
  31. mkdir -p ${WD}/${APP}.AppDir/usr/lib
  32. # copy Slic3r local-lib here
  33. for i in $(ls $srcfolder/bin); do
  34. install -v $srcfolder/bin/$i ${WD}/${APP}.AppDir/usr/lib
  35. done
  36. # copy other libraries needed to /usr/lib because this is an AppImage build.
  37. for i in $(cat $WD/libpaths.appimage.txt | grep -v "^#" | awk -F# '{print $1}'); do
  38. install -v $i ${WD}/${APP}.AppDir/usr/lib
  39. done
  40. # Workaround to increase compatibility with older systems; see https://github.com/darealshinji/AppImageKit-checkrt for details
  41. mkdir -p ${WD}/${APP}.AppDir/usr/optional/
  42. wget -c https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/exec-x86_64.so -O ./Slic3r.AppDir/usr/optional/exec.so
  43. mkdir -p ${WD}/${APP}.AppDir/usr/optional/libstdc++/
  44. cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ${WD}/${APP}.AppDir/usr/optional/libstdc++/
  45. mkdir -p ${WD}/${APP}.AppDir/usr/optional/libgcc/
  46. cp /lib/x86_64-linux-gnu/libgcc_s.so.1 ${WD}/${APP}.AppDir/usr/optional/libgcc/
  47. mkdir -p ${WD}/${APP}.AppDir/usr/optional/swrast_dri/
  48. cp /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so ${WD}/${APP}.AppDir/usr/optional/swrast_dri/
  49. cp -R $srcfolder/local-lib ${WD}/${APP}.AppDir/usr/lib/local-lib
  50. cp ${WD}/appimage-apprun.sh ${WD}/${APP}.AppDir/AppRun
  51. chmod +x AppRun
  52. cp ${WD}/${APP}.AppDir/usr/bin/var/Slic3r_192px.png $WD/${APP}.AppDir/${APP}.png
  53. cat > $WD/${APP}.AppDir/${APP}.desktop <<EOF
  54. [Desktop Entry]
  55. Type=Application
  56. Name=$APP
  57. Icon=$APP
  58. Exec=AppRun
  59. Categories=Graphics;
  60. X-Slic3r-Version=$SLIC3R_VERSION
  61. Comment=Prepare 3D Models for Printing
  62. EOF
  63. cd ..
  64. wget "https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
  65. chmod a+x appimagetool-x86_64.AppImage
  66. ./appimagetool-x86_64.AppImage Slic3r.AppDir
  67. # If we're on a branch, add the branch name to the app name.
  68. if [ "$current_branch" == "master" ]; then
  69. if [ ! -z ${PR_ID+x} ]; then
  70. outfile=Slic3r-${SLIC3R_BUILD_ID}-PR${PR_ID}-${1}.AppImage
  71. else
  72. outfile=Slic3r-${SLIC3R_BUILD_ID}-${1}.AppImage
  73. fi
  74. else
  75. outfile=Slic3r-${SLIC3R_BUILD_ID}-${current_branch}-${1}.AppImage
  76. fi
  77. mv Slic3r-x86_64.AppImage ${WD}/../../${outfile}