msys_helper.sh 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. #!/bin/bash
  2. # Git repo information
  3. fork="lmms" # i.e. "lmms" or "tobydox"
  4. branch="master" # i.e. "master" or "stable-1.2"
  5. # Console colors
  6. red="\\x1B[1;31m"
  7. green="\\x1B[1;32m"
  8. yellow="\\x1B[1;33m"
  9. plain="\\x1B[0m"
  10. function info() { echo -e "\n${green}$1${plain}"; }
  11. function warn() { echo -e "\n${yellow}$1${plain}"; }
  12. function err() { echo -e "\n${red}$1${plain}"; exit 1;}
  13. info "Checking for mingw environment"
  14. env |grep MINGW
  15. if [ $? -ne 0 ]; then
  16. err " - Failed. Please relaunch using MinGW shell"
  17. fi
  18. info "Preparing the git directory..."
  19. mkdir $HOME/.git; touch $HOME/.git/config > /dev/null &2>1
  20. git config --global http.sslverify false
  21. info "Cloning the repository..."
  22. if [ -d ./lmms ]; then
  23. warn " - Skipping, ./lmms already exists"
  24. else
  25. git clone -b $branch https://github.com/$fork/lmms.git
  26. fi
  27. info "Fetching ppa using cmake/msys/fetch_ppas.sh..."
  28. if [ -d $HOME/ppa ]; then
  29. warn " - Skipping, $HOME/ppa already exists"
  30. else
  31. ./lmms/cmake/msys/fetch_ppa.sh
  32. fi
  33. info "Extracting debs to $HOME/ppa/opt/, etc..."
  34. if [ -d $HOME/ppa/opt ]; then
  35. warn " - Skipping, $HOME/ppa/opt already exists"
  36. else
  37. ./lmms/cmake/msys/extract_debs.sh
  38. fi
  39. info "Preparing library merge, making all qt headers writable..."
  40. chmod u+w /mingw64/include/qt4 -R
  41. chmod u+w /mingw32/include/qt4 -R
  42. info "Merging mingw headers and libraries from ppa over existing system libraries..."
  43. find /mingw64 |grep sndfile.h
  44. if [ $? -ne 0 ]; then
  45. \cp -r $HOME/ppa/opt/mingw* /
  46. else
  47. warn " - Skipping, sndfile.h has already been merged"
  48. fi
  49. fltkver="1.3.3"
  50. oggver="1.3.2"
  51. vorbisver="1.3.5"
  52. flacver="1.3.2"
  53. gigver="4.0.0"
  54. stkver="4.5.1"
  55. info "Downloading and building fltk $fltkver"
  56. mingw_root="/$(echo $MSYSTEM|tr '[:upper:]' '[:lower:]')"
  57. which fluid
  58. if [ $? -ne 0 ]; then
  59. wget http://fltk.org/pub/fltk/$fltkver/fltk-$fltkver-source.tar.gz -O $HOME/fltk-source.tar.gz
  60. if [ $? -ne 0 ]; then
  61. err "ERROR: Could not download fltk. Exiting."
  62. fi
  63. tar zxf $HOME/fltk-source.tar.gz -C $HOME/
  64. pushd $HOME/fltk-$fltkver
  65. info " - Compiling fltk $fltkver..."
  66. ./configure --prefix=$mingw_root --enable-shared
  67. make
  68. info " - Installing fltk..."
  69. make install
  70. if [ $? -ne 0 ]; then
  71. err "ERROR: Could not build/install fltk -- Zyn needs this. Exiting."
  72. fi
  73. # ln -s $mingw_root/usr/local/bin/fluid.exe $mingw_root/bin/fluid.exe
  74. popd
  75. else
  76. warn " - Skipping, fluid binary already exists"
  77. fi
  78. info "Downloading and building libogg $oggver"
  79. if [ ! -e $mingw_root/lib/libogg.dll.a ]; then
  80. wget http://downloads.xiph.org/releases/ogg/libogg-$oggver.tar.xz -O $HOME/libogg-source.tar.xz
  81. if [ $? -ne 0 ]; then
  82. err "ERROR: Could not download libogg. Exiting."
  83. fi
  84. tar xf $HOME/libogg-source.tar.xz -C $HOME/
  85. pushd $HOME/libogg-$oggver
  86. info " - Compiling libogg $oggver..."
  87. ./configure --prefix=$mingw_root
  88. make
  89. info " - Installing libogg..."
  90. make install
  91. # for some reason libgig needs this
  92. ./configure --prefix=/opt$mingw_root
  93. make
  94. info " - Installing libogg..."
  95. make install
  96. if [ $? -ne 0 ]; then
  97. err "ERROR: Could not build/install fltk -- lmms needs this. Exiting."
  98. fi
  99. popd
  100. else
  101. warn " - Skipping, libogg binary already exists"
  102. fi
  103. info "Downloading and building libvorbis $vorbisver"
  104. if [ ! -e $mingw_root/lib/libvorbis.dll.a ]; then
  105. wget http://downloads.xiph.org/releases/vorbis/libvorbis-$vorbisver.tar.xz -O $HOME/libvorbis-source.tar.xz
  106. if [ $? -ne 0 ]; then
  107. err "ERROR: Could not download libogg. Exiting."
  108. fi
  109. tar xf $HOME/libvorbis-source.tar.xz -C $HOME/
  110. pushd $HOME/libvorbis-$vorbisver
  111. info " - Compiling libvorbis $vorbisver..."
  112. ./configure --prefix=$mingw_root
  113. make
  114. info " - Installing libvorbis..."
  115. make install
  116. # for some reason libgig needs this
  117. ./configure --prefix=/opt$mingw_root
  118. make
  119. info " - Installing libvorbis..."
  120. make install
  121. if [ $? -ne 0 ]; then
  122. err "ERROR: Could not build/install libvorbis -- lmms needs this. Exiting."
  123. fi
  124. popd
  125. else
  126. warn " - Skipping, libvorbis binary already exists"
  127. fi
  128. info "Downloading and building flac $flacver"
  129. if [ ! -e $mingw_root/lib/libFLAC.dll.a ]; then
  130. wget http://downloads.xiph.org/releases/flac/flac-$flacver.tar.xz -O $HOME/flac-source.tar.xz
  131. if [ $? -ne 0 ]; then
  132. err "ERROR: Could not download flac. Exiting."
  133. fi
  134. tar xf $HOME/flac-source.tar.xz -C $HOME/
  135. pushd $HOME/flac-$flacver
  136. info " - Compiling flac $flacver..."
  137. ./configure --prefix=$mingw_root
  138. make
  139. info " - Installing flac..."
  140. make install
  141. # for some reason libgig needs this
  142. ./configure --prefix=/opt$mingw_root
  143. make
  144. info " - Installing flac..."
  145. make install
  146. if [ $? -ne 0 ]; then
  147. err "ERROR: Could not build/install flac -- lmms needs this. Exiting."
  148. fi
  149. popd
  150. else
  151. warn " - Skipping, libvorbis flac already exists"
  152. fi
  153. info "Downloading and building libgig $gigver"
  154. if [ ! -e $mingw_root/lib/libgig/libgig.dll.a ]; then
  155. wget http://download.linuxsampler.org/packages/libgig-$gigver.tar.bz2 -O $HOME/gig-source.tar.xz
  156. if [ $? -ne 0 ]; then
  157. err "ERROR: Could not download libgig. Exiting."
  158. fi
  159. tar xf $HOME/gig-source.tar.xz -C $HOME/
  160. pushd $HOME/libgig-$gigver
  161. info " - Compiling libgig $gigver..."
  162. ./configure --prefix=$mingw_root
  163. make
  164. info " - Installing libgig..."
  165. make install
  166. mv $mingw_root/lib/bin/libakai-0.dll $mingw_root/bin
  167. mv $mingw_root/lib/bin/libgig-7.dll $mingw_root/bin
  168. if [ $? -ne 0 ]; then
  169. err "ERROR: Could not build/install libgig -- gigplayer needs this. Exiting."
  170. fi
  171. popd
  172. else
  173. warn " - Skipping, libgig binary already exists"
  174. fi
  175. info "Downloading and building stk $stkver"
  176. if [ ! -e $mingw_root/lib/libstk.dll ]; then
  177. wget http://ccrma.stanford.edu/software/stk/release/stk-$stkver.tar.gz -O $HOME/stk-source.tar.xz
  178. if [ $? -ne 0 ]; then
  179. err "ERROR: Could not download stk. Exiting."
  180. fi
  181. tar xf $HOME/stk-source.tar.xz -C $HOME/
  182. pushd $HOME/stk-$stkver
  183. info " - Compiling stk $stkver..."
  184. ./configure --prefix=$mingw_root
  185. make
  186. info " - Installing stk..."
  187. make install
  188. if [ $? -ne 0 ]; then
  189. err "ERROR: Could not build/install stk -- mallotstk needs this. Exiting."
  190. fi
  191. mv $mingw_root/lib/libstk.so $mingw_root/lib/libstk.dll
  192. mv $mingw_root/lib/libstk-$stkver.so $mingw_root/lib/libstk-$stkver.dll
  193. popd
  194. else
  195. warn " - Skipping, stk binary already exists"
  196. fi
  197. # make a symlink to make cmake happy
  198. if [ $mingw_root = "/mingw64" ]; then
  199. if [ ! -e /opt/mingw64/bin/x86_64-w64-mingw32-pkg-config ]; then
  200. ln -s /usr/bin/pkg-config /opt/mingw64/bin/x86_64-w64-mingw32-pkg-config
  201. fi
  202. fi
  203. if [ $mingw_root = "/mingw32" ]; then
  204. if [ ! -e /opt/mingw32/bin/i686-w64-mingw32-pkg-config ]; then
  205. ln -s /usr/bin/pkg-config /opt/mingw32/bin/i686-w64-mingw32-pkg-config
  206. fi
  207. fi
  208. info "Cleaning up..."
  209. rm -rf $HOME/fltk-$fltkver
  210. rm -rf $HOME/libogg-$oggver
  211. rm -rf $HOME/libvorbis-$vorbisver
  212. rm -rf $HOME/flac-$flacver
  213. rm -rf $HOME/libgig-$gigver
  214. rm -rf $HOME/stk-$stkver
  215. info "Done."