make_archive.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/bin/bash
  2. # Assembles an installation archive from a built copy of Slic3r.
  3. # Requires PAR::Packer to be installed for the version of
  4. # perl copied.
  5. # Adapted from script written by bubnikv for Prusa3D.
  6. # Run from slic3r repo root directory.
  7. if [ "$#" -ne 1 ]; then
  8. echo "Usage: $(basename $0) arch_name"
  9. exit 1;
  10. fi
  11. WD=./$(dirname $0)
  12. source $(dirname $0)/../common/util.sh
  13. # Determine if this is a tagged (release) commit.
  14. # Change the build id accordingly.
  15. set_version
  16. get_commit
  17. set_build_id
  18. set_branch
  19. set_app_name
  20. set_pr_id
  21. # If we're on a branch, add the branch name to the app name.
  22. if [ "$current_branch" == "master" ]; then
  23. if [ ! -z ${PR_ID+x} ]; then
  24. dmgfile=slic3r-${SLIC3R_BUILD_ID}-${1}-PR${PR_ID}.tar.bz2
  25. else
  26. dmgfile=slic3r-${SLIC3R_BUILD_ID}-${1}.tar.bz2
  27. fi
  28. else
  29. dmgfile=slic3r-${SLIC3R_BUILD_ID}-${1}-${current_branch}.tar.bz2
  30. fi
  31. mkdir -p $WD
  32. # Set the application folder infomation.
  33. appfolder="$WD/${appname}"
  34. archivefolder=$appfolder
  35. resourcefolder=$appfolder
  36. echo "Appfolder: $appfolder, archivefolder: $archivefolder"
  37. # Our slic3r dir and location of perl
  38. SLIC3R_DIR="./"
  39. if [[ -d "${appfolder}" ]]; then
  40. echo "Deleting old working folder: ${appfolder}"
  41. rm -rf ${appfolder}
  42. fi
  43. if [[ -e "${dmgfile}" ]]; then
  44. echo "Deleting old archive: ${dmgfile}"
  45. rm -rf ${dmgfile}
  46. fi
  47. echo "Creating new app folder: $appfolder"
  48. mkdir -p $appfolder
  49. echo "Copying resources..."
  50. cp -rf $SLIC3R_DIR/var $resourcefolder/
  51. echo "Copying Slic3r..."
  52. cp $SLIC3R_DIR/slic3r $archivefolder/Slic3r
  53. mkdir $archivefolder/bin
  54. echo "Installing libraries to $archivefolder/bin ..."
  55. if [ -z ${WXDIR+x} ]; then
  56. for bundle in $archivefolder/Slic3r; do
  57. echo "$(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}')"
  58. for dylib in $(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}'); do
  59. install -v $dylib $archivefolder/bin
  60. done
  61. done
  62. else
  63. echo "Copying libraries from $WXDIR/lib to $archivefolder/bin"
  64. for dylib in $(find $WXDIR/lib | grep "so"); do
  65. cp -P -v $dylib $archivefolder/bin
  66. done
  67. fi
  68. echo "Copying startup script..."
  69. cp -f $WD/startup_script.sh $archivefolder/$appname
  70. chmod +x $archivefolder/$appname
  71. for i in $(cat $WD/libpaths.txt | grep -v "^#" | awk -F# '{print $1}'); do
  72. install -v $i $archivefolder/bin
  73. done
  74. tar -C$(pwd)/$(dirname $appfolder) -cjf $(pwd)/$dmgfile "$appname"