0install.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. # Script to create 0install archives
  3. ### parameter variables ###
  4. build_log=BUILD_INFO.txt # Logs included in distributed archive
  5. dbg_log=dbg.log #To debug this script, dropped sometimes
  6. echo "========= Building ========="
  7. # Get and set compilation settings
  8. ./configure --disable-debug --disable-docs --disable-profile --disable-tests > $build_log
  9. # First compile
  10. make
  11. # Copy in distribution directory (if exists)
  12. dist=./dist
  13. if [ ! -d $dist ]; then
  14. mkdir $dist
  15. fi
  16. # Archive name, _the bin emphasis the difference with source tarball
  17. id=`git describe --abbrev=10 --candidates=50 HEAD`
  18. name=oclaunch-${id}_$(arch)_bin
  19. final_binary_path=./$name/oclaunch
  20. final_binary_name=oclaunch
  21. cp ./_build/src/oclaunch.native $dist/$final_binary_name
  22. # Move BUILD_INFO
  23. mv $build_log ./$dist/
  24. cd $dist
  25. if [ ! -d $name ]; then
  26. mkdir $name
  27. fi
  28. # Put executable in it
  29. mv $final_binary_name $build_log $name
  30. tree > $dbg_log
  31. # Create archive, building the two in parallel, to speed up the process
  32. echo "========= Creating base archive ========="
  33. tar_name=${name}.tar
  34. tar -cvaf ${tar_name} $name >> $dbg_log
  35. echo "========= Creating first archive ========="
  36. coproc lzma -kf -9 ${tar_name} >> $dbg_log
  37. coproc gzip -kf -9 ${tar_name} >> $dbg_log
  38. # Create stripped archive
  39. tar_name_stripped=${name}_stripped.tar
  40. strip $final_binary_path
  41. tar -cvaf ${tar_name_stripped} $name >> $dbg_log
  42. echo "========= Creating second (stripped) archive ========="
  43. coproc lzma -kf -9 ${tar_name_stripped} >> $dbg_log
  44. coproc gzip -kf -9 ${tar_name_stripped} >> $dbg_log
  45. # Wait for the detached compression process to finish
  46. # (see lines starting with 'coproc')
  47. wait