setup_install.script 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #
  2. # BlitzMax Auto deploy and installer script
  3. #
  4. # This script fetches the latest sources, generates compilable sources,
  5. # and creates a build script. The build script is essentially just a long list
  6. # of all the c->binary compilation and linkage statements.
  7. # Useful say, if you have a working OS X BlitzMax but would like to compile on Linux
  8. # but are not set up for cross compiling. Simply generate the source, zip, deploy, and
  9. # run the build script.
  10. #
  11. # An initial working BlitzMax NG installation is required to generate the compilable sources.
  12. #
  13. # Typical usage :
  14. # * Configure settings.
  15. # * Run the install script.
  16. # * Source for binaries and modules will be downloaded.
  17. # * Build scripts and source will be generated for binaries.
  18. # * Zip and install onto target system.
  19. #
  20. # MAX_PATH is the location of a working BlitzMax/bin dir
  21. # PLATFORM is your target platform, eg. raspberrypi / linux / macos
  22. # CPU is your target architecture, eg. arm / x86 / x64
  23. #
  24. MAX_PATH=/PATH/TO/WORKING/BLITZMAX_NG
  25. PLATFORM=raspberrypi
  26. CPU=arm
  27. echo "Creating installation. Please wait."
  28. mkdir bin 2>/dev/null
  29. mkdir mod 2>/dev/null
  30. mkdir src 2>/dev/null
  31. mkdir lib 2>/dev/null
  32. # download bmk / bcc
  33. cd src
  34. echo "Retrieving bcc source"
  35. svn export -q https://github.com/bmx-ng/bcc/trunk bcc
  36. echo "Retrieving bmk source"
  37. svn export -q https://github.com/bmx-ng/bmk/trunk bmk
  38. # download brl / pub modules
  39. cd ../mod
  40. echo "Retrieving pub.mod source"
  41. svn export -q https://github.com/bmx-ng/pub.mod/trunk pub.mod
  42. echo "Retrieving brl.mod source"
  43. svn export -q https://github.com/bmx-ng/brl.mod/trunk brl.mod
  44. cd ..
  45. # copy binaries
  46. cp $MAX_PATH/bin/bcc bin
  47. cp $MAX_PATH/bin/bmk bin
  48. cp $MAX_PATH/bin/core.bmk bin
  49. cp $MAX_PATH/bin/make.bmk bin
  50. cd bin
  51. # build standalone
  52. echo "Generating standalone sources."
  53. ./bmk makeapp -a -r -standalone -l $PLATFORM -g $CPU -o ../src/bcc/bcc ../src/bcc/bcc.bmx
  54. chmod +x ../src/bcc/bcc.console.release.$PLATFORM.$CPU.build
  55. ./bmk makeapp -a -r -h -standalone -l $PLATFORM -g $CPU -o ../src/bmk/bmk ../src/bmk/bmk.bmx
  56. chmod +x ../src/bmk/bmk.console.release.mt.$PLATFORM.$CPU.build
  57. cd ..
  58. echo "Generating installer."
  59. # generate installer
  60. cat <<EOF >./installer.$PLATFORM.$CPU.script
  61. echo "Building and installing $PLATFORM BlitzMax binaries for $CPU."
  62. echo "Please wait."
  63. export BMX_ROOT=\`pwd\`
  64. cd src/bcc
  65. export APP_ROOT=\`pwd\`
  66. ./bcc.console.release.$PLATFORM.$CPU.build
  67. cd ../..
  68. cd src/bmk
  69. export APP_ROOT=\`pwd\`
  70. ./bmk.console.release.mt.$PLATFORM.$CPU.build
  71. cd ../..
  72. echo "Installing bcc and bmk."
  73. cp src/bcc/bcc bin
  74. cp src/bmk/bmk bin
  75. cp src/bmk/core.bmk bin
  76. cp src/bmk/make.bmk bin
  77. cd bin
  78. echo "Building and installing doc tools."
  79. ./bmk makeapp -a -r -o ./makedocs ../src/makedocs/makedocs.bmx
  80. ./bmk makeapp -a -r -o ./docmods ../src/docmods/docmods.bmx
  81. cd ..
  82. echo ""
  83. bin/bcc -v
  84. bin/bmk -v
  85. echo "Complete."
  86. EOF
  87. chmod +x ./installer.$PLATFORM.$CPU.script
  88. # tidy up
  89. rm bin/bcc
  90. rm bin/bmk
  91. rm bin/core.bmk
  92. rm bin/make.bmk
  93. echo "Complete."