synfigstudio-linux-build.sh 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376
  1. #!/bin/bash
  2. #
  3. # SynfigStudio build script
  4. # Copyright (c) 2008-2010 Konstantin Dmitriev
  5. #
  6. # This package is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License as
  8. # published by the Free Software Foundation; either version 2 of
  9. # the License, or (at your option) any later version.
  10. #
  11. # This package is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. # General Public License for more details.
  15. # = Usage: =
  16. # ./synfigstudio-linux-build.sh [mode] [revision]
  17. #
  18. # where:
  19. # - [mode] is full|quick|package
  20. # - [revision] - commit id, branch or tag (package mode only)
  21. #
  22. # To build packages it's required to run this script as root.
  23. #
  24. # = Examples: =
  25. #
  26. # == Standart mode ==
  27. # Configure and (re)build synfigstudio into your homedir:
  28. # ./synfigstudio-linux-build.sh
  29. # Configure and make clean build synfigstudio into your homedir:
  30. # ./synfigstudio-linux-build.sh full
  31. # Quick rebuild of synfig (without configure) into your homedir:
  32. # ./synfigstudio-linux-build.sh quick
  33. #
  34. # == Package mode ==
  35. # Build package from "master" branch:
  36. # ./synfigstudio-linux-build.sh package
  37. # Build package from "genete_setup_dialog" branch
  38. # ./synfigstudio-linux-build.sh package origin/genete_setup_dialog
  39. # Build package from commit with "synfigstudio-0.62.00" tag
  40. # ./synfigstudio-linux-build.sh package synfigstudio-0.62.00
  41. #
  42. # Note: Make sure to run "git clean -f -x -d" after you switch branches.
  43. #
  44. # = TODO =
  45. # - debuginfo packages
  46. RELEASE=8
  47. if [ -z "$PREFIX" ]; then
  48. PREFIX=$HOME/synfig/
  49. fi
  50. PACKAGES_PATH=$HOME/synfig-packages # path where to write packages files
  51. if [ -z $BUILDROOT ]; then
  52. PACKAGES_BUILDROOT=$HOME/synfig-buildroot # path of for build infrastructure
  53. else
  54. PACKAGES_BUILDROOT=$BUILDROOT/synfig-buildroot
  55. fi
  56. if [ -d "$PACKAGES_BUILDROOT" ]; then
  57. PACKAGES_BUILDROOT=`cd $PACKAGES_BUILDROOT; pwd` # canonify buildroot path
  58. fi
  59. BUILDROOT_VERSION=9
  60. BUILDROOT_LIBRARY_SET_ID=4
  61. MAKE_THREADS=2 #count of threads for make
  62. # full = clean, configure, make
  63. # standart = configure, make
  64. # quick = make
  65. # package = chroot, clean, configure, make
  66. MODE='standart'
  67. OPENGL=0
  68. BREED=
  69. if [ -z $DEBUG ]; then
  70. export DEBUG=0
  71. fi
  72. export EMAIL='root@synfig.org'
  73. # Bundled libraries
  74. LIBSIGCPP=2.2.10
  75. GLEW=1.5.1
  76. CAIROMM=1.8.0
  77. IMAGEMAGICK=6.8.6
  78. PANGOMM=2.26.3 # required by GTKMM 2.20.3
  79. GTKMM=3.0.0 # !!! we need Notebook.set_action_widget()
  80. FTGL=2.1.2
  81. FREEGLUT=2.4.0
  82. GTKGLEXT=1.2.0
  83. GTKGLEXTMM=1.2.0
  84. LIBXMLPP=2.22.0
  85. GLIBMM=2.24.2 # required by GTKMM 2.20.3
  86. CAIRO=1.12.0 # required by the cairo render engine 2013-04-01
  87. BOOST=1_53_0
  88. # System libraries
  89. ATK=1.29.4 # required by GTK 2.20.1
  90. GLIB=2.24.2 # required by GLIBMM 2.24.2
  91. GTK=3.0.0 # !!! we need Notebook.set_action_widget()
  92. PIXMAN=0.22.0 # required by CAIRO 1.12.0
  93. PANGO=1.24.5
  94. FONTCONFIG=2.5.0
  95. JACK=0.124.1
  96. GITVERSION=1.7.0 # git version for chroot environment
  97. SYNFIG_REPO_DIR=''
  98. WORKDIR_IS_REPO=0
  99. # Allow overriding PREFIX and/or BREED
  100. if [ -f "./synfigstudio-build.conf" ] ; then
  101. . "./synfigstudio-build.conf"
  102. fi
  103. set -e
  104. if (test "$2"); then
  105. SELECTEDREVISION=$2
  106. else
  107. SELECTEDREVISION=origin/master
  108. fi
  109. mklibsigcpp()
  110. {
  111. if ! pkg-config sigc\+\+-2.0 --exact-version=${LIBSIGCPP} --print-errors; then
  112. pushd /source
  113. wget -c --no-check-certificate http://ftp.gnome.org/pub/GNOME/sources/libsigc++/${LIBSIGCPP%.*}/libsigc++-${LIBSIGCPP}.tar.bz2
  114. [ ! -d libsigc++-${LIBSIGCPP} ] && tar -xjf libsigc++-${LIBSIGCPP}.tar.bz2 #&& cd libsigc++-${LIBSIGCPP} && patch -p1 < ../libsigc++-2.0_2.0.18-2.diff && cd ..
  115. cd libsigc++-${LIBSIGCPP}
  116. #make clean || true
  117. ./configure --prefix=${PREFIX}/ --includedir=${PREFIX}/include --disable-static --enable-shared
  118. make -j$MAKE_THREADS
  119. make install
  120. cd ..
  121. popd
  122. fi
  123. }
  124. mkglib()
  125. {
  126. if ! pkg-config glib-2.0 --exact-version=${GLIB} --print-errors; then
  127. pushd /source
  128. [ ! -d glib-${GLIB} ] && tar -xjf glib-${GLIB}.tar.bz2
  129. cd glib-${GLIB}
  130. #[[ $DOCLEAN == 1 ]] && make clean || true
  131. ./configure --disable-static --enable-shared
  132. make -j$MAKE_THREADS
  133. make install
  134. cd ..
  135. popd
  136. fi
  137. }
  138. mkjack()
  139. {
  140. if ! pkg-config jack --exact-version=${JACK} --print-errors; then
  141. pushd /source
  142. apt-get install -y libdb-dev uuid-dev
  143. [ ! -d jack-audio-connection-kit-${JACK} ] && tar -xzf jack-audio-connection-kit-${JACK}.tar.gz
  144. cd jack-audio-connection-kit-${JACK}
  145. #[[ $DOCLEAN == 1 ]] && make clean || true
  146. ./configure --disable-static --enable-shared \
  147. --libdir=/usr/local/lib
  148. make -j$MAKE_THREADS
  149. make install
  150. cd ..
  151. popd
  152. fi
  153. }
  154. mkatk()
  155. {
  156. if ! pkg-config atk --exact-version=${ATK} --print-errors; then
  157. pushd /source
  158. [ ! -d atk-${ATK} ] && tar -xjf atk-${ATK}.tar.bz2
  159. cd atk-${ATK}
  160. #[[ $DOCLEAN == 1 ]] && make clean || true
  161. ./configure --disable-static --enable-shared
  162. make -j$MAKE_THREADS
  163. make install
  164. cd ..
  165. popd
  166. fi
  167. }
  168. mkglibmm()
  169. {
  170. if ! pkg-config glibmm-2.4 --exact-version=${GLIBMM} --print-errors; then
  171. pushd /source
  172. [ ! -d glibmm-${GLIBMM} ] && tar -xjf glibmm-${GLIBMM}.tar.bz2
  173. cd glibmm-${GLIBMM}
  174. #[[ $DOCLEAN == 1 ]] && make clean || true
  175. ./configure --prefix=${PREFIX} --includedir=${PREFIX}/include --disable-static --enable-shared --disable-fulldocs
  176. make -j$MAKE_THREADS
  177. make install
  178. cd ..
  179. popd
  180. fi
  181. }
  182. mklibxmlpp()
  183. {
  184. if ! pkg-config libxml\+\+-2.6 --exact-version=${LIBXMLPP} --print-errors; then
  185. pushd /source
  186. [ ! -d libxml++-${LIBXMLPP} ] && tar -xjf libxml++-${LIBXMLPP}.tar.bz2
  187. cd libxml++-${LIBXMLPP}
  188. #[[ $DOCLEAN == 1 ]] && make clean || true
  189. ./configure --prefix=${PREFIX} --includedir=${PREFIX}/include --disable-static --enable-shared
  190. make -j$MAKE_THREADS
  191. make install
  192. cd ..
  193. popd
  194. fi
  195. }
  196. mkimagemagick()
  197. {
  198. PKG_NAME=ImageMagick
  199. PKG_VERSION="${IMAGEMAGICK}-10"
  200. TAREXT=bz2
  201. if ! pkg-config ImageMagick --exact-version=${IMAGEMAGICK} --print-errors; then
  202. pushd /source
  203. [ -e ${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT} ] || wget http://www.imagemagick.org/download/legacy/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
  204. [ ! -d ${PKG_NAME}-${PKG_VERSION} ] && tar -xjf ${PKG_NAME}-${PKG_VERSION}.tar.bz2 # && cd ${PKG_NAME}-${PKG_VERSION} && patch -p1 < ../ImageMagick-6.4.0-multilib.patch && cd ..
  205. cd ${PKG_NAME}-${PKG_VERSION}
  206. #[[ $DOCLEAN == 1 ]] && make clean || true
  207. ./configure --prefix=${PREFIX} --includedir=${PREFIX}/include --disable-static --enable-shared \
  208. --with-modules \
  209. --without-perl \
  210. --without-x \
  211. --with-threads \
  212. --with-magick_plus_plus
  213. sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
  214. sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
  215. make -j$MAKE_THREADS
  216. make install
  217. cd ..
  218. popd
  219. fi
  220. }
  221. mkglew()
  222. {
  223. [ ! -d glew-${GLEW} ] && tar -xzf glew-${GLEW}.tar.gz && cd glew && patch -p1 < glew-${GLEW}-makefile.patch && cd ..
  224. pushd /source
  225. cd glew
  226. #[[ $DOCLEAN == 1 ]] && make clean || true
  227. sed -i -e 's/\r//g' config/config.guess
  228. make -j$MAKE_THREADS
  229. make install GLEW_DEST=${PREFIX} libdir=/lib bindir=/bin includedir=/include
  230. cd ..
  231. popd
  232. }
  233. mkfontconfig()
  234. {
  235. if ! pkg-config fontconfig --exact-version=${FONTCONFIG} --print-errors; then
  236. pushd /source
  237. [ ! -d fontconfig-${FONTCONFIG} ] && tar -xzf fontconfig-${FONTCONFIG}.tar.gz
  238. cd fontconfig-${FONTCONFIG}
  239. #[[ $DOCLEAN == 1 ]] && make clean || true
  240. ./configure --disable-static --enable-shared
  241. make -j$MAKE_THREADS
  242. make install
  243. cd ..
  244. fi
  245. }
  246. mkpixman()
  247. {
  248. if ! pkg-config pixman-1 --exact-version=${PIXMAN} --print-errors; then
  249. pushd /source
  250. [ ! -d pixman-${PIXMAN} ] && tar -xzf pixman-${PIXMAN}.tar.gz
  251. cd pixman-${PIXMAN}
  252. #[[ $DOCLEAN == 1 ]] && make clean || true
  253. ./configure --disable-static --enable-shared
  254. make -j$MAKE_THREADS
  255. make install
  256. cd ..
  257. fi
  258. }
  259. mkcairo()
  260. {
  261. if ! pkg-config cairo --exact-version=${CAIRO} --print-errors; then
  262. pushd /source
  263. [ ! -d cairo-${CAIRO} ] && tar -xzf cairo-${CAIRO}.tar.gz
  264. cd cairo-${CAIRO}
  265. #[[ $DOCLEAN == 1 ]] && make clean || true
  266. ./configure --prefix=${PREFIX} \
  267. --disable-static \
  268. --enable-warnings \
  269. --enable-xlib \
  270. --enable-freetype \
  271. --enable-gobject \
  272. --disable-gtk-doc
  273. make -j$MAKE_THREADS
  274. make install
  275. cd ..
  276. fi
  277. }
  278. mkcairomm()
  279. {
  280. if ! pkg-config cairomm-1.0 --exact-version=${CAIROMM} --print-errors; then
  281. pushd /source
  282. [ ! -d cairomm-${CAIROMM} ] && tar -xzf cairomm-${CAIROMM}.tar.gz
  283. cd cairomm-${CAIROMM}
  284. #[[ $DOCLEAN == 1 ]] && make clean || true
  285. ./configure --prefix=${PREFIX} --includedir=${PREFIX}/include --disable-static --enable-shared --enable-docs=no
  286. make -j$MAKE_THREADS
  287. make install
  288. cd ..
  289. fi
  290. }
  291. mkpango()
  292. {
  293. if ! pkg-config pango --exact-version=${PANGO} --print-errors; then
  294. pushd /source
  295. [ ! -d pango-${PANGO} ] && tar -xjf pango-${PANGO}.tar.bz2
  296. cd pango-${PANGO}
  297. #[[ $DOCLEAN == 1 ]] && make clean || true
  298. ./configure --disable-static --enable-shared
  299. make -j$MAKE_THREADS
  300. make install
  301. cd ..
  302. popd
  303. fi
  304. }
  305. mkpangomm()
  306. {
  307. if ! pkg-config pangomm-1.4 --exact-version=${PANGOMM} --print-errors; then
  308. pushd /source
  309. [ ! -d pangomm-${PANGOMM} ] && tar -xjf pangomm-${PANGOMM}.tar.bz2
  310. cd pangomm-${PANGOMM}
  311. #[[ $DOCLEAN == 1 ]] && make clean || true
  312. ./configure --prefix=${PREFIX} --includedir=${PREFIX}/include --disable-static --enable-shared --disable-docs
  313. make -j$MAKE_THREADS
  314. make install
  315. cd ..
  316. popd
  317. fi
  318. }
  319. mkgtk()
  320. {
  321. if ! pkg-config gtk\+-3.0 --exact-version=${GTK} --print-errors; then
  322. pushd /source
  323. [ ! -d gtk\+-${GTK} ] && tar -xjf gtk\+-${GTK}.tar.bz2
  324. cd gtk\+-${GTK}
  325. #[[ $DOCLEAN == 1 ]] && make clean || true
  326. ./configure --disable-static --enable-shared --disable-examples --disable-demos --disable-docs
  327. make -j$MAKE_THREADS
  328. make install
  329. cd ..
  330. popd
  331. fi
  332. }
  333. mkgtkmm()
  334. {
  335. if ! pkg-config gtkmm-3.0 --exact-version=${GTKMM} --print-errors; then
  336. pushd /source
  337. [ ! -d gtkmm-${GTKMM} ] && tar -xjf gtkmm-${GTKMM}.tar.bz2
  338. cd gtkmm-${GTKMM}
  339. #[[ $DOCLEAN == 1 ]] && make clean || true
  340. ./configure --prefix=${PREFIX} --includedir=${PREFIX}/include --disable-static --enable-shared --disable-examples --disable-demos --disable-docs
  341. make -j$MAKE_THREADS
  342. make install
  343. cd ..
  344. popd
  345. fi
  346. }
  347. mkfreeglut()
  348. {
  349. pushd /source
  350. [ ! -d freeglut-${FREEGLUT} ] && tar -xzf freeglut-${FREEGLUT}.tar.gz
  351. cd freeglut-${FREEGLUT}
  352. #[[ $DOCLEAN == 1 ]] && make clean || true
  353. ./configure --prefix=${PREFIX} --includedir=${PREFIX}/include --disable-static --disable-warnings --enable-shared
  354. make -j$MAKE_THREADS
  355. make install
  356. cd ..
  357. popd
  358. }
  359. mkftgl()
  360. {
  361. pushd /source
  362. if [ ! -d ftgl-${FTGL} ]; then
  363. tar -xjf ftgl-${FTGL}.tar.bz2
  364. cd FTGL
  365. patch -p1 -b < ftgl-2.1.2-destdir.patch
  366. patch -p1 -b < ftgl-2.1.2-Glyph-g++_41.patch
  367. patch -p1 -b < ftgl-2.1.2-pc_req.patch
  368. patch -p1 -b < ftgl-2.1.2-rpath_FTGLDemo.patch
  369. patch -p1 -b < ftgl-2.1.2-ttf_font.patch
  370. sed -i.fixed_version -e 's|2.0.5|%{version}|g' unix/configure.ac unix/configure
  371. cd ..
  372. fi
  373. cd FTGL
  374. cd unix
  375. #[[ $DOCLEAN == 1 ]] && make clean || true
  376. ./configure --prefix=${PREFIX} --includedir=${PREFIX}/include --disable-static --enable-shared --with-gl-inc=${PREFIX}/include --with-gl-lib=${PREFIX}/lib --with-glut-inc=${PREFIX}/include --with-glut-lib=${PREFIX}/lib --with-x
  377. make all -j$MAKE_THREADS
  378. make install
  379. cd ..
  380. popd
  381. }
  382. mkgtkglext()
  383. {
  384. pushd /source
  385. [ ! -d gtkglext-${GTKGLEXT} ] && tar -xjf gtkglext-${GTKGLEXT}.tar.bz2
  386. cd gtkglext-${GTKGLEXT}
  387. #[[ $DOCLEAN == 1 ]] && make clean || true
  388. ./configure --prefix=${PREFIX} --includedir=${PREFIX}/include --disable-gtk-doc --disable-static --enable-shared
  389. make -j$MAKE_THREADS
  390. make install
  391. cd ..
  392. popd
  393. }
  394. mkgtkglextmm()
  395. {
  396. pushd /source
  397. [ ! -d gtkglextmm-${GTKGLEXTMM} ] && tar -xjf gtkglextmm-${GTKGLEXTMM}.tar.bz2 && cd gtkglextmm-${GTKGLEXTMM} && patch -p1 < gtkglextmm-1.2.0-aclocal.diff && cd ..
  398. cd gtkglextmm-${GTKGLEXTMM}
  399. #[[ $DOCLEAN == 1 ]] && make clean || true
  400. ./configure --prefix=${PREFIX} --includedir=${PREFIX}/include --disable-dependency-tracking --disable-static --enable-shared
  401. make -j$MAKE_THREADS
  402. make install
  403. popd
  404. cd ..
  405. }
  406. mkgit()
  407. {
  408. pushd /source
  409. [ ! -d git-${GITVERSION} ] && tar -xjf git-${GITVERSION}.tar.bz2
  410. cd git-${GITVERSION}
  411. ./configure
  412. make -j$MAKE_THREADS
  413. make install
  414. cd ..
  415. popd
  416. }
  417. mkboost()
  418. {
  419. if ! cat /usr/local/include/boost/version.hpp |egrep "BOOST_LIB_VERSION \"${BOOST%_*}\""; then
  420. pushd /source
  421. [ ! -d boost-${BOOST} ] && tar -xjf boost_${BOOST}.tar.bz2
  422. cd boost_${BOOST}
  423. ./bootstrap.sh
  424. ./b2 || true
  425. ./b2 install || true
  426. cd ..
  427. popd
  428. fi
  429. cp /usr/local/lib/libboost_program_options.so.1.53.0 $PREFIX/lib/
  430. }
  431. mkETL()
  432. {
  433. if [ -f ${SYNFIG_REPO_DIR}/ETL/trunk/configure.ac ]; then
  434. pushd ${SYNFIG_REPO_DIR}/ETL/trunk
  435. else
  436. pushd ${SYNFIG_REPO_DIR}/ETL
  437. fi
  438. if ( [[ $MODE == 'package' ]] || [[ $MODE == 'full' ]] ); then
  439. echo "Cleaning source tree..."
  440. make clean || true
  441. fi
  442. if [[ $MODE != 'quick' ]]; then
  443. echo "Going to configure..."
  444. rm -f aclocal.m4
  445. autoreconf --install --force
  446. /bin/sh ./configure --prefix=${PREFIX} --includedir=${PREFIX}/include $DEBUG
  447. fi
  448. make -j$MAKE_THREADS
  449. make install
  450. popd
  451. }
  452. mksynfig()
  453. {
  454. if [ -d ${SYNFIG_REPO_DIR}/synfig-core/trunk/configure.ac ]; then
  455. pushd ${SYNFIG_REPO_DIR}/synfig-core/trunk
  456. else
  457. pushd ${SYNFIG_REPO_DIR}/synfig-core
  458. fi
  459. if [[ $MODE == 'package' ]] || [[ $MODE == 'full' ]]; then
  460. make clean || true
  461. fi
  462. if [[ $MODE != 'quick' ]]; then
  463. /bin/sh ./bootstrap.sh
  464. if [ -e /etc/debian_version ] && [ -z $BOOST_CONFIGURE_OPTIONS ]; then
  465. # Debian/Ubuntu multiarch
  466. MULTIARCH_LIBDIR="/usr/lib/`uname -m`-linux-gnu/"
  467. if [ -e "${MULTIARCH_LIBDIR}/libboost_program_options.so" ]; then
  468. export BOOST_CONFIGURE_OPTIONS="--with-boost-libdir=$MULTIARCH_LIBDIR"
  469. fi
  470. fi
  471. export CONFIG_SHELL=/bin/bash
  472. /bin/bash ./configure --prefix=${PREFIX} \
  473. --includedir=${PREFIX}/include \
  474. --disable-static --enable-shared \
  475. --with-magickpp \
  476. --without-libavcodec \
  477. --without-included-ltdl \
  478. $BOOST_CONFIGURE_OPTIONS \
  479. $DEBUG
  480. fi
  481. #It looks like mod_libavcodec causes segfault on synfig-core when rendering to png.
  482. #Tested on: ffmpeg-0.4.9-0.52.20080908.fc10.x86_64.
  483. #if [[ $GIT == 1 ]]; then
  484. # export CFLAGS=-I/opt/synfig/include/GL/
  485. # export LDFLAGS=-L/opt/synfig/lib/
  486. #else
  487. # export CFLAGS=''
  488. # export LDFLAGS=''
  489. #fi
  490. make -j$MAKE_THREADS
  491. make install
  492. sed -i "s|^includedir=.*$|includedir=$SYNFIG_REPO_DIR\/synfig-core\/src|" ${PREFIX}/lib/pkgconfig/synfig.pc
  493. popd
  494. }
  495. mksynfigstudio()
  496. {
  497. if [ -d ${SYNFIG_REPO_DIR}/synfig-studio/trunk/configure.ac ]; then
  498. pushd ${SYNFIG_REPO_DIR}/synfig-studio/trunk
  499. else
  500. pushd ${SYNFIG_REPO_DIR}/synfig-studio
  501. fi
  502. if [[ $MODE == 'package' ]] || [[ $MODE == 'full' ]]; then
  503. make clean || true
  504. fi
  505. if [[ $MODE == 'package' ]]; then
  506. CONFIGURE_PACKAGE_OPTIONS='--disable-update-mimedb'
  507. fi
  508. if [[ $MODE != 'quick' ]]; then
  509. /bin/sh ./bootstrap.sh
  510. /bin/sh ./configure --prefix=${PREFIX} --includedir=${PREFIX}/include --disable-static --enable-shared --enable-jack --enable-warnings=max $DEBUG $CONFIGURE_PACKAGE_OPTIONS
  511. fi
  512. make -j$MAKE_THREADS
  513. make install
  514. for n in AUTHORS COPYING NEWS README
  515. do
  516. cp -f $n ${PREFIX}
  517. done
  518. #if [ -e synfigstudio-cph-monitor ]; then
  519. # cp -f synfigstudio-cph-monitor ${PREFIX}/bin/
  520. # chmod a+x ${PREFIX}/bin/synfigstudio-cph-monitor
  521. #fi
  522. popd
  523. }
  524. mkpack()
  525. {
  526. [ -d /packages ] || mkdir /packages
  527. # bundle libpng
  528. rm -f ${PREFIX}/lib/libpng* || true
  529. cp -av /usr/lib/libpng*.so* ${PREFIX}/lib
  530. # bundle libjasper
  531. rm -f ${PREFIX}/lib/libjasper* || true
  532. cp -av /usr/lib/libjasper*.so* ${PREFIX}/lib
  533. # bundle libltdl
  534. rm -f ${PREFIX}/lib/libltdl* || true
  535. cp -av /usr/lib/libltdl*.so* ${PREFIX}/lib
  536. # A place for optional libs
  537. [ -e ${PREFIX}/lib.extra ] || mkdir -p ${PREFIX}/lib.extra
  538. # bundle optional libjack
  539. rm -f ${PREFIX}/lib.extra/libjack* || true
  540. cp -av /usr/local/lib/libjack.so* ${PREFIX}/lib.extra
  541. rm -f ${PREFIX}/lib.extra/libdb-4* || true
  542. cp -av /usr/lib/libdb-4*.so ${PREFIX}/lib.extra
  543. cat > $PREFIX/synfig <<EOF
  544. #!/bin/sh
  545. PREFIX="/opt/synfig"
  546. export LD_LIBRARY_PATH=\${PREFIX}/lib:\$LD_LIBRARY_PATH
  547. export SYNFIG_ROOT=\${PREFIX}/
  548. export SYNFIG_MODULE_LIST=\${PREFIX}/etc/synfig_modules.cfg
  549. \$PREFIX/bin/synfig "\$@"
  550. EOF
  551. chmod a+x $PREFIX/synfig
  552. cat > $PREFIX/synfigstudio <<EOF
  553. #!/bin/sh
  554. PREFIX="/opt/synfig"
  555. # Check if this system have JACK installed
  556. if ( ! ldconfig -p | grep libjack.so >/dev/null ) || ( ! which jackd >/dev/null ) ; then
  557. # No JACK, so disable this functionality.
  558. # (The bundled libjack won't work correctly anyway).
  559. export SYNFIG_DISABLE_JACK=1
  560. export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\${PREFIX}/lib.extra
  561. fi
  562. export LD_LIBRARY_PATH=\${PREFIX}/lib:\$LD_LIBRARY_PATH
  563. export SYNFIG_ROOT=\${PREFIX}/
  564. export SYNFIG_MODULE_LIST=\${PREFIX}/etc/synfig_modules.cfg
  565. \$PREFIX/bin/synfigstudio "\$@"
  566. EOF
  567. chmod a+x $PREFIX/synfigstudio
  568. #== tar.bz2 ==
  569. TBZPREFIX=/tmp/synfigstudio-${VERSION}-${REVISION}.$BREED.$RELEASE.${ARCH}
  570. rm -rf $TBZPREFIX
  571. mkdir -p $TBZPREFIX
  572. cp -r ${PREFIX}/* $TBZPREFIX
  573. if [[ $DEBUG != '' ]]; then
  574. GDB="which gdb && xterm -e gdb -ex run -ex quit \$PREFIX/bin/synfig \"\$@\" || "
  575. else
  576. GDB=''
  577. fi
  578. #binaries
  579. cat > $TBZPREFIX/synfig <<EOF
  580. #!/bin/sh
  581. PREFIX=\`dirname \$0\`
  582. PREFIX=\`cd \$PREFIX; pwd\`
  583. export LD_LIBRARY_PATH=\${PREFIX}/lib:\$LD_LIBRARY_PATH
  584. export SYNFIG_ROOT=\${PREFIX}/
  585. export SYNFIG_MODULE_LIST=\${PREFIX}/etc/synfig_modules.cfg
  586. $GDB\$PREFIX/bin/synfig "\$@"
  587. EOF
  588. if [[ $DEBUG != '' ]]; then
  589. GDB="which gdb && xterm -e gdb -ex run -ex quit \$PREFIX/bin/synfigstudio \$@ || "
  590. else
  591. GDB=''
  592. fi
  593. cat > $TBZPREFIX/synfigstudio <<EOF
  594. #!/bin/sh
  595. PREFIX=\`dirname \$0\`
  596. PREFIX=\`cd \$PREFIX; pwd\`
  597. # Check if this system have JACK installed
  598. if ( ! ldconfig -p | grep libjack.so >/dev/null ) || ( ! which jackd >/dev/null ) ; then
  599. # No JACK, so disable this functionality.
  600. # (The bundled libjack won't work correctly anyway).
  601. export SYNFIG_DISABLE_JACK=1
  602. export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\${PREFIX}/lib.extra
  603. fi
  604. export LD_LIBRARY_PATH=\${PREFIX}/lib:\$LD_LIBRARY_PATH
  605. export SYNFIG_ROOT=\${PREFIX}/
  606. export SYNFIG_MODULE_LIST=\${PREFIX}/etc/synfig_modules.cfg
  607. $GDB\$PREFIX/bin/synfigstudio "\$@"
  608. EOF
  609. chmod a+x $TBZPREFIX/synfig
  610. chmod a+x $TBZPREFIX/synfigstudio
  611. #cleaning devel stuff
  612. mkdir $TBZPREFIX/bin.tmp
  613. mv $TBZPREFIX/bin/synfig $TBZPREFIX/bin.tmp/synfig
  614. mv $TBZPREFIX/bin/synfigstudio $TBZPREFIX/bin.tmp/synfigstudio
  615. rm -rf $TBZPREFIX/bin
  616. mv $TBZPREFIX/bin.tmp $TBZPREFIX/bin
  617. rm -f $TBZPREFIX/lib/*.la
  618. rm -f $TBZPREFIX/lib/*.a
  619. rm -f $TBZPREFIX/lib/cairo/*.la
  620. rm -rf $TBZPREFIX/include
  621. rm -rf $TBZPREFIX/lib/gdkmm-3.0
  622. rm -rf $TBZPREFIX/lib/libxml++-2.6
  623. rm -rf $TBZPREFIX/lib/glibmm-2.4
  624. rm -rf $TBZPREFIX/lib/pangomm-1.4
  625. rm -rf $TBZPREFIX/lib/gtkmm-3.0
  626. rm -rf $TBZPREFIX/lib/pkgconfig
  627. rm -rf $TBZPREFIX/lib/sigc++-2.0
  628. rm -rf $TBZPREFIX/share/doc
  629. rm -rf $TBZPREFIX/share/devhelp
  630. rm -rf $TBZPREFIX/share/gtk-doc
  631. rm -rf $TBZPREFIX/share/aclocal
  632. rm -rf $TBZPREFIX/share/ImageMagick-6.4.0
  633. rm -rf $TBZPREFIX/share/man
  634. rm -f /packages/synfigstudio-${VERSION}-${REVISION}.$BREED.$RELEASE.${ARCH}.tar.bz2
  635. pushd $TBZPREFIX/../
  636. tar cjf /packages/synfigstudio-${VERSION}-${REVISION}.$BREED.$RELEASE.${ARCH}.tar.bz2 synfigstudio-${VERSION}-${REVISION}.$BREED.$RELEASE.${ARCH}
  637. popd
  638. rm -rf $TBZPREFIX
  639. #== rpm ==
  640. cat > synfigstudio.spec << EOF
  641. %define __spec_install_post /bin/true
  642. Name: synfigstudio
  643. Version: ${VERSION}
  644. Release: ${REVISION}.${BREED}.${RELEASE}
  645. Summary: Film-Quality 2D Vector Animation package
  646. Group: Applications/Graphics
  647. License: GPL
  648. URL: http://www.synfig.org/
  649. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
  650. Obsoletes: synfig ETL
  651. AutoReqProv: no
  652. %description
  653. Synfig Animation Studio is a powerful, industrial-strength vector-based
  654. 2D animation software, designed from the ground-up for producing
  655. feature-film quality animation with fewer people and resources.
  656. It eliminates the need for tweening, preventing the need to hand-draw
  657. each frame. Synfig features spatial and temporal resolution independence
  658. (sharp and smooth at any resolution or framerate), high dynamic range
  659. images, and a flexible plugin system.
  660. %prep
  661. %build
  662. %install
  663. rm -rf \$RPM_BUILD_ROOT
  664. mkdir -p \$RPM_BUILD_ROOT/${PREFIX}
  665. cp -r ${PREFIX}/* \$RPM_BUILD_ROOT/${PREFIX}
  666. mkdir -p \$RPM_BUILD_ROOT/usr/share
  667. mv \$RPM_BUILD_ROOT/${PREFIX}/share/applications \$RPM_BUILD_ROOT/usr/share
  668. mv \$RPM_BUILD_ROOT/${PREFIX}/share/icons \$RPM_BUILD_ROOT/usr/share
  669. mv \$RPM_BUILD_ROOT/${PREFIX}/share/mime \$RPM_BUILD_ROOT/usr/share
  670. mkdir -p \$RPM_BUILD_ROOT/usr/share/mime-info
  671. ln -sf ${PREFIX}/share/mime-info/synfigstudio.keys \$RPM_BUILD_ROOT/usr/share/mime-info/synfigstudio.keys
  672. ln -sf ${PREFIX}/share/mime-info/synfigstudio.mime \$RPM_BUILD_ROOT/usr/share/mime-info/synfigstudio.mime
  673. mkdir -p \$RPM_BUILD_ROOT/usr/share/pixmaps
  674. ln -sf ${PREFIX}/share/pixmaps/sif_icon.png \$RPM_BUILD_ROOT/usr/share/pixmaps/sif_icon.png
  675. ln -sf ${PREFIX}/share/pixmaps/synfig_icon.png \$RPM_BUILD_ROOT/usr/share/pixmaps/synfig_icon.png
  676. mkdir -p \$RPM_BUILD_ROOT/usr/bin
  677. cp \$RPM_BUILD_ROOT/${PREFIX}/synfig \$RPM_BUILD_ROOT/usr/bin/
  678. cp \$RPM_BUILD_ROOT/${PREFIX}/synfigstudio \$RPM_BUILD_ROOT/usr/bin/
  679. #if [ -e \$RPM_BUILD_ROOT/${PREFIX}/bin/synfigstudio-cph-monitor ]; then
  680. #mv \$RPM_BUILD_ROOT/${PREFIX}/bin/synfigstudio-cph-monitor \$RPM_BUILD_ROOT/usr/bin/
  681. #cat > \$RPM_BUILD_ROOT/usr/share/applications/synfigstudio-cph-monitor.desktop << EOD
  682. #[Desktop Entry]
  683. #Encoding=UTF-8
  684. #Name=Synfig Studio CPH monitor
  685. #Comment=This application collecting statistics about synfig crashes
  686. #Exec=synfigstudio-cph-monitor
  687. #Icon=terminal.png
  688. #Terminal=true
  689. #Type=Application
  690. #Categories=Graphics;Application;
  691. #X-Desktop-File-Install-Version=0.15
  692. #EOD
  693. #fi
  694. #cleaning devel stuff
  695. rm -f \$RPM_BUILD_ROOT/${PREFIX}/lib/*.la
  696. rm -f \$RPM_BUILD_ROOT/${PREFIX}/lib/*.a
  697. rm -f \$RPM_BUILD_ROOT/${PREFIX}/lib/cairo/*.la
  698. #rm -rf \$RPM_BUILD_ROOT/${PREFIX}/bin
  699. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/include
  700. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/lib/gdkmm-3.0
  701. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/lib/libxml++-2.6
  702. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/lib/glibmm-2.4
  703. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/lib/gtkmm-3.0
  704. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/lib/pangomm-1.4
  705. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/lib/pkgconfig
  706. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/lib/sigc++-2.0
  707. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/share/doc
  708. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/share/devhelp
  709. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/share/gtk-doc
  710. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/share/aclocal
  711. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/share/ImageMagick-6.4.0
  712. rm -rf \$RPM_BUILD_ROOT/${PREFIX}/share/man
  713. %clean
  714. rm -rf \$RPM_BUILD_ROOT
  715. %post
  716. if [ -x /usr/bin/update-mime-database ]; then
  717. update-mime-database /usr/share/mime
  718. fi
  719. if [ -x /usr/bin/update-desktop-database ]; then
  720. update-desktop-database
  721. fi
  722. %postun
  723. if [ -x /usr/bin/update-mime-database ]; then
  724. update-mime-database /usr/share/mime
  725. fi
  726. if [ -x /usr/bin/update-desktop-database ]; then
  727. update-desktop-database
  728. fi
  729. %files
  730. %defattr(-,root,root,-)
  731. $PREFIX
  732. /usr/share/*
  733. /usr/bin/*
  734. %changelog
  735. * Sat Mar 21 2009 Konstantin Dmitriev <ksee.zelgadis@gmail.com> - 0.61.09-2354.morevnapackage.1
  736. - Update to SVN2354
  737. - Include ImageMagick-c++
  738. * Wed Jan 14 2009 Konstantin Dmitriev <ksee.zelgadis@gmail.com> - 0.61.09-2316.morevnapackage.1
  739. - First release
  740. EOF
  741. rpmbuild -bb synfigstudio.spec
  742. #cp /usr/src/redhat/RPMS/$ARCH/synfigstudio-${VERSION}-${REVISION}.${BREED}.$RELEASE.${ARCH}.rpm ../
  743. cp /usr/src/rpm/RPMS/$ARCH/synfigstudio-${VERSION}-${REVISION}.${BREED}.$RELEASE.${ARCH}.rpm /packages/
  744. pushd /packages/
  745. alien -k --scripts synfigstudio-${VERSION}-${REVISION}.${BREED}.$RELEASE.${ARCH}.rpm
  746. rm -rf synfigstudio-${VERSION}
  747. popd
  748. }
  749. get_dependencies()
  750. {
  751. # Make sure we have all dependencies installed
  752. echo "Checking dependencies..."
  753. DEB_LIST_MINIMAL="\
  754. build-essential \
  755. autoconf automake \
  756. shared-mime-info \
  757. libltdl3-dev \
  758. libtool \
  759. intltool \
  760. gettext \
  761. libpng-dev \
  762. libfftw3-dev \
  763. fontconfig \
  764. libfreetype6-dev \
  765. libfontconfig1-dev \
  766. libxml2-dev \
  767. libtiff5-dev \
  768. libmlt-dev libmlt++-dev \
  769. libjasper-dev \
  770. x11proto-xext-dev libdirectfb-dev libxfixes-dev libxinerama-dev libxdamage-dev libxcomposite-dev libxcursor-dev libxft-dev libxrender-dev libxt-dev libxrandr-dev libxi-dev libxext-dev libx11-dev \
  771. libatk1.0-dev \
  772. libgl1-mesa-dev \
  773. imagemagick \
  774. bzip2"
  775. if which dnf >/dev/null; then
  776. #
  777. # Fedora >= 22
  778. #
  779. PKG_LIST="git"
  780. if [[ $MODE == 'package' ]]; then
  781. PKG_LIST="${PKG_LIST} \
  782. debootstrap \
  783. rsync"
  784. else
  785. PKG_LIST="${PKG_LIST} \
  786. intltool \
  787. libpng-devel \
  788. libjpeg-devel \
  789. fftw-devel \
  790. freetype-devel \
  791. fontconfig-devel \
  792. atk-devel \
  793. pango-devel \
  794. cairo-devel \
  795. gtk3-devel \
  796. gettext-devel \
  797. libxml2-devel \
  798. libxml++-devel \
  799. gcc-c++ \
  800. autoconf \
  801. automake \
  802. libtool \
  803. libtool-ltdl-devel \
  804. boost-devel \
  805. boost-program-options \
  806. shared-mime-info \
  807. OpenEXR-devel \
  808. libmng-devel \
  809. ImageMagick-c++-devel \
  810. jack-audio-connection-kit-devel \
  811. mlt-devel \
  812. ocl-icd-devel \
  813. opencl-headers \
  814. gtkmm30-devel \
  815. glibmm24-devel"
  816. fi
  817. if ! ( rpm -qv $PKG_LIST ); then
  818. echo "Running dnf (you need root privelegies to do that)..."
  819. su -c "dnf install $PKG_LIST" || true
  820. fi
  821. elif which yum >/dev/null; then
  822. #
  823. # Fedora
  824. #
  825. PKG_LIST="git"
  826. if [[ $MODE == 'package' ]]; then
  827. PKG_LIST="${PKG_LIST} \
  828. debootstrap \
  829. rsync"
  830. else
  831. PKG_LIST="${PKG_LIST} \
  832. intltool \
  833. libpng-devel \
  834. libjpeg-devel \
  835. fftw-devel \
  836. freetype-devel \
  837. fontconfig-devel \
  838. atk-devel \
  839. pango-devel \
  840. cairo-devel \
  841. gtk3-devel \
  842. gettext-devel \
  843. libxml2-devel \
  844. libxml++-devel \
  845. gcc-c++ \
  846. autoconf \
  847. automake \
  848. libtool \
  849. libtool-ltdl-devel \
  850. boost-devel \
  851. boost-program-options \
  852. shared-mime-info \
  853. OpenEXR-devel \
  854. libmng-devel \
  855. ImageMagick-c++-devel \
  856. jack-audio-connection-kit-devel \
  857. mlt-devel \
  858. ocl-icd-devel \
  859. opencl-headers \
  860. gtkmm30-devel \
  861. glibmm24-devel"
  862. fi
  863. if ! ( rpm -qv $PKG_LIST ); then
  864. echo "Running yum (you need root privelegies to do that)..."
  865. su -c "yum install $PKG_LIST" || true
  866. fi
  867. elif which zypper >/dev/null; then
  868. #
  869. # OpenSUSE
  870. #
  871. PKG_LIST="git"
  872. if [[ $MODE == 'package' ]]; then
  873. PKG_LIST="${PKG_LIST} \
  874. debootstrap \
  875. rsync"
  876. else
  877. PKG_LIST="${PKG_LIST} libpng-devel libjpeg-devel freetype-devel fontconfig-devel atk-devel pango-devel cairo-devel gtk3-devel gettext-devel libxml2-devel libxml++-devel gcc-c++ autoconf automake libtool libtool-ltdl-devel boost-devel boost-program-options shared-mime-info"
  878. PKG_LIST="${PKG_LIST} OpenEXR-devel libmng-devel ImageMagick-c++-devel gtkmm3-devel glibmm2-devel"
  879. fi
  880. if ! ( rpm -qv $PKG_LIST ); then
  881. echo "Running zypper (you need root privelegies to do that)..."
  882. su -c "zypper install $PKG_LIST" || true
  883. fi
  884. elif which apt-get >/dev/null; then
  885. if [[ $MODE == 'package' ]]; then
  886. if [[ `cat /etc/chroot.id` == "Synfig Packages Buildroot v${BUILDROOT_VERSION}" ]]; then
  887. #we are inside of chroot
  888. PKG_LIST="$DEB_LIST_MINIMAL rpm alien xsltproc wget python"
  889. else
  890. #we have to prepare chroot
  891. PKG_LIST="git-core debootstrap rsync"
  892. fi
  893. else
  894. if ( cat /etc/altlinux-release | egrep "ALT Linux" ); then
  895. #
  896. # ALT Linux case
  897. #
  898. PKG_LIST=" \
  899. rpm-build \
  900. boost-program_options-devel \
  901. git-core \
  902. shared-mime-info \
  903. libltdl3-devel \
  904. intltool \
  905. gettext \
  906. libpng12-devel \
  907. libjpeg-devel \
  908. fontconfig \
  909. libfreetype-devel \
  910. fontconfig-devel \
  911. libxml2-devel \
  912. libtiff-devel \
  913. libjasper-devel \
  914. libdirectfb-devel \
  915. libfftw3-dev \
  916. libXfixes-devel \
  917. libXinerama-devel \
  918. libXdamage-devel \
  919. libXcomposite-devel \
  920. libXcursor-devel \
  921. libXft-devel \
  922. libXrender-devel \
  923. libXt-devel \
  924. libXrandr-devel \
  925. libXi-devel \
  926. libXext-devel \
  927. libX11-devel \
  928. libatk-devel \
  929. bzip2 \
  930. libmng-devel \
  931. libgtkmm3-devel \
  932. libglibmm-devel \
  933. libsigc++2-devel \
  934. libxml++2-devel \
  935. "
  936. else
  937. #
  938. # Ubuntu/Debian case
  939. #
  940. PKG_LIST=" \
  941. ${DEB_LIST_MINIMAL} \
  942. git-core \
  943. libmng-dev \
  944. libjack-jackd2-dev \
  945. libgtkmm-3.0-dev \
  946. libglibmm-2.4-dev \
  947. libsigc++-2.0-dev \
  948. libxml++2.6-dev \
  949. libboost-program-options-dev \
  950. libboost-system-dev \
  951. libboost-filesystem-dev \
  952. libboost-chrono-dev \
  953. libmagick++-dev \
  954. "
  955. fi
  956. fi
  957. echo "Running apt-get (you need root privelegies to do that)..."
  958. echo
  959. sudo apt-get update || true
  960. sudo apt-get install -y $PKG_LIST
  961. sudo apt-get install -y autopoint || true # Ubuntu special case
  962. else
  963. if [[ $MODE == 'package' ]]; then
  964. if ! ( which git && which debootstrap ) ; then
  965. echo "ERROR: Please install 'git' and 'debootstrap'."
  966. exit;
  967. fi
  968. else
  969. echo "WARNING: This build script does not works with package mangement systems other than yum, zypper or apt! You should install dependent packages manually."
  970. echo "REQUIRED PACKAGES: libpng-devel libjpeg-devel freetype-devel fontconfig-devel atk-devel pango-devel cairo-devel gtk3-devel gettext-devel libxml2-devel libxml++-devel gcc-c++ autoconf automake libtool libtool-ltdl-devel shared-mime-info OpenEXR-devel libmng-devel ImageMagick-c++-devel gtkmm30-devel glibmm24-devel"
  971. echo ""
  972. read
  973. fi
  974. fi
  975. echo "Done."
  976. }
  977. initialize()
  978. {
  979. if [[ $DEBUG == 1 ]]; then
  980. DEBUG='--enable-debug --enable-optimization=0'
  981. else
  982. DEBUG=''
  983. fi
  984. if [[ $MODE == 'package' ]]; then
  985. PREFIX="/opt/synfig"
  986. fi
  987. if [[ $MODE == 'package' ]] && [[ `cat /etc/chroot.id` == "Synfig Packages Buildroot v${BUILDROOT_VERSION}" ]]; then
  988. SYNFIG_REPO_DIR="/source/synfig.git"
  989. which git || mkgit
  990. pushd $SYNFIG_REPO_DIR
  991. git fetch
  992. git reset --hard HEAD
  993. #we can't switch directly to specified commit wit old git, so let's create temporary branch:
  994. #git checkout master || ( git branch -f master && git checkout master )
  995. #git branch -f __build $SELECTEDREVISION
  996. #git checkout __build
  997. git checkout $SELECTEDREVISION
  998. VERSION=`cat synfig-core/configure.ac |egrep "AC_INIT\(\[Synfig Core\],"| sed "s|.*Core\],\[||" | sed "s|\],\[.*||"`
  999. if [ -z $BREED ]; then
  1000. BREED="`git branch -a --no-color --contains HEAD | sed -e s/\*\ // | sed -e s/\(no\ branch\)// | tr '\n' ' ' | tr -s ' ' | sed s/^' '//`"
  1001. if ( echo $BREED | egrep origin/master > /dev/null ); then
  1002. #give a priority to master branch
  1003. BREED='master'
  1004. else
  1005. BREED=`echo $BREED | cut -d ' ' -f 1`
  1006. BREED=${BREED##*/}
  1007. fi
  1008. BREED=${BREED%_master}
  1009. fi
  1010. if [[ ${VERSION##*-RC} != ${VERSION} ]]; then
  1011. #if [[ $BREED == 'master' ]]; then
  1012. BREED=rc${VERSION##*-RC}
  1013. #else
  1014. # BREED=rc${VERSION##*-RC}.$BREED
  1015. #fi
  1016. VERSION=${VERSION%%-*}
  1017. fi
  1018. [[ $DEBUG == 1 ]] && BREED=${BREED}.dbg
  1019. BREED=`echo $BREED | tr _ . | tr - .` # No "-" or "_" characters, becuse RPM and DEB complain
  1020. REVISION=`git show --pretty=format:%ci HEAD | head -c 10 | tr -d '-'`
  1021. echo
  1022. echo
  1023. echo "BUILDING synfigstudio-$VERSION-$REVISION.$BREED.$RELEASE"
  1024. echo
  1025. echo
  1026. sleep 5
  1027. popd
  1028. #Trick to detect arch under chroot
  1029. #ARCH=`rpm -q --queryformat='%{arch}\n' e2fsprogs`
  1030. MACHINE_TYPE=`uname -m`
  1031. case ${MACHINE_TYPE} in
  1032. i586)
  1033. ARCH=i386;;
  1034. i686)
  1035. ARCH=i386;;
  1036. *)
  1037. ARCH=${MACHINE_TYPE};;
  1038. esac
  1039. else
  1040. #detecting repo
  1041. SCRIPTPATH=`dirname "$0"`
  1042. pushd "$SCRIPTPATH"
  1043. if git rev-parse --git-dir >/dev/null; then
  1044. SYNFIG_REPO_DIR=$(dirname `git rev-parse --git-dir`)
  1045. pushd "$SYNFIG_REPO_DIR" > /dev/null
  1046. SYNFIG_REPO_DIR=`pwd`
  1047. popd > /dev/null
  1048. WORKDIR_IS_REPO=1
  1049. fi
  1050. popd > /dev/null
  1051. fi
  1052. #export PREFIX=/opt/synfig
  1053. export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig:${PREFIX}/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/`uname -i`-linux-gnu/pkgconfig/:$PKG_CONFIG_PATH
  1054. export PATH=${PREFIX}/bin:$PATH
  1055. export LD_LIBRARY_PATH=${PREFIX}/lib:${PREFIX}/lib64:/usr/local/lib:$LD_LIBRARY_PATH
  1056. export LDFLAGS="-Wl,-rpath -Wl,\\\$\$ORIGIN/lib"
  1057. }
  1058. mk()
  1059. {
  1060. get_dependencies
  1061. initialize
  1062. if [[ $WORKDIR_IS_REPO == 0 ]]; then
  1063. SYNFIG_REPO_DIR=`pwd`/synfig.git/
  1064. git clone git://github.com/synfig/synfig.git ${SYNFIG_REPO_DIR}
  1065. fi
  1066. mkETL
  1067. mksynfig
  1068. mksynfigstudio
  1069. }
  1070. mkpackage()
  1071. {
  1072. #check if we already in chroot
  1073. if [[ `cat /etc/chroot.id` == "Synfig Packages Buildroot v${BUILDROOT_VERSION}" ]]; then
  1074. echo "We are in chroot now."
  1075. echo "[user]" > /root/.gitconfig
  1076. echo "email = packages@synfig.org" >> /root/.gitconfig
  1077. echo "name = Synfig Packager" >> /root/.gitconfig
  1078. # we need newer intltool
  1079. dpkg -i /source/intltool_0.41.1-1_all.deb
  1080. #system libs
  1081. mkglib
  1082. mkfontconfig
  1083. mkatk
  1084. mkpixman
  1085. mkcairo
  1086. mkpango
  1087. mkgtk
  1088. mkjack
  1089. #synfig-core deps
  1090. mklibsigcpp
  1091. mkglibmm
  1092. mklibxmlpp
  1093. if [[ $OPENGL == 1 ]]; then
  1094. mkglew
  1095. fi
  1096. mkimagemagick
  1097. mkboost
  1098. #synfig-studio deps
  1099. mkcairomm
  1100. mkpangomm
  1101. mkgtkmm
  1102. if [[ $OPENGL == 1 ]]; then
  1103. mkfreeglut
  1104. mkftgl
  1105. mkgtkglext
  1106. mkgtkglextmm
  1107. fi
  1108. mkETL
  1109. mksynfig
  1110. mksynfigstudio
  1111. mkpack
  1112. else
  1113. [ -d $HOME/synfig-packages ] || mkdir -p $HOME/synfig-packages
  1114. #DEB_LIST="build-essential,autoconf,automake,libltdl3-dev,libtool,gettext,libpng12-dev,libjpeg62-dev,libfreetype6-dev,libfontconfig1-dev,libgtk3.0-dev,libxml2-dev,bzip2,rpm,alien,xsltproc"
  1115. for ARCH in i386 amd64; do
  1116. if [[ $ARCH == 'i386' ]];then
  1117. SETARCH='linux32'
  1118. else
  1119. SETARCH='linux64'
  1120. fi
  1121. # If chroot version changed -> reset existing buildroot
  1122. if [[ `cat $PACKAGES_BUILDROOT.$ARCH/etc/chroot.id` != "Synfig Packages Buildroot v${BUILDROOT_VERSION}" ]]; then
  1123. echo "======================= !!! ======================"
  1124. echo " Buildroot version changed. Force update..."
  1125. echo "======================= !!! ======================"
  1126. if [ -e $PACKAGES_BUILDROOT.$ARCH/ ]; then
  1127. rm -rf $PACKAGES_BUILDROOT.$ARCH/
  1128. fi
  1129. debootstrap --arch=$ARCH --variant=buildd --include=sudo lenny $PACKAGES_BUILDROOT.$ARCH http://archive.debian.org/debian
  1130. #debootstrap --arch=$ARCH --variant=buildd --include=sudo squeeze $PACKAGES_BUILDROOT.$ARCH http://ftp.de.debian.org/debian
  1131. fi
  1132. #set chroot ID
  1133. echo "Synfig Packages Buildroot v${BUILDROOT_VERSION}" > $PACKAGES_BUILDROOT.$ARCH/etc/chroot.id
  1134. # If library set changed -> remove all existing libraries to force rebuild
  1135. if [[ `cat $PACKAGES_BUILDROOT.$ARCH/etc/chroot_libset.id` != "${BUILDROOT_LIBRARY_SET_ID}" ]]; then
  1136. echo "======================= !!! ======================"
  1137. echo " Library set is changed. Force cleanup..."
  1138. echo "======================= !!! ======================"
  1139. sleep 5
  1140. echo "Cleaning $PACKAGES_BUILDROOT.$ARCH/usr/local ..."
  1141. rm -rf $PACKAGES_BUILDROOT.$ARCH/usr/local || true
  1142. echo "Cleaning $PACKAGES_BUILDROOT.$ARCH/$PREFIX ..."
  1143. rm -rf $PACKAGES_BUILDROOT.$ARCH/$PREFIX || true
  1144. echo
  1145. fi
  1146. #set library set ID
  1147. echo "${BUILDROOT_LIBRARY_SET_ID}" > $PACKAGES_BUILDROOT.$ARCH/etc/chroot_libset.id
  1148. cp -f $0 $PACKAGES_BUILDROOT.$ARCH/build.sh
  1149. #resolv.conf
  1150. cp -f /etc/resolv.conf $PACKAGES_BUILDROOT.$ARCH/etc/resolv.conf
  1151. #keep proxy settings
  1152. if ! [ -z $http_proxy ]; then
  1153. #echo "export http_proxy=\"$http_proxy\";" >> $PACKAGES_BUILDROOT.$ARCH/root/.bashrc
  1154. #echo "echo 'proxy export done';" >> $PACKAGES_BUILDROOT.$ARCH/root/.bashrc
  1155. echo "Acquire::http::Proxy \"$http_proxy\";" > $PACKAGES_BUILDROOT.$ARCH/etc/apt/apt.conf
  1156. fi
  1157. #fetch sources to cache
  1158. if [ -d $PACKAGES_BUILDROOT.$ARCH/source/synfig.git ]; then
  1159. rm -rf $PACKAGES_BUILDROOT.$ARCH/source/synfig.git || true
  1160. fi
  1161. if [ -d $PACKAGES_BUILDROOT/synfig.git ]; then
  1162. if [[ $WORKDIR_IS_REPO == 1 ]]; then
  1163. rm -rf "$PACKAGES_BUILDROOT/synfig.git"
  1164. fi
  1165. fi
  1166. if ! [ -d $PACKAGES_BUILDROOT/synfig.git ]; then
  1167. if [[ $WORKDIR_IS_REPO == 1 ]]; then
  1168. git clone $SYNFIG_REPO_DIR $PACKAGES_BUILDROOT/synfig.git
  1169. sed -i 's|url = .*|url = git://github.com/synfig/synfig.git|' $PACKAGES_BUILDROOT/synfig.git/.git/config
  1170. else
  1171. git clone git://github.com/synfig/synfig.git $PACKAGES_BUILDROOT/synfig.git
  1172. fi
  1173. fi
  1174. pushd $PACKAGES_BUILDROOT
  1175. cd synfig.git && git fetch && cd ..
  1176. #[ ! -e git-$GITVERSION.tar.bz2 ] && wget -c http://kernel.org/pub/software/scm/git/git-$GITVERSION.tar.bz2
  1177. rsync -av rsync://download.tuxfamily.org/pub/synfig/packages/sources/base/ ./
  1178. if [[ $OPENGL == 1 ]]; then
  1179. rsync -av rsync://download.tuxfamily.org/pub/synfig/packages/sources/opengl/ ./
  1180. fi
  1181. popd
  1182. #copy sources
  1183. [ -d $PACKAGES_BUILDROOT.$ARCH/source ] || mkdir -p $PACKAGES_BUILDROOT.$ARCH/source
  1184. cp -rf $PACKAGES_BUILDROOT/* $PACKAGES_BUILDROOT.$ARCH/source/
  1185. #set up the /proc link
  1186. echo "Mounting proc..."
  1187. if ! ( mount | egrep "proc on $PACKAGES_BUILDROOT.${ARCH}/proc" ); then
  1188. mount -o bind /proc $PACKAGES_BUILDROOT.$ARCH/proc
  1189. echo " Done."
  1190. else
  1191. echo " Already mounted. Skipping."
  1192. fi
  1193. #go to chroot
  1194. $SETARCH chroot $PACKAGES_BUILDROOT.$ARCH env http_proxy=$http_proxy bash /build.sh package $SELECTEDREVISION
  1195. umount $PACKAGES_BUILDROOT.$ARCH/proc || true
  1196. mv -f $PACKAGES_BUILDROOT.$ARCH/packages/* $PACKAGES_PATH
  1197. done
  1198. echo
  1199. echo
  1200. find $PACKAGES_PATH/synfigstudio* -maxdepth 1
  1201. echo " DONE BUILDING PACKAGES INTO $HOME/synfig-packages"
  1202. echo
  1203. fi
  1204. }
  1205. ###=================================== MAIN ======================================
  1206. if [ -z $1 ]; then
  1207. ARG='standart'
  1208. else
  1209. ARG=$1
  1210. fi
  1211. case $ARG in
  1212. full)
  1213. MODE='full'
  1214. mk
  1215. exit;;
  1216. standart)
  1217. MODE='standart'
  1218. mk
  1219. exit;;
  1220. quick)
  1221. MODE='quick'
  1222. mk
  1223. exit;;
  1224. package)
  1225. MODE='package'
  1226. get_dependencies
  1227. initialize
  1228. mk$ARG
  1229. exit;;
  1230. *)
  1231. if [ -e /etc/chroot.id ]; then
  1232. MODE='package'
  1233. else
  1234. MODE='standart'
  1235. fi
  1236. initialize
  1237. mk$ARG
  1238. exit;;
  1239. esac