install_deps.sh 115 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418
  1. #!/usr/bin/env bash
  2. # ##### BEGIN GPL LICENSE BLOCK #####
  3. #
  4. # This program is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU General Public License
  6. # as published by the Free Software Foundation; either version 2
  7. # of the License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software Foundation,
  16. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. #
  18. # ##### END GPL LICENSE BLOCK #####
  19. # A shell script installing/building all needed dependencies to build Blender, for some Linux distributions.
  20. ##### Args and Help Handling #####
  21. # Parse command line!
  22. ARGS=$( \
  23. getopt \
  24. -o s:i:t:h \
  25. --long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,use-cxx11,\
  26. with-all,with-opencollada,with-jack,\
  27. ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,\
  28. force-all,force-python,force-numpy,force-boost,\
  29. force-ocio,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
  30. force-ffmpeg,force-opencollada,force-alembic,\
  31. build-all,build-python,build-numpy,build-boost,\
  32. build-ocio,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
  33. build-ffmpeg,build-opencollada,build-alembic,\
  34. skip-python,skip-numpy,skip-boost,\
  35. skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
  36. skip-ffmpeg,skip-opencollada,skip-alembic \
  37. -- "$@" \
  38. )
  39. COMMANDLINE=$@
  40. DISTRO=""
  41. RPM=""
  42. SRC="$HOME/src/blender-deps"
  43. INST="/opt/lib"
  44. TMP="/tmp"
  45. CWD=$PWD
  46. INFO_PATH=$CWD
  47. SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
  48. # Do not install some optional, potentially conflicting libs by default...
  49. WITH_ALL=false
  50. # Do not yet enable opencollada, use --with-opencollada (or --with-all) option to try it.
  51. WITH_OPENCOLLADA=false
  52. THREADS=$(nproc)
  53. COMMON_INFO="\"Source code of dependencies needed to be compiled will be downloaded and extracted into '\$SRC'.
  54. Built libs of dependencies needed to be compiled will be installed into '\$INST'.
  55. Please edit \\\$SRC and/or \\\$INST variables at the beginning of this script,
  56. or use --source/--install options, if you want to use other paths!
  57. Number of threads for building: \$THREADS (automatically detected, use --threads=<nbr> to override it).
  58. Full install: \$WITH_ALL (use --with-all option to enable it).
  59. Building OpenCOLLADA: \$WITH_OPENCOLLADA (use --with-opencollada option to enable it).
  60. Example:
  61. Full install without OpenCOLLADA: --with-all --skip-opencollada
  62. Use --help to show all available options!\""
  63. ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
  64. -h, --help
  65. Show this message and exit.
  66. --show-deps
  67. Show main dependencies of Blender (including officially supported versions) and exit.
  68. -s <path>, --source=<path>
  69. Use a specific path where to store downloaded libraries sources (defaults to '\$SRC').
  70. -i <path>, --install=<path>
  71. Use a specific path where to install built libraries (defaults to '\$INST').
  72. --tmp=<path>
  73. Use a specific temp path (defaults to '\$TMP').
  74. --info=<path>
  75. Use a specific info path (to store BUILD_NOTES.txt, defaults to '\$INFO_PATH').
  76. -t n, --threads=n
  77. Use a specific number of threads when building the libraries (auto-detected as '\$THREADS').
  78. --no-sudo
  79. Disable use of sudo (this script won't be able to do much though, will just print needed packages...).
  80. --no-build
  81. Do not build (compile) anything, dependencies not installable with the package manager will remain missing.
  82. --no-confirm
  83. Disable any interaction with user (suitable for automated run).
  84. --use-cxx11
  85. Build all libraries in cpp11 'mode' (will be mandatory soon in blender2.8 branch).
  86. NOTE: If your compiler is gcc-6.0 or above, you probably *want* to enable this option (since it's default
  87. standard starting from this version).
  88. --with-all
  89. By default, a number of optional and not-so-often needed libraries are not installed.
  90. This option will try to install them, at the cost of potential conflicts (depending on
  91. how your package system is set…).
  92. Note this option also implies all other (more specific) --with-foo options below.
  93. --with-opencollada
  94. Build and install the OpenCOLLADA libraries.
  95. --with-jack
  96. Install the jack libraries.
  97. --ver-ocio=<ver>
  98. Force version of OCIO library.
  99. --ver-oiio=<ver>
  100. Force version of OIIO library.
  101. --ver-llvm=<ver>
  102. Force version of LLVM library.
  103. --ver-osl=<ver>
  104. Force version of OSL library.
  105. --ver-osd=<ver>
  106. Force version of OSD library.
  107. --ver-openvdb=<ver>
  108. Force version of OpenVDB library.
  109. Note about the --ver-foo options:
  110. It may not always work as expected (some libs are actually checked out from a git rev...), yet it might help
  111. to fix some build issues (like LLVM mismatch with the version used by your graphic system).
  112. --build-all
  113. Force the build of all possible libraries.
  114. --build-python
  115. Force the build of Python.
  116. --build-numpy
  117. Force the build of NumPy.
  118. --build-boost
  119. Force the build of Boost.
  120. --build-ocio
  121. Force the build of OpenColorIO.
  122. --build-openexr
  123. Force the build of OpenEXR.
  124. --build-oiio
  125. Force the build of OpenImageIO.
  126. --build-llvm
  127. Force the build of LLVM.
  128. --build-osl
  129. Force the build of OpenShadingLanguage.
  130. --build-osd
  131. Force the build of OpenSubdiv.
  132. --build-openvdb
  133. Force the build of OpenVDB.
  134. --build-alembic
  135. Force the build of Alembic.
  136. --build-opencollada
  137. Force the build of OpenCOLLADA.
  138. --build-ffmpeg
  139. Force the build of FFMpeg.
  140. Note about the --build-foo options:
  141. * They force the script to prefer building dependencies rather than using available packages.
  142. This may make things simpler and allow working around some distribution bugs, but on the other hand it will
  143. use much more space on your hard drive.
  144. * Please be careful with the Blender building options if you have both 'official' dev packages and
  145. install_deps' built ones on your system, by default CMake will prefer official packages, which may lead to
  146. linking issues. Please ensure your CMake configuration always uses all correct library paths.
  147. * If the “force-built” library is a dependency of others, it will force the build
  148. of those libraries as well (e.g. --build-boost also implies --build-oiio and --build-osl...).
  149. --force-all
  150. Force the rebuild of all built libraries.
  151. --force-python
  152. Force the rebuild of Python.
  153. --force-numpy
  154. Force the rebuild of NumPy.
  155. --force-boost
  156. Force the rebuild of Boost.
  157. --force-ocio
  158. Force the rebuild of OpenColorIO.
  159. --force-openexr
  160. Force the rebuild of OpenEXR.
  161. --force-oiio
  162. Force the rebuild of OpenImageIO.
  163. --force-llvm
  164. Force the rebuild of LLVM.
  165. --force-osl
  166. Force the rebuild of OpenShadingLanguage.
  167. --force-osd
  168. Force the rebuild of OpenSubdiv.
  169. --force-openvdb
  170. Force the rebuild of OpenVDB.
  171. --force-alembic
  172. Force the rebuild of Alembic.
  173. --force-opencollada
  174. Force the rebuild of OpenCOLLADA.
  175. --force-ffmpeg
  176. Force the rebuild of FFMpeg.
  177. Note about the --force-foo options:
  178. * They obviously only have an effect if those libraries are built by this script
  179. (i.e. if there is no available and satisfactory package)!
  180. * If the “force-rebuilt” library is a dependency of others, it will force the rebuild
  181. of those libraries too (e.g. --force-boost will also rebuild oiio and osl...).
  182. --skip-python
  183. Unconditionally skip Python installation/building.
  184. --skip-numpy
  185. Unconditionally skip NumPy installation/building.
  186. --skip-boost
  187. Unconditionally skip Boost installation/building.
  188. --skip-ocio
  189. Unconditionally skip OpenColorIO installation/building.
  190. --skip-openexr
  191. Unconditionally skip OpenEXR installation/building.
  192. --skip-oiio
  193. Unconditionally skip OpenImageIO installation/building.
  194. --skip-llvm
  195. Unconditionally skip LLVM installation/building.
  196. --skip-osl
  197. Unconditionally skip OpenShadingLanguage installation/building.
  198. --skip-osd
  199. Unconditionally skip OpenSubdiv installation/building.
  200. --skip-openvdb
  201. Unconditionally skip OpenVDB installation/building.
  202. --skip-alembic
  203. Unconditionally skip Alembic installation/building.
  204. --skip-opencollada
  205. Unconditionally skip OpenCOLLADA installation/building.
  206. --skip-ffmpeg
  207. Unconditionally skip FFMpeg installation/building.\""
  208. ##### Main Vars #####
  209. DO_SHOW_DEPS=false
  210. SUDO="sudo"
  211. NO_BUILD=false
  212. NO_CONFIRM=false
  213. USE_CXX11=false
  214. PYTHON_VERSION="3.5.3"
  215. PYTHON_VERSION_MIN="3.5"
  216. PYTHON_FORCE_BUILD=false
  217. PYTHON_FORCE_REBUILD=false
  218. PYTHON_SKIP=false
  219. NUMPY_VERSION="1.10.1"
  220. NUMPY_VERSION_MIN="1.8"
  221. NUMPY_FORCE_BUILD=false
  222. NUMPY_FORCE_REBUILD=false
  223. NUMPY_SKIP=false
  224. BOOST_VERSION="1.60.0"
  225. BOOST_VERSION_MIN="1.49"
  226. BOOST_FORCE_BUILD=false
  227. BOOST_FORCE_REBUILD=false
  228. BOOST_SKIP=false
  229. OCIO_VERSION="1.0.9"
  230. OCIO_VERSION_MIN="1.0"
  231. OCIO_FORCE_BUILD=false
  232. OCIO_FORCE_REBUILD=false
  233. OCIO_SKIP=false
  234. OPENEXR_VERSION="2.2.0"
  235. OPENEXR_VERSION_MIN="2.0.1"
  236. ILMBASE_VERSION="2.2.0"
  237. ILMBASE_VERSION_MIN="2.2"
  238. OPENEXR_FORCE_BUILD=false
  239. OPENEXR_FORCE_REBUILD=false
  240. OPENEXR_SKIP=false
  241. _with_built_openexr=false
  242. OIIO_VERSION="1.7.15"
  243. OIIO_VERSION_MIN="1.7.15"
  244. OIIO_VERSION_MAX="1.9.0" # UNKNOWN currently # Not supported by current OSL...
  245. OIIO_FORCE_BUILD=false
  246. OIIO_FORCE_REBUILD=false
  247. OIIO_SKIP=false
  248. LLVM_VERSION="3.4"
  249. LLVM_VERSION_MIN="3.4"
  250. LLVM_VERSION_FOUND=""
  251. LLVM_FORCE_BUILD=false
  252. LLVM_FORCE_REBUILD=false
  253. LLVM_SKIP=false
  254. # OSL needs to be compiled for now!
  255. OSL_VERSION="1.7.5"
  256. OSL_VERSION_MIN=$OSL_VERSION
  257. OSL_FORCE_BUILD=false
  258. OSL_FORCE_REBUILD=false
  259. OSL_SKIP=false
  260. # OpenSubdiv needs to be compiled for now
  261. OSD_VERSION="3.1.1"
  262. OSD_VERSION_MIN=$OSD_VERSION
  263. OSD_FORCE_BUILD=false
  264. OSD_FORCE_REBUILD=false
  265. OSD_SKIP=false
  266. # OpenVDB needs to be compiled for now
  267. OPENVDB_BLOSC_VERSION="1.7.0"
  268. OPENVDB_VERSION="3.1.0"
  269. OPENVDB_VERSION_MIN=$OPENVDB_VERSION
  270. OPENVDB_FORCE_BUILD=false
  271. OPENVDB_FORCE_REBUILD=false
  272. OPENVDB_SKIP=false
  273. # Alembic needs to be compiled for now
  274. ALEMBIC_VERSION="1.7.1"
  275. ALEMBIC_VERSION_MIN=$ALEMBIC_VERSION
  276. ALEMBIC_FORCE_BUILD=false
  277. ALEMBIC_FORCE_REBUILD=false
  278. ALEMBIC_SKIP=false
  279. OPENCOLLADA_VERSION="1.6.51"
  280. OPENCOLLADA_FORCE_BUILD=false
  281. OPENCOLLADA_FORCE_REBUILD=false
  282. OPENCOLLADA_SKIP=false
  283. FFMPEG_VERSION="3.2.1"
  284. FFMPEG_VERSION_MIN="2.8.4"
  285. FFMPEG_FORCE_BUILD=false
  286. FFMPEG_FORCE_REBUILD=false
  287. FFMPEG_SKIP=false
  288. _ffmpeg_list_sep=";"
  289. # FFMPEG optional libs.
  290. VORBIS_USE=false
  291. VORBIS_DEV=""
  292. OGG_USE=false
  293. OGG_DEV=""
  294. THEORA_USE=false
  295. THEORA_DEV=""
  296. XVID_USE=false
  297. XVID_DEV=""
  298. X264_USE=false
  299. X264_DEV=""
  300. X264_VERSION_MIN=0.118
  301. VPX_USE=false
  302. VPX_VERSION_MIN=0.9.7
  303. VPX_DEV=""
  304. MP3LAME_USE=false
  305. MP3LAME_DEV=""
  306. OPENJPEG_USE=false
  307. OPENJPEG_DEV=""
  308. # Whether to use system GLEW or not (OpenSubDiv needs recent glew to work).
  309. NO_SYSTEM_GLEW=false
  310. # Switch to english language, else some things (like check_package_DEB()) won't work!
  311. LANG_BACK=$LANG
  312. LANG=""
  313. export LANG
  314. ##### Generic Helpers #####
  315. BLACK=$(tput setaf 0)
  316. RED=$(tput setaf 1)
  317. GREEN=$(tput setaf 2)
  318. YELLOW=$(tput setaf 3)
  319. LIME_YELLOW=$(tput setaf 190)
  320. POWDER_BLUE=$(tput setaf 153)
  321. BLUE=$(tput setaf 4)
  322. MAGENTA=$(tput setaf 5)
  323. CYAN=$(tput setaf 6)
  324. WHITE=$(tput setaf 7)
  325. BRIGHT=$(tput bold)
  326. NORMAL=$(tput sgr0)
  327. BLINK=$(tput blink)
  328. REVERSE=$(tput smso)
  329. UNDERLINE=$(tput smul)
  330. _echo() {
  331. if [ "X$1" = "X-n" ]; then
  332. shift; printf "%s" "$@"
  333. else
  334. printf "%s\n" "$@"
  335. fi
  336. }
  337. ERROR() {
  338. _echo "${BRIGHT}${RED}ERROR! ${NORMAL}${RED}$@${NORMAL}"
  339. }
  340. WARNING() {
  341. _echo "${BRIGHT}${YELLOW}WARNING! ${NORMAL}${YELLOW}$@${NORMAL}"
  342. }
  343. INFO() {
  344. _echo "${GREEN}$@${NORMAL}"
  345. }
  346. PRINT() {
  347. _echo "$@"
  348. }
  349. ##### Args Handling #####
  350. # Finish parsing the commandline args.
  351. eval set -- "$ARGS"
  352. while true; do
  353. case $1 in
  354. -s|--source)
  355. SRC="$2"; shift; shift; continue
  356. ;;
  357. -i|--install)
  358. INST="$2"; shift; shift; continue
  359. ;;
  360. --tmp)
  361. TMP="$2"; shift; shift; continue
  362. ;;
  363. --info)
  364. INFO_PATH="$2"; shift; shift; continue
  365. ;;
  366. -t|--threads)
  367. THREADS="$2"; shift; shift; continue
  368. ;;
  369. -h|--help)
  370. PRINT ""
  371. PRINT "USAGE:"
  372. PRINT ""
  373. PRINT "`eval _echo "$COMMON_INFO"`"
  374. PRINT ""
  375. PRINT "`eval _echo "$ARGUMENTS_INFO"`"
  376. PRINT ""
  377. exit 0
  378. ;;
  379. --show-deps)
  380. # We have to defer...
  381. DO_SHOW_DEPS=true; shift; continue
  382. ;;
  383. --no-sudo)
  384. PRINT ""
  385. WARNING "--no-sudo enabled, this script might not be able to do much..."
  386. PRINT ""
  387. SUDO=""; shift; continue
  388. ;;
  389. --no-build)
  390. PRINT ""
  391. WARNING "--no-build enabled, this script will not be able to install all dependencies..."
  392. PRINT ""
  393. NO_BUILD=true; shift; continue
  394. ;;
  395. --no-confirm)
  396. NO_CONFIRM=true; shift; continue
  397. ;;
  398. --use-cxx11)
  399. USE_CXX11=true; shift; continue
  400. ;;
  401. --with-all)
  402. WITH_ALL=true; shift; continue
  403. ;;
  404. --with-opencollada)
  405. WITH_OPENCOLLADA=true; shift; continue
  406. ;;
  407. --with-jack)
  408. WITH_JACK=true; shift; continue;
  409. ;;
  410. --ver-ocio)
  411. OCIO_VERSION="$2"
  412. OCIO_VERSION_MIN=$OCIO_VERSION
  413. shift; shift; continue
  414. ;;
  415. --ver-oiio)
  416. OIIO_VERSION="$2"
  417. OIIO_VERSION_MIN=$OIIO_VERSION
  418. shift; shift; continue
  419. ;;
  420. --ver-llvm)
  421. LLVM_VERSION="$2"
  422. LLVM_VERSION_MIN=$LLVM_VERSION
  423. shift; shift; continue
  424. ;;
  425. --ver-osl)
  426. OSL_VERSION="$2"
  427. OSL_VERSION_MIN=$OSL_VERSION
  428. shift; shift; continue
  429. ;;
  430. --ver-osd)
  431. OSD_VERSION="$2"
  432. OSD_VERSION_MIN=$OSD_VERSION
  433. shift; shift; continue
  434. ;;
  435. --ver-openvdb)
  436. OPENVDB_VERSION="$2"
  437. OPENVDB_VERSION_MIN=$OPENVDB_VERSION
  438. shift; shift; continue
  439. ;;
  440. --build-all)
  441. PYTHON_FORCE_BUILD=true
  442. NUMPY_FORCE_BUILD=true
  443. BOOST_FORCE_BUILD=true
  444. OCIO_FORCE_BUILD=true
  445. OPENEXR_FORCE_BUILD=true
  446. OIIO_FORCE_BUILD=true
  447. LLVM_FORCE_BUILD=true
  448. OSL_FORCE_BUILD=true
  449. OSD_FORCE_BUILD=true
  450. OPENVDB_FORCE_BUILD=true
  451. OPENCOLLADA_FORCE_BUILD=true
  452. FFMPEG_FORCE_BUILD=true
  453. ALEMBIC_FORCE_BUILD=true
  454. shift; continue
  455. ;;
  456. --build-python)
  457. PYTHON_FORCE_BUILD=true
  458. NUMPY_FORCE_BUILD=true
  459. shift; continue
  460. ;;
  461. --build-numpy)
  462. PYTHON_FORCE_BUILD=true
  463. NUMPY_FORCE_BUILD=true
  464. shift; continue
  465. ;;
  466. --build-boost)
  467. BOOST_FORCE_BUILD=true; shift; continue
  468. ;;
  469. --build-ocio)
  470. OCIO_FORCE_BUILD=true; shift; continue
  471. ;;
  472. --build-openexr)
  473. OPENEXR_FORCE_BUILD=true; shift; continue
  474. ;;
  475. --build-oiio)
  476. OIIO_FORCE_BUILD=true; shift; continue
  477. ;;
  478. --build-llvm)
  479. LLVM_FORCE_BUILD=true; shift; continue
  480. ;;
  481. --build-osl)
  482. OSL_FORCE_BUILD=true; shift; continue
  483. ;;
  484. --build-osd)
  485. OSD_FORCE_BUILD=true; shift; continue
  486. ;;
  487. --build-openvdb)
  488. OPENVDB_FORCE_BUILD=true; shift; continue
  489. ;;
  490. --build-opencollada)
  491. OPENCOLLADA_FORCE_BUILD=true; shift; continue
  492. ;;
  493. --build-ffmpeg)
  494. FFMPEG_FORCE_BUILD=true; shift; continue
  495. ;;
  496. --build-alembic)
  497. ALEMBIC_FORCE_BUILD=true; shift; continue
  498. ;;
  499. --force-all)
  500. PYTHON_FORCE_REBUILD=true
  501. NUMPY_FORCE_REBUILD=true
  502. BOOST_FORCE_REBUILD=true
  503. OCIO_FORCE_REBUILD=true
  504. OPENEXR_FORCE_REBUILD=true
  505. OIIO_FORCE_REBUILD=true
  506. LLVM_FORCE_REBUILD=true
  507. OSL_FORCE_REBUILD=true
  508. OSD_FORCE_REBUILD=true
  509. OPENVDB_FORCE_REBUILD=true
  510. OPENCOLLADA_FORCE_REBUILD=true
  511. FFMPEG_FORCE_REBUILD=true
  512. ALEMBIC_FORCE_REBUILD=true
  513. shift; continue
  514. ;;
  515. --force-python)
  516. PYTHON_FORCE_REBUILD=true
  517. NUMPY_FORCE_REBUILD=true
  518. shift; continue
  519. ;;
  520. --force-numpy)
  521. NUMPY_FORCE_REBUILD=true; shift; continue
  522. ;;
  523. --force-boost)
  524. BOOST_FORCE_REBUILD=true; shift; continue
  525. ;;
  526. --force-ocio)
  527. OCIO_FORCE_REBUILD=true; shift; continue
  528. ;;
  529. --force-openexr)
  530. OPENEXR_FORCE_REBUILD=true; shift; continue
  531. ;;
  532. --force-oiio)
  533. OIIO_FORCE_REBUILD=true; shift; continue
  534. ;;
  535. --force-llvm)
  536. LLVM_FORCE_REBUILD=true; shift; continue
  537. ;;
  538. --force-osl)
  539. OSL_FORCE_REBUILD=true; shift; continue
  540. ;;
  541. --force-osd)
  542. OSD_FORCE_REBUILD=true; shift; continue
  543. ;;
  544. --force-openvdb)
  545. OPENVDB_FORCE_REBUILD=true; shift; continue
  546. ;;
  547. --force-opencollada)
  548. OPENCOLLADA_FORCE_REBUILD=true; shift; continue
  549. ;;
  550. --force-ffmpeg)
  551. FFMPEG_FORCE_REBUILD=true; shift; continue
  552. ;;
  553. --force-alembic)
  554. ALEMBIC_FORCE_REBUILD=true; shift; continue
  555. ;;
  556. --skip-python)
  557. PYTHON_SKIP=true; shift; continue
  558. ;;
  559. --skip-numpy)
  560. NUMPY_SKIP=true; shift; continue
  561. ;;
  562. --skip-boost)
  563. BOOST_SKIP=true; shift; continue
  564. ;;
  565. --skip-ocio)
  566. OCIO_SKIP=true; shift; continue
  567. ;;
  568. --skip-openexr)
  569. OPENEXR_SKIP=true; shift; continue
  570. ;;
  571. --skip-oiio)
  572. OIIO_SKIP=true; shift; continue
  573. ;;
  574. --skip-llvm)
  575. LLVM_SKIP=true; shift; continue
  576. ;;
  577. --skip-osl)
  578. OSL_SKIP=true; shift; continue
  579. ;;
  580. --skip-osd)
  581. OSD_SKIP=true; shift; continue
  582. ;;
  583. --skip-openvdb)
  584. OPENVDB_SKIP=true; shift; continue
  585. ;;
  586. --skip-opencollada)
  587. OPENCOLLADA_SKIP=true; shift; continue
  588. ;;
  589. --skip-ffmpeg)
  590. FFMPEG_SKIP=true; shift; continue
  591. ;;
  592. --skip-alembic)
  593. ALEMBIC_SKIP=true; shift; continue
  594. ;;
  595. --)
  596. # no more arguments to parse
  597. break
  598. ;;
  599. *)
  600. PRINT ""
  601. ERROR "Wrong parameter! Usage:"
  602. PRINT ""
  603. PRINT "`eval _echo "$COMMON_INFO"`"
  604. PRINT ""
  605. exit 1
  606. ;;
  607. esac
  608. done
  609. if [ "$WITH_ALL" = true -a "$OPENCOLLADA_SKIP" = false ]; then
  610. WITH_OPENCOLLADA=true
  611. fi
  612. if [ "$WITH_ALL" = true ]; then
  613. WITH_JACK=true
  614. fi
  615. WARNING "****WARNING****"
  616. PRINT "If you are experiencing issues building Blender, _*TRY A FRESH, CLEAN BUILD FIRST*_!"
  617. PRINT "The same goes for install_deps itself, if you encounter issues, please first erase everything in $SRC and $INST"
  618. PRINT "(provided obviously you did not add anything yourself in those dirs!), and run install_deps.sh again!"
  619. PRINT "Often, changes in the libs built by this script, or in your distro package, cannot be handled simply, so..."
  620. PRINT ""
  621. PRINT "You may also try to use the '--build-foo' options to bypass your distribution's packages"
  622. PRINT "for some troublesome/buggy libraries..."
  623. PRINT ""
  624. PRINT ""
  625. PRINT "Ran with:"
  626. PRINT " install_deps.sh $COMMANDLINE"
  627. PRINT ""
  628. PRINT ""
  629. # This has to be done here, because user might force some versions...
  630. PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" )
  631. NUMPY_SOURCE=( "http://sourceforge.net/projects/numpy/files/NumPy/$NUMPY_VERSION/numpy-$NUMPY_VERSION.tar.gz" )
  632. _boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
  633. BOOST_SOURCE=( "http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download" )
  634. BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options"
  635. OCIO_USE_REPO=true
  636. OCIO_SOURCE=( "https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION" )
  637. OCIO_SOURCE_REPO=( "https://github.com/imageworks/OpenColorIO.git" )
  638. OCIO_SOURCE_REPO_UID="6de971097c7f552300f669ed69ca0b6cf5a70843"
  639. OPENEXR_USE_REPO=false
  640. OPENEXR_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/openexr-$OPENEXR_VERSION.tar.gz" )
  641. OPENEXR_SOURCE_REPO=( "https://github.com/mont29/openexr.git" )
  642. OPENEXR_SOURCE_REPO_UID="2787aa1cf652d244ed45ae124eb1553f6cff11ee"
  643. ILMBASE_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/ilmbase-$ILMBASE_VERSION.tar.gz" )
  644. OIIO_USE_REPO=false
  645. OIIO_SOURCE=( "https://github.com/OpenImageIO/oiio/archive/Release-$OIIO_VERSION.tar.gz" )
  646. OIIO_SOURCE_REPO=( "https://github.com/OpenImageIO/oiio.git" )
  647. OIIO_SOURCE_REPO_UID="c9e67275a0b248ead96152f6d2221cc0c0f278a4"
  648. LLVM_SOURCE=( "http://releases.llvm.org/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz" )
  649. LLVM_CLANG_SOURCE=( "http://releases.llvm.org/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz" "http://llvm.org/releases/$LLVM_VERSION/cfe-$LLVM_VERSION.src.tar.gz" )
  650. OSL_USE_REPO=false
  651. OSL_SOURCE=( "https://github.com/imageworks/OpenShadingLanguage/archive/Release-$OSL_VERSION.tar.gz" )
  652. #~ OSL_SOURCE=( "https://github.com/Nazg-Gul/OpenShadingLanguage/archive/Release-1.5.11.tar.gz" )
  653. #~ OSL_SOURCE_REPO=( "https://github.com/imageworks/OpenShadingLanguage.git" )
  654. #~ OSL_SOURCE_REPO=( "https://github.com/mont29/OpenShadingLanguage.git" )
  655. #~ OSL_SOURCE_REPO_UID="85179714e1bc69cd25ecb6bb711c1a156685d395"
  656. #~ OSL_SOURCE_REPO_BRANCH="master"
  657. OSL_SOURCE_REPO=( "https://github.com/Nazg-Gul/OpenShadingLanguage.git" )
  658. OSL_SOURCE_REPO_UID="7d40ff5fe8e47b030042afb92d0e955f5aa96f48"
  659. OSL_SOURCE_REPO_BRANCH="blender-fixes"
  660. OSD_USE_REPO=false
  661. # Script foo to make the version string compliant with the archive name:
  662. # ${Varname//SearchForThisChar/ReplaceWithThisChar}
  663. OSD_SOURCE=( "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v${OSD_VERSION//./_}.tar.gz" )
  664. OSD_SOURCE_REPO=( "https://github.com/PixarAnimationStudios/OpenSubdiv.git" )
  665. OSD_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
  666. OSD_SOURCE_REPO_BRANCH="dev"
  667. OPENVDB_USE_REPO=false
  668. OPENVDB_BLOSC_SOURCE=( "https://github.com/Blosc/c-blosc/archive/v${OPENVDB_BLOSC_VERSION}.tar.gz" )
  669. OPENVDB_SOURCE=( "https://github.com/dreamworksanimation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz" )
  670. #~ OPENVDB_SOURCE_REPO=( "https:///dreamworksanimation/openvdb.git" )
  671. #~ OPENVDB_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
  672. #~ OPENVDB_SOURCE_REPO_BRANCH="dev"
  673. ALEMBIC_USE_REPO=false
  674. ALEMBIC_SOURCE=( "https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.tar.gz" )
  675. # ALEMBIC_SOURCE_REPO=( "https://github.com/alembic/alembic.git" )
  676. # ALEMBIC_SOURCE_REPO_UID="e6c90d4faa32c4550adeaaf3f556dad4b73a92bb"
  677. # ALEMBIC_SOURCE_REPO_BRANCH="master"
  678. OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
  679. OPENCOLLADA_REPO_UID="0c2cdc17c22cf42050e4d42154bed2176363549c"
  680. OPENCOLLADA_REPO_BRANCH="master"
  681. FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
  682. CXXFLAGS_BACK=$CXXFLAGS
  683. if [ "$USE_CXX11" = true ]; then
  684. WARNING "You are trying to use c++11, this *should* go smoothely with any very recent distribution
  685. However, if you are experiencing linking errors (also when building Blender itself), please try the following:
  686. * Re-run this script with '--build-all --force-all' options.
  687. * Ensure your gcc version is at the very least 4.8, if possible you should really rather use gcc-5.1 or above.
  688. Please note that until the transition to C++11-built libraries if completed in your distribution, situation will
  689. remain fuzzy and incompatibilities may happen..."
  690. PRINT ""
  691. PRINT ""
  692. CXXFLAGS="$CXXFLAGS -std=c++11"
  693. export CXXFLAGS
  694. fi
  695. #### Show Dependencies ####
  696. # Need those to be after we defined versions...
  697. DEPS_COMMON_INFO="\"COMMON DEPENDENCIES:
  698. Those libraries should be available as packages in all recent distributions (optional ones are [between brackets]):
  699. * Basics of dev environment (cmake, gcc, svn , git, ...).
  700. * libjpeg, libpng, libtiff, [libopenjpeg], [libopenal].
  701. * libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
  702. * libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
  703. * libsdl1.2, libglew, [libglewmx].\""
  704. DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
  705. The following libraries will probably not all be available as packages in your distribution
  706. (install_deps will by default try to install packages, and fall back to building missing ones).
  707. You can force install_deps to build those with '--build-all' or relevant 'build-foo' options, see '--help' message.
  708. You may also want to build them yourself (optional ones are [between brackets]):
  709. * Python $PYTHON_VERSION_MIN (from $PYTHON_SOURCE).
  710. * [NumPy $NUMPY_VERSION_MIN] (from $NUMPY_SOURCE).
  711. * Boost $BOOST_VERSION_MIN (from $BOOST_SOURCE, modules: $BOOST_BUILD_MODULES).
  712. * [FFMpeg $FFMPEG_VERSION_MIN (needs libvorbis, libogg, libtheora, libx264, libmp3lame, libxvidcore, libvpx, ...)] (from $FFMPEG_SOURCE).
  713. * [OpenColorIO $OCIO_VERSION_MIN] (from $OCIO_SOURCE).
  714. * ILMBase $ILMBASE_VERSION_MIN (from $ILMBASE_SOURCE).
  715. * OpenEXR $OPENEXR_VERSION_MIN (from $OPENEXR_SOURCE).
  716. * OpenImageIO $OIIO_VERSION_MIN (from $OIIO_SOURCE).
  717. * [LLVM $LLVM_VERSION_MIN (with clang)] (from $LLVM_SOURCE, and $LLVM_CLANG_SOURCE).
  718. * [OpenShadingLanguage $OSL_VERSION_MIN] (from $OSL_SOURCE_REPO, branch $OSL_SOURCE_REPO_BRANCH, commit $OSL_SOURCE_REPO_UID).
  719. * [OpenSubDiv $OSD_VERSION_MIN] (from $OSD_SOURCE_REPO, branch $OSD_SOURCE_REPO_BRANCH, commit $OSD_SOURCE_REPO_UID).
  720. * [OpenVDB $OPENVDB_VERSION_MIN] (from $OPENVDB_SOURCE), [Blosc $OPENVDB_BLOSC_VERSION] (from $OPENVDB_BLOSC_SOURCE).
  721. * [OpenCollada] (from $OPENCOLLADA_SOURCE, branch $OPENCOLLADA_REPO_BRANCH, commit $OPENCOLLADA_REPO_UID).
  722. * [Alembic $ALEMBIC_VERSION] (from $ALEMBIC_SOURCE).\""
  723. if [ "$DO_SHOW_DEPS" = true ]; then
  724. PRINT ""
  725. PRINT "Blender dependencies (libraries needed to build it):"
  726. PRINT ""
  727. PRINT "`eval _echo "$DEPS_COMMON_INFO"`"
  728. PRINT ""
  729. PRINT "`eval _echo "$DEPS_SPECIFIC_INFO"`"
  730. PRINT ""
  731. exit 0
  732. fi
  733. ##### Generic Helpers #####
  734. # Check return code of wget for success...
  735. download() {
  736. declare -a sources=("${!1}")
  737. sources_count=${#sources[@]}
  738. error=1
  739. for (( i=0; $i < $sources_count; i++ ))
  740. do
  741. wget -c ${sources[$i]} -O $2
  742. if [ $? -eq 0 ]; then
  743. error=0
  744. break
  745. fi
  746. done
  747. if [ $error -eq 1 ]; then
  748. ERROR "wget could not find ${sources[@]}, or could not write it to $2, exiting"
  749. exit 1
  750. fi
  751. }
  752. # Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1.
  753. # $1 and $2 should be version numbers made of numbers only.
  754. version_eq() {
  755. backIFS=$IFS
  756. IFS='.'
  757. # Split both version numbers into their numeric elements.
  758. arr1=( $1 )
  759. arr2=( $2 )
  760. ret=1
  761. count1=${#arr1[@]}
  762. count2=${#arr2[@]}
  763. if [ $count2 -ge $count1 ]; then
  764. _t=$count1
  765. count1=$count2
  766. count2=$_t
  767. arr1=( $2 )
  768. arr2=( $1 )
  769. fi
  770. ret=0
  771. for (( i=0; $i < $count2; i++ ))
  772. do
  773. if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
  774. ret=1
  775. break
  776. fi
  777. done
  778. for (( i=$count2; $i < $count1; i++ ))
  779. do
  780. if [ $(( 10#${arr1[$i]} )) -ne 0 ]; then
  781. ret=1
  782. break
  783. fi
  784. done
  785. IFS=$backIFS
  786. return $ret
  787. }
  788. # Return 0 if $1 >= $2, else 1.
  789. # $1 and $2 should be version numbers made of numbers only.
  790. version_ge() {
  791. version_eq $1 $2
  792. if [ $? -eq 1 -a $(_echo "$1" "$2" | sort --version-sort | head --lines=1) = "$1" ]; then
  793. return 1
  794. else
  795. return 0
  796. fi
  797. }
  798. # Return 0 if $3 > $1 >= $2, else 1.
  799. # $1 and $2 should be version numbers made of numbers only.
  800. version_ge_lt() {
  801. version_ge $1 $3
  802. if [ $? -eq 0 ]; then
  803. return 1
  804. else
  805. version_ge $1 $2
  806. return $?
  807. fi
  808. }
  809. # Return 0 if $1 is into $2 (e.g. 3.3.2 is into 3.3, but not 3.3.0 or 3.3.5), else 1.
  810. # $1 and $2 should be version numbers made of numbers only.
  811. # $1 should be at least as long as $2!
  812. version_match() {
  813. backIFS=$IFS
  814. IFS='.'
  815. # Split both version numbers into their numeric elements.
  816. arr1=( $1 )
  817. arr2=( $2 )
  818. ret=1
  819. count1=${#arr1[@]}
  820. count2=${#arr2[@]}
  821. if [ $count1 -ge $count2 ]; then
  822. ret=0
  823. for (( i=0; $i < $count2; i++ ))
  824. do
  825. if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
  826. ret=1
  827. break
  828. fi
  829. done
  830. fi
  831. IFS=$backIFS
  832. return $ret
  833. }
  834. ##### Generic compile helpers #####
  835. prepare_opt() {
  836. INFO "Ensuring $INST exists and is writable by us"
  837. if [ ! $SUDO ]; then
  838. WARNING "--no-sudo enabled, might be impossible to create install dir..."
  839. fi
  840. if [ ! -d $INST ]; then
  841. $SUDO mkdir -p $INST
  842. fi
  843. if [ ! -w $INST ]; then
  844. $SUDO chown $USER $INST
  845. $SUDO chmod 775 $INST
  846. fi
  847. }
  848. # Check whether the current package needs to be recompiled, based on a dummy file containing a magic number in its name...
  849. magic_compile_check() {
  850. if [ -f $INST/.$1-magiccheck-$2-$USE_CXX11 ]; then
  851. return 0
  852. else
  853. return 1
  854. fi
  855. }
  856. magic_compile_set() {
  857. rm -f $INST/.$1-magiccheck-*
  858. touch $INST/.$1-magiccheck-$2-$USE_CXX11
  859. }
  860. # Note: should clean nicely in $INST, but not in $SRC, when we switch to a new version of a lib...
  861. _clean() {
  862. rm -rf `readlink -f $_inst_shortcut`
  863. # Only remove $_src dir when not using git repo (avoids to re-clone the whole repo every time!!!).
  864. if [ $_git == false ]; then
  865. rm -rf $_src
  866. fi
  867. rm -rf $_inst
  868. rm -rf $_inst_shortcut
  869. }
  870. _create_inst_shortcut() {
  871. rm -f $_inst_shortcut
  872. ln -s $_inst $_inst_shortcut
  873. }
  874. # ldconfig
  875. run_ldconfig() {
  876. _lib_path="$INST/$1/lib"
  877. _ldconf_path="/etc/ld.so.conf.d/$1.conf"
  878. PRINT ""
  879. if [ ! $SUDO ]; then
  880. WARNING "--no-sudo enabled, impossible to run ldconfig for $1, you'll have to do it yourself..."
  881. else
  882. INFO "Running ldconfig for $1..."
  883. $SUDO sh -c "echo \"$_lib_path\" > $_ldconf_path"
  884. $SUDO /sbin/ldconfig # XXX OpenSuse does not include sbin in command path with sudo!!!
  885. fi
  886. PRINT ""
  887. }
  888. #### Build Python ####
  889. _init_python() {
  890. _src=$SRC/Python-$PYTHON_VERSION
  891. _git=false
  892. _inst=$INST/python-$PYTHON_VERSION
  893. _inst_shortcut=$INST/python-$PYTHON_VERSION_MIN
  894. }
  895. clean_Python() {
  896. clean_Numpy
  897. _init_python
  898. _clean
  899. }
  900. compile_Python() {
  901. if [ "$NO_BUILD" = true ]; then
  902. WARNING "--no-build enabled, Python will not be compiled!"
  903. return
  904. fi
  905. # To be changed each time we make edits that would modify the compiled result!
  906. py_magic=1
  907. _init_python
  908. # Clean install if needed!
  909. magic_compile_check python-$PYTHON_VERSION $py_magic
  910. if [ $? -eq 1 -o "$PYTHON_FORCE_REBUILD" = true ]; then
  911. clean_Python
  912. fi
  913. if [ ! -d $_inst ]; then
  914. INFO "Building Python-$PYTHON_VERSION"
  915. prepare_opt
  916. if [ ! -d $_src ]; then
  917. mkdir -p $SRC
  918. download PYTHON_SOURCE[@] $_src.tgz
  919. INFO "Unpacking Python-$PYTHON_VERSION"
  920. tar -C $SRC -xf $_src.tgz
  921. fi
  922. cd $_src
  923. ./configure --prefix=$_inst --libdir=$_inst/lib --enable-ipv6 \
  924. --enable-loadable-sqlite-extensions --with-dbmliborder=bdb \
  925. --with-computed-gotos --with-pymalloc
  926. make -j$THREADS && make install
  927. make clean
  928. if [ -d $_inst ]; then
  929. _create_inst_shortcut
  930. else
  931. ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
  932. exit 1
  933. fi
  934. magic_compile_set python-$PYTHON_VERSION $py_magic
  935. cd $CWD
  936. INFO "Done compiling Python-$PYTHON_VERSION!"
  937. else
  938. INFO "Own Python-$PYTHON_VERSION is up to date, nothing to do!"
  939. INFO "If you want to force rebuild of this lib, use the --force-python option."
  940. fi
  941. }
  942. ##### Build Numpy #####
  943. _init_numpy() {
  944. _src=$SRC/numpy-$NUMPY_VERSION
  945. _git=false
  946. _inst=$INST/numpy-$NUMPY_VERSION
  947. _python=$INST/python-$PYTHON_VERSION
  948. _site=lib/python$PYTHON_VERSION_MIN/site-packages
  949. _inst_shortcut=$_python/$_site/numpy
  950. }
  951. clean_Numpy() {
  952. _init_numpy
  953. _clean
  954. }
  955. compile_Numpy() {
  956. if [ "$NO_BUILD" = true ]; then
  957. WARNING "--no-build enabled, Numpy will not be compiled!"
  958. return
  959. fi
  960. # To be changed each time we make edits that would modify the compiled result!
  961. numpy_magic=0
  962. _init_numpy
  963. # Clean install if needed!
  964. magic_compile_check numpy-$NUMPY_VERSION $numpy_magic
  965. if [ $? -eq 1 -o "$NUMPY_FORCE_REBUILD" = true ]; then
  966. clean_Numpy
  967. fi
  968. if [ ! -d $_inst ]; then
  969. INFO "Building Numpy-$NUMPY_VERSION"
  970. prepare_opt
  971. if [ ! -d $_src ]; then
  972. mkdir -p $SRC
  973. download NUMPY_SOURCE[@] $_src.tar.gz
  974. INFO "Unpacking Numpy-$NUMPY_VERSION"
  975. tar -C $SRC -xf $_src.tar.gz
  976. fi
  977. cd $_src
  978. $_python/bin/python3 setup.py install --prefix=$_inst
  979. if [ -d $_inst ]; then
  980. # Can't use _create_inst_shortcut here...
  981. rm -f $_inst_shortcut
  982. ln -s $_inst/$_site/numpy $_inst_shortcut
  983. else
  984. ERROR "Numpy-$NUMPY_VERSION failed to compile, exiting"
  985. exit 1
  986. fi
  987. magic_compile_set numpy-$NUMPY_VERSION $numpy_magic
  988. cd $CWD
  989. INFO "Done compiling Numpy-$NUMPY_VERSION!"
  990. else
  991. INFO "Own Numpy-$NUMPY_VERSION is up to date, nothing to do!"
  992. INFO "If you want to force rebuild of this lib, use the --force-numpy option."
  993. fi
  994. }
  995. #### Build Boost ####
  996. _init_boost() {
  997. _src=$SRC/boost-$BOOST_VERSION
  998. _git=false
  999. _inst=$INST/boost-$BOOST_VERSION
  1000. _inst_shortcut=$INST/boost
  1001. }
  1002. clean_Boost() {
  1003. _init_boost
  1004. _clean
  1005. }
  1006. compile_Boost() {
  1007. if [ "$NO_BUILD" = true ]; then
  1008. WARNING "--no-build enabled, Boost will not be compiled!"
  1009. return
  1010. fi
  1011. # To be changed each time we make edits that would modify the compiled result!
  1012. boost_magic=11
  1013. _init_boost
  1014. # Clean install if needed!
  1015. magic_compile_check boost-$BOOST_VERSION $boost_magic
  1016. if [ $? -eq 1 -o "$BOOST_FORCE_REBUILD" = true ]; then
  1017. clean_Boost
  1018. fi
  1019. if [ ! -d $_inst ]; then
  1020. INFO "Building Boost-$BOOST_VERSION"
  1021. # Rebuild dependecies as well!
  1022. OIIO_FORCE_BUILD=true
  1023. OIIO_FORCE_REBUILD=true
  1024. OSL_FORCE_BUILD=true
  1025. OSL_FORCE_REBUILD=true
  1026. OPENVDB_FORCE_BUILD=true
  1027. OPENVDB_FORCE_REBUILD=true
  1028. prepare_opt
  1029. if [ ! -d $_src ]; then
  1030. INFO "Downloading Boost-$BOOST_VERSION"
  1031. mkdir -p $SRC
  1032. download BOOST_SOURCE[@] $_src.tar.bz2
  1033. tar -C $SRC --transform "s,\w*,boost-$BOOST_VERSION,x" -xf $_src.tar.bz2
  1034. fi
  1035. cd $_src
  1036. if [ ! -f $_src/b2 ]; then
  1037. ./bootstrap.sh
  1038. fi
  1039. ./b2 -j$THREADS -a $BOOST_BUILD_MODULES \
  1040. --prefix=$_inst --disable-icu boost.locale.icu=off install
  1041. ./b2 --clean
  1042. if [ -d $_inst ]; then
  1043. _create_inst_shortcut
  1044. else
  1045. ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
  1046. exit 1
  1047. fi
  1048. magic_compile_set boost-$BOOST_VERSION $boost_magic
  1049. cd $CWD
  1050. INFO "Done compiling Boost-$BOOST_VERSION!"
  1051. else
  1052. INFO "Own Boost-$BOOST_VERSION is up to date, nothing to do!"
  1053. INFO "If you want to force rebuild of this lib, use the --force-boost option."
  1054. fi
  1055. # Just always run it, much simpler this way!
  1056. run_ldconfig "boost"
  1057. }
  1058. #### Build OCIO ####
  1059. _init_ocio() {
  1060. _src=$SRC/OpenColorIO-$OCIO_VERSION
  1061. if [ "$OCIO_USE_REPO" = true ]; then
  1062. _git=true
  1063. else
  1064. _git=false
  1065. fi
  1066. _inst=$INST/ocio-$OCIO_VERSION
  1067. _inst_shortcut=$INST/ocio
  1068. }
  1069. clean_OCIO() {
  1070. _init_ocio
  1071. _clean
  1072. }
  1073. compile_OCIO() {
  1074. if [ "$NO_BUILD" = true ]; then
  1075. WARNING "--no-build enabled, OpenColorIO will not be compiled!"
  1076. return
  1077. fi
  1078. # To be changed each time we make edits that would modify the compiled result!
  1079. ocio_magic=2
  1080. _init_ocio
  1081. # Clean install if needed!
  1082. magic_compile_check ocio-$OCIO_VERSION $ocio_magic
  1083. if [ $? -eq 1 -o "$OCIO_FORCE_REBUILD" = true ]; then
  1084. clean_OCIO
  1085. fi
  1086. if [ ! -d $_inst ]; then
  1087. INFO "Building OpenColorIO-$OCIO_VERSION"
  1088. prepare_opt
  1089. if [ ! -d $_src ]; then
  1090. INFO "Downloading OpenColorIO-$OCIO_VERSION"
  1091. mkdir -p $SRC
  1092. if [ "$OCIO_USE_REPO" = true ]; then
  1093. git clone ${OCIO_SOURCE_REPO[0]} $_src
  1094. else
  1095. download OCIO_SOURCE[@] $_src.tar.gz
  1096. INFO "Unpacking OpenColorIO-$OCIO_VERSION"
  1097. tar -C $SRC --transform "s,(.*/?)imageworks-OpenColorIO[^/]*(.*),\1OpenColorIO-$OCIO_VERSION\2,x" \
  1098. -xf $_src.tar.gz
  1099. fi
  1100. fi
  1101. cd $_src
  1102. if [ "$OCIO_USE_REPO" = true ]; then
  1103. # XXX For now, always update from latest repo...
  1104. git pull origin master
  1105. git checkout $OCIO_SOURCE_REPO_UID
  1106. git reset --hard
  1107. fi
  1108. # Always refresh the whole build!
  1109. if [ -d build ]; then
  1110. rm -rf build
  1111. fi
  1112. mkdir build
  1113. cd build
  1114. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1115. cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
  1116. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1117. cmake_d="$cmake_d -D OCIO_BUILD_APPS=OFF"
  1118. cmake_d="$cmake_d -D OCIO_BUILD_PYGLUE=OFF"
  1119. if file /bin/cp | grep -q '32-bit'; then
  1120. cflags="-fPIC -m32 -march=i686"
  1121. else
  1122. cflags="-fPIC"
  1123. fi
  1124. cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ..
  1125. make -j$THREADS && make install
  1126. # Force linking against static libs
  1127. rm -f $_inst/lib/*.so*
  1128. # Additional depencencies
  1129. cp ext/dist/lib/libtinyxml.a $_inst/lib
  1130. cp ext/dist/lib/libyaml-cpp.a $_inst/lib
  1131. make clean
  1132. if [ -d $_inst ]; then
  1133. _create_inst_shortcut
  1134. else
  1135. ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
  1136. exit 1
  1137. fi
  1138. magic_compile_set ocio-$OCIO_VERSION $ocio_magic
  1139. cd $CWD
  1140. INFO "Done compiling OpenColorIO-$OCIO_VERSION!"
  1141. else
  1142. INFO "Own OpenColorIO-$OCIO_VERSION is up to date, nothing to do!"
  1143. INFO "If you want to force rebuild of this lib, use the --force-ocio option."
  1144. fi
  1145. run_ldconfig "ocio"
  1146. }
  1147. #### Build ILMBase ####
  1148. _init_ilmbase() {
  1149. _src=$SRC/ILMBase-$ILMBASE_VERSION
  1150. _git=false
  1151. _inst=$TMP/ilmbase-$ILMBASE_VERSION
  1152. _inst_shortcut=$TMP/ilmbase
  1153. }
  1154. clean_ILMBASE() {
  1155. _init_ilmbase
  1156. _clean
  1157. }
  1158. compile_ILMBASE() {
  1159. if [ "$NO_BUILD" = true ]; then
  1160. WARNING "--no-build enabled, ILMBase will not be compiled!"
  1161. return
  1162. fi
  1163. # To be changed each time we make edits that would modify the compiled result!
  1164. ilmbase_magic=10
  1165. _init_ilmbase
  1166. # Clean install if needed!
  1167. magic_compile_check ilmbase-$ILMBASE_VERSION $ilmbase_magic
  1168. if [ $? -eq 1 -o "$OPENEXR_FORCE_REBUILD" = true ]; then
  1169. clean_ILMBASE
  1170. rm -rf $_openexr_inst
  1171. fi
  1172. if [ ! -d $_openexr_inst ]; then
  1173. INFO "Building ILMBase-$ILMBASE_VERSION"
  1174. # Rebuild dependecies as well!
  1175. OPENEXR_FORCE_BUILD=true
  1176. OPENEXR_FORCE_REBUILD=true
  1177. prepare_opt
  1178. if [ ! -d $_src ]; then
  1179. INFO "Downloading ILMBase-$ILMBASE_VERSION"
  1180. mkdir -p $SRC
  1181. download ILMBASE_SOURCE[@] $_src.tar.gz
  1182. INFO "Unpacking ILMBase-$ILMBASE_VERSION"
  1183. tar -C $SRC --transform "s,(.*/?)ilmbase-[^/]*(.*),\1ILMBase-$ILMBASE_VERSION\2,x" -xf $_src.tar.gz
  1184. fi
  1185. cd $_src
  1186. # Always refresh the whole build!
  1187. if [ -d build ]; then
  1188. rm -rf build
  1189. fi
  1190. mkdir build
  1191. cd build
  1192. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1193. cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
  1194. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1195. cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
  1196. cmake_d="$cmake_d -D NAMESPACE_VERSIONING=OFF" # VERY IMPORTANT!!!
  1197. if file /bin/cp | grep -q '32-bit'; then
  1198. cflags="-fPIC -m32 -march=i686"
  1199. else
  1200. cflags="-fPIC"
  1201. fi
  1202. cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ..
  1203. make -j$THREADS && make install
  1204. make clean
  1205. if [ -d $_inst ]; then
  1206. _create_inst_shortcut
  1207. else
  1208. ERROR "ILMBase-$ILMBASE_VERSION failed to compile, exiting"
  1209. exit 1
  1210. fi
  1211. cd $CWD
  1212. INFO "Done compiling ILMBase-$ILMBASE_VERSION!"
  1213. else
  1214. INFO "Own ILMBase-$ILMBASE_VERSION is up to date, nothing to do!"
  1215. INFO "If you want to force rebuild of this lib (and openexr), use the --force-openexr option."
  1216. fi
  1217. magic_compile_set ilmbase-$ILMBASE_VERSION $ilmbase_magic
  1218. }
  1219. #### Build OpenEXR ####
  1220. _init_openexr() {
  1221. _src=$SRC/OpenEXR-$OPENEXR_VERSION
  1222. _git=true
  1223. _inst=$_openexr_inst
  1224. _inst_shortcut=$INST/openexr
  1225. }
  1226. clean_OPENEXR() {
  1227. clean_ILMBASE
  1228. _init_openexr
  1229. _clean
  1230. }
  1231. compile_OPENEXR() {
  1232. if [ "$NO_BUILD" = true ]; then
  1233. WARNING "--no-build enabled, OpenEXR will not be compiled!"
  1234. return
  1235. fi
  1236. # To be changed each time we make edits that would modify the compiled result!
  1237. openexr_magic=14
  1238. # Clean install if needed!
  1239. magic_compile_check openexr-$OPENEXR_VERSION $openexr_magic
  1240. if [ $? -eq 1 -o "$OPENEXR_FORCE_REBUILD" = true ]; then
  1241. clean_OPENEXR
  1242. fi
  1243. _openexr_inst=$INST/openexr-$OPENEXR_VERSION
  1244. compile_ILMBASE
  1245. PRINT ""
  1246. _ilmbase_inst=$_inst_shortcut
  1247. _init_openexr
  1248. if [ ! -d $_inst ]; then
  1249. INFO "Building OpenEXR-$OPENEXR_VERSION"
  1250. # Rebuild dependecies as well!
  1251. OIIO_FORCE_BUILD=true
  1252. OIIO_FORCE_REBUILD=true
  1253. prepare_opt
  1254. if [ ! -d $_src ]; then
  1255. INFO "Downloading OpenEXR-$OPENEXR_VERSION"
  1256. mkdir -p $SRC
  1257. if [ "$OPENEXR_USE_REPO" = true ]; then
  1258. git clone ${OPENEXR_SOURCE_REPO[0]} $_src
  1259. else
  1260. download OPENEXR_SOURCE[@] $_src.tar.gz
  1261. INFO "Unpacking OpenEXR-$OPENEXR_VERSION"
  1262. tar -C $SRC --transform "s,(.*/?)openexr[^/]*(.*),\1OpenEXR-$OPENEXR_VERSION\2,x" -xf $_src.tar.gz
  1263. fi
  1264. fi
  1265. cd $_src
  1266. if [ "$OPENEXR_USE_REPO" = true ]; then
  1267. # XXX For now, always update from latest repo...
  1268. git pull origin master
  1269. git checkout $OPENEXR_SOURCE_REPO_UID
  1270. git reset --hard
  1271. oiio_src_path="../OpenEXR"
  1272. else
  1273. oiio_src_path=".."
  1274. fi
  1275. # Always refresh the whole build!
  1276. if [ -d build ]; then
  1277. rm -rf build
  1278. fi
  1279. mkdir build
  1280. cd build
  1281. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1282. cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
  1283. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1284. cmake_d="$cmake_d -D ILMBASE_PACKAGE_PREFIX=$_ilmbase_inst"
  1285. cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
  1286. cmake_d="$cmake_d -D NAMESPACE_VERSIONING=OFF" # VERY IMPORTANT!!!
  1287. if file /bin/cp | grep -q '32-bit'; then
  1288. cflags="-fPIC -m32 -march=i686"
  1289. else
  1290. cflags="-fPIC"
  1291. fi
  1292. cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" $oiio_src_path
  1293. make -j$THREADS && make install
  1294. make clean
  1295. if [ -d $_inst ]; then
  1296. _create_inst_shortcut
  1297. # Copy ilmbase files here (blender expects same dir for ilmbase and openexr :/).
  1298. cp -an $_ilmbase_inst/* $_inst_shortcut
  1299. else
  1300. ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting"
  1301. exit 1
  1302. fi
  1303. magic_compile_set openexr-$OPENEXR_VERSION $openexr_magic
  1304. cd $CWD
  1305. INFO "Done compiling OpenEXR-$OPENEXR_VERSION!"
  1306. else
  1307. INFO "Own OpenEXR-$OPENEXR_VERSION is up to date, nothing to do!"
  1308. INFO "If you want to force rebuild of this lib, use the --force-openexr option."
  1309. fi
  1310. _with_built_openexr=true
  1311. # Just always run it, much simpler this way!
  1312. run_ldconfig "openexr"
  1313. }
  1314. #### Build OIIO ####
  1315. _init_oiio() {
  1316. _src=$SRC/OpenImageIO-$OIIO_VERSION
  1317. _git=true
  1318. _inst=$INST/oiio-$OIIO_VERSION
  1319. _inst_shortcut=$INST/oiio
  1320. }
  1321. clean_OIIO() {
  1322. _init_oiio
  1323. _clean
  1324. }
  1325. compile_OIIO() {
  1326. if [ "$NO_BUILD" = true ]; then
  1327. WARNING "--no-build enabled, OpenImageIO will not be compiled!"
  1328. return
  1329. fi
  1330. # To be changed each time we make edits that would modify the compiled result!
  1331. oiio_magic=17
  1332. _init_oiio
  1333. # Clean install if needed!
  1334. magic_compile_check oiio-$OIIO_VERSION $oiio_magic
  1335. if [ $? -eq 1 -o "$OIIO_FORCE_REBUILD" = true ]; then
  1336. clean_OIIO
  1337. fi
  1338. if [ ! -d $_inst ]; then
  1339. INFO "Building OpenImageIO-$OIIO_VERSION"
  1340. # Rebuild dependecies as well!
  1341. OSL_FORCE_BUILD=true
  1342. OSL_FORCE_REBUILD=true
  1343. prepare_opt
  1344. if [ ! -d $_src ]; then
  1345. mkdir -p $SRC
  1346. if [ "$OIIO_USE_REPO" = true ]; then
  1347. git clone ${OIIO_SOURCE_REPO[0]} $_src
  1348. else
  1349. download OIIO_SOURCE[@] "$_src.tar.gz"
  1350. INFO "Unpacking OpenImageIO-$OIIO_VERSION"
  1351. tar -C $SRC --transform "s,(.*/?)oiio-Release-[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" -xf $_src.tar.gz
  1352. fi
  1353. fi
  1354. cd $_src
  1355. if [ "$OIIO_USE_REPO" = true ]; then
  1356. # XXX For now, always update from latest repo...
  1357. git pull origin master
  1358. # Stick to same rev as windows' libs...
  1359. git checkout $OIIO_SOURCE_REPO_UID
  1360. git reset --hard
  1361. fi
  1362. # Always refresh the whole build!
  1363. if [ -d build ]; then
  1364. rm -rf build
  1365. fi
  1366. mkdir build
  1367. cd build
  1368. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1369. cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
  1370. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1371. cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
  1372. cmake_d="$cmake_d -D BUILDSTATIC=OFF"
  1373. cmake_d="$cmake_d -D LINKSTATIC=OFF"
  1374. cmake_d="$cmake_d -D USE_SIMD=sse2"
  1375. cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
  1376. cmake_d="$cmake_d -D OPENEXR_VERSION=$OPENEXR_VERSION"
  1377. if [ "$_with_built_openexr" = true ]; then
  1378. cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
  1379. cmake_d="$cmake_d -D OPENEXR_HOME=$INST/openexr"
  1380. INFO "ILMBASE_HOME=$INST/openexr"
  1381. fi
  1382. # ptex is only needed when nicholas bishop is ready
  1383. cmake_d="$cmake_d -D USE_PTEX=OFF"
  1384. # Optional tests and cmd tools
  1385. cmake_d="$cmake_d -D USE_QT=OFF"
  1386. cmake_d="$cmake_d -D USE_PYTHON=OFF"
  1387. cmake_d="$cmake_d -D USE_FFMPEG=OFF"
  1388. cmake_d="$cmake_d -D BUILD_TESTING=OFF"
  1389. cmake_d="$cmake_d -D OIIO_BUILD_TESTS=OFF"
  1390. cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=OFF"
  1391. #cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
  1392. #cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
  1393. if [ -d $INST/boost ]; then
  1394. cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
  1395. fi
  1396. # Looks like we do not need ocio in oiio for now...
  1397. # if [ -d $INST/ocio ]; then
  1398. # cmake_d="$cmake_d -D OCIO_PATH=$INST/ocio"
  1399. # fi
  1400. cmake_d="$cmake_d -D USE_OCIO=OFF"
  1401. if [ "$USE_CXX11" = true ]; then
  1402. cmake_d="$cmake_d -D OIIO_BUILD_CPP11=ON"
  1403. fi
  1404. if file /bin/cp | grep -q '32-bit'; then
  1405. cflags="-fPIC -m32 -march=i686"
  1406. else
  1407. cflags="-fPIC"
  1408. fi
  1409. cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ..
  1410. make -j$THREADS && make install
  1411. make clean
  1412. if [ -d $_inst ]; then
  1413. _create_inst_shortcut
  1414. else
  1415. ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
  1416. exit 1
  1417. fi
  1418. magic_compile_set oiio-$OIIO_VERSION $oiio_magic
  1419. cd $CWD
  1420. INFO "Done compiling OpenImageIO-$OIIO_VERSION!"
  1421. else
  1422. INFO "Own OpenImageIO-$OIIO_VERSION is up to date, nothing to do!"
  1423. INFO "If you want to force rebuild of this lib, use the --force-oiio option."
  1424. fi
  1425. # Just always run it, much simpler this way!
  1426. run_ldconfig "oiio"
  1427. }
  1428. #### Build LLVM ####
  1429. _init_llvm() {
  1430. _src=$SRC/LLVM-$LLVM_VERSION
  1431. _src_clang=$SRC/CLANG-$LLVM_VERSION
  1432. _git=false
  1433. _inst=$INST/llvm-$LLVM_VERSION
  1434. _inst_shortcut=$INST/llvm
  1435. }
  1436. clean_LLVM() {
  1437. _init_llvm
  1438. _clean
  1439. }
  1440. compile_LLVM() {
  1441. if [ "$NO_BUILD" = true ]; then
  1442. WARNING "--no-build enabled, LLVM will not be compiled!"
  1443. return
  1444. fi
  1445. # To be changed each time we make edits that would modify the compiled result!
  1446. llvm_magic=3
  1447. _init_llvm
  1448. # Clean install if needed!
  1449. magic_compile_check llvm-$LLVM_VERSION $llvm_magic
  1450. if [ $? -eq 1 -o "$LLVM_FORCE_REBUILD" = true ]; then
  1451. clean_LLVM
  1452. fi
  1453. if [ ! -d $_inst ]; then
  1454. INFO "Building LLVM-$LLVM_VERSION (CLANG included!)"
  1455. # Rebuild dependecies as well!
  1456. OSL_FORCE_BUILD=true
  1457. OSL_FORCE_REBUILD=true
  1458. prepare_opt
  1459. if [ ! -d $_src -o true ]; then
  1460. mkdir -p $SRC
  1461. download LLVM_SOURCE[@] "$_src.tar.gz"
  1462. download LLVM_CLANG_SOURCE[@] "$_src_clang.tar.gz"
  1463. INFO "Unpacking LLVM-$LLVM_VERSION"
  1464. tar -C $SRC --transform "s,([^/]*/?)llvm-[^/]*(.*),\1LLVM-$LLVM_VERSION\2,x" \
  1465. -xf $_src.tar.gz
  1466. INFO "Unpacking CLANG-$LLVM_VERSION to $_src/tools/clang"
  1467. # Stupid clang guys renamed 'clang' to 'cfe' for now handle both cases... :(
  1468. tar -C $_src/tools \
  1469. --transform "s,([^/]*/?)(clang|cfe)-[^/]*(.*),\1clang\3,x" \
  1470. -xf $_src_clang.tar.gz
  1471. cd $_src
  1472. # XXX Ugly patching hack!
  1473. patch -p1 -i "$SCRIPT_DIR/install_deps_patches/llvm.patch"
  1474. cd $CWD
  1475. fi
  1476. cd $_src
  1477. # Always refresh the whole build!
  1478. if [ -d build ]; then
  1479. rm -rf build
  1480. fi
  1481. mkdir build
  1482. cd build
  1483. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1484. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1485. cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON"
  1486. cmake_d="$cmake_d -D LLVM_TARGETS_TO_BUILD=X86"
  1487. cmake_d="$cmake_d -D LLVM_ENABLE_TERMINFO=OFF"
  1488. if [ -d $_FFI_INCLUDE_DIR ]; then
  1489. cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR"
  1490. fi
  1491. cmake $cmake_d ..
  1492. make -j$THREADS && make install
  1493. make clean
  1494. if [ -d $_inst ]; then
  1495. _create_inst_shortcut
  1496. else
  1497. ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
  1498. exit 1
  1499. fi
  1500. magic_compile_set llvm-$LLVM_VERSION $llvm_magic
  1501. cd $CWD
  1502. INFO "Done compiling LLVM-$LLVM_VERSION (CLANG included)!"
  1503. else
  1504. INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
  1505. INFO "If you want to force rebuild of this lib, use the --force-llvm option."
  1506. fi
  1507. }
  1508. #### Build OSL ####
  1509. _init_osl() {
  1510. _src=$SRC/OpenShadingLanguage-$OSL_VERSION
  1511. _git=true
  1512. _inst=$INST/osl-$OSL_VERSION
  1513. _inst_shortcut=$INST/osl
  1514. }
  1515. clean_OSL() {
  1516. _init_osl
  1517. _clean
  1518. }
  1519. compile_OSL() {
  1520. if [ "$NO_BUILD" = true ]; then
  1521. WARNING "--no-build enabled, OpenShadingLanguage will not be compiled!"
  1522. return
  1523. fi
  1524. # To be changed each time we make edits that would modify the compiled result!
  1525. osl_magic=21
  1526. _init_osl
  1527. # Clean install if needed!
  1528. magic_compile_check osl-$OSL_VERSION $osl_magic
  1529. if [ $? -eq 1 -o "$OSL_FORCE_REBUILD" = true ]; then
  1530. #~ rm -Rf $_src # XXX Radical, but not easy to change remote repo fully automatically
  1531. clean_OSL
  1532. fi
  1533. if [ ! -d $_inst ]; then
  1534. INFO "Building OpenShadingLanguage-$OSL_VERSION"
  1535. prepare_opt
  1536. if [ ! -d $_src ]; then
  1537. mkdir -p $SRC
  1538. if [ "$OSL_USE_REPO" = true ]; then
  1539. git clone ${OSL_SOURCE_REPO[0]} $_src
  1540. else
  1541. download OSL_SOURCE[@] "$_src.tar.gz"
  1542. INFO "Unpacking OpenShadingLanguage-$OSL_VERSION"
  1543. tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
  1544. -xf $_src.tar.gz
  1545. fi
  1546. fi
  1547. cd $_src
  1548. if [ "$OSL_USE_REPO" = true ]; then
  1549. git remote set-url origin ${OSL_SOURCE_REPO[0]}
  1550. # XXX For now, always update from latest repo...
  1551. git pull --no-edit -X theirs origin $OSL_SOURCE_REPO_BRANCH
  1552. # Stick to same rev as windows' libs...
  1553. git checkout $OSL_SOURCE_REPO_UID
  1554. git reset --hard
  1555. # XXX Ugly patching hack!
  1556. patch -p1 -i "$SCRIPT_DIR/install_deps_patches/osl.patch"
  1557. fi
  1558. # Always refresh the whole build!
  1559. if [ -d build ]; then
  1560. rm -rf build
  1561. fi
  1562. mkdir build
  1563. cd build
  1564. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1565. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1566. cmake_d="$cmake_d -D BUILD_TESTING=OFF"
  1567. cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
  1568. cmake_d="$cmake_d -D BUILDSTATIC=OFF"
  1569. cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF"
  1570. cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF"
  1571. cmake_d="$cmake_d -D USE_SIMD=sse2"
  1572. if [ "$USE_CXX11" = true ]; then
  1573. cmake_d="$cmake_d -D OSL_BUILD_CPP11=1"
  1574. fi
  1575. #~ cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
  1576. if [ "$_with_built_openexr" = true ]; then
  1577. INFO "ILMBASE_HOME=$INST/openexr"
  1578. cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
  1579. # XXX Temp workaround... sigh, ILMBase really messed the things up by defining their custom names ON by default :(
  1580. cmake_d="$cmake_d -D ILMBASE_CUSTOM=ON"
  1581. cmake_d="$cmake_d -D ILMBASE_CUSTOM_LIBRARIES='Half;Iex;Imath;IlmThread'"
  1582. fi
  1583. if [ -d $INST/boost ]; then
  1584. cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
  1585. fi
  1586. if [ -d $INST/oiio ]; then
  1587. cmake_d="$cmake_d -D OPENIMAGEIOHOME=$INST/oiio"
  1588. fi
  1589. if [ ! -z $LLVM_VERSION_FOUND ]; then
  1590. cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND"
  1591. if [ -d $INST/llvm ]; then
  1592. cmake_d="$cmake_d -D LLVM_DIRECTORY=$INST/llvm"
  1593. cmake_d="$cmake_d -D LLVM_STATIC=ON"
  1594. fi
  1595. fi
  1596. #~ cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
  1597. #~ cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
  1598. cmake $cmake_d ..
  1599. make -j$THREADS && make install
  1600. make clean
  1601. if [ -d $_inst ]; then
  1602. _create_inst_shortcut
  1603. else
  1604. ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
  1605. exit 1
  1606. fi
  1607. magic_compile_set osl-$OSL_VERSION $osl_magic
  1608. cd $CWD
  1609. INFO "Done compiling OpenShadingLanguage-$OSL_VERSION!"
  1610. else
  1611. INFO "Own OpenShadingLanguage-$OSL_VERSION is up to date, nothing to do!"
  1612. INFO "If you want to force rebuild of this lib, use the --force-osl option."
  1613. fi
  1614. run_ldconfig "osl"
  1615. }
  1616. #### Build OSD ####
  1617. _init_osd() {
  1618. _src=$SRC/OpenSubdiv-$OSD_VERSION
  1619. _git=true
  1620. _inst=$INST/osd-$OSD_VERSION
  1621. _inst_shortcut=$INST/osd
  1622. }
  1623. clean_OSD() {
  1624. _init_osd
  1625. _clean
  1626. }
  1627. compile_OSD() {
  1628. if [ "$NO_BUILD" = true ]; then
  1629. WARNING "--no-build enabled, OpenSubdiv will not be compiled!"
  1630. return
  1631. fi
  1632. # To be changed each time we make edits that would modify the compiled result!
  1633. osd_magic=2
  1634. _init_osd
  1635. # Clean install if needed!
  1636. magic_compile_check osd-$OSD_VERSION $osd_magic
  1637. if [ $? -eq 1 -o "$OSD_FORCE_REBUILD" = true ]; then
  1638. clean_OSD
  1639. fi
  1640. if [ ! -d $_inst ]; then
  1641. INFO "Building OpenSubdiv-$OSD_VERSION"
  1642. prepare_opt
  1643. if [ ! -d $_src ]; then
  1644. mkdir -p $SRC
  1645. if [ "$OSD_USE_REPO" = true ]; then
  1646. git clone ${OSD_SOURCE_REPO[0]} $_src
  1647. else
  1648. download OSD_SOURCE[@] "$_src.tar.gz"
  1649. INFO "Unpacking OpenSubdiv-$OSD_VERSION"
  1650. tar -C $SRC --transform "s,(.*/?)OpenSubdiv-[^/]*(.*),\1OpenSubdiv-$OSD_VERSION\2,x" \
  1651. -xf $_src.tar.gz
  1652. fi
  1653. fi
  1654. cd $_src
  1655. if [ "$OSD_USE_REPO" = true ]; then
  1656. git remote set-url origin ${OSD_SOURCE_REPO[0]}
  1657. # XXX For now, always update from latest repo...
  1658. git pull --no-edit -X theirs origin $OSD_SOURCE_REPO_BRANCH
  1659. # Stick to same rev as windows' libs...
  1660. git checkout $OSD_SOURCE_REPO_UID
  1661. git reset --hard
  1662. fi
  1663. # Always refresh the whole build!
  1664. if [ -d build ]; then
  1665. rm -rf build
  1666. fi
  1667. mkdir build
  1668. cd build
  1669. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1670. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1671. # ptex is only needed when nicholas bishop is ready
  1672. cmake_d="$cmake_d -D NO_PTEX=1"
  1673. cmake_d="$cmake_d -D NO_CLEW=1 -D NO_CUDA=1 -D NO_OPENCL=1"
  1674. # maya plugin, docs, tutorials, regression tests and examples are not needed
  1675. cmake_d="$cmake_d -D NO_MAYA=1 -D NO_DOC=1 -D NO_TUTORIALS=1 -D NO_REGRESSION=1 -DNO_EXAMPLES=1"
  1676. cmake $cmake_d ..
  1677. make -j$THREADS && make install
  1678. make clean
  1679. if [ -d $_inst ]; then
  1680. _create_inst_shortcut
  1681. else
  1682. ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
  1683. exit 1
  1684. fi
  1685. magic_compile_set osd-$OSD_VERSION $osd_magic
  1686. cd $CWD
  1687. INFO "Done compiling OpenSubdiv-$OSD_VERSION!"
  1688. else
  1689. INFO "Own OpenSubdiv-$OSD_VERSION is up to date, nothing to do!"
  1690. INFO "If you want to force rebuild of this lib, use the --force-osd option."
  1691. fi
  1692. run_ldconfig "osd"
  1693. }
  1694. #### Build Blosc ####
  1695. _init_blosc() {
  1696. _src=$SRC/c-blosc-$OPENVDB_BLOSC_VERSION
  1697. _git=false
  1698. _inst=$INST/blosc-$OPENVDB_BLOSC_VERSION
  1699. _inst_shortcut=$INST/blosc
  1700. }
  1701. clean_BLOSC() {
  1702. _init_blosc
  1703. _clean
  1704. }
  1705. compile_BLOSC() {
  1706. if [ "$NO_BUILD" = true ]; then
  1707. WARNING "--no-build enabled, Blosc will not be compiled!"
  1708. return
  1709. fi
  1710. # To be changed each time we make edits that would modify the compiled result!
  1711. blosc_magic=0
  1712. _init_blosc
  1713. # Clean install if needed!
  1714. magic_compile_check blosc-$OPENVDB_BLOSC_VERSION $blosc_magic
  1715. if [ $? -eq 1 -o "$OPENVDB_FORCE_REBUILD" = true ]; then
  1716. clean_BLOSC
  1717. rm -rf $_inst
  1718. fi
  1719. if [ ! -d $_inst ]; then
  1720. INFO "Building Blosc-$OPENVDB_BLOSC_VERSION"
  1721. # Rebuild dependecies as well!
  1722. OPENVDB_FORCE_BUILD=true
  1723. OPENVDB_FORCE_REBUILD=true
  1724. prepare_opt
  1725. if [ ! -d $_src ]; then
  1726. INFO "Downloading Blosc-$OPENVDB_BLOSC_VERSION"
  1727. mkdir -p $SRC
  1728. download OPENVDB_BLOSC_SOURCE[@] $_src.tar.gz
  1729. INFO "Unpacking Blosc-$OPENVDB_BLOSC_VERSION"
  1730. tar -C $SRC -xf $_src.tar.gz
  1731. fi
  1732. cd $_src
  1733. # Always refresh the whole build!
  1734. if [ -d build ]; then
  1735. rm -rf build
  1736. fi
  1737. mkdir build
  1738. cd build
  1739. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1740. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1741. cmake_d="$cmake_d -D BUILD_STATIC=OFF"
  1742. cmake_d="$cmake_d -D BUILD_TESTS=OFF"
  1743. cmake_d="$cmake_d -D BUILD_BENCHMARKS=OFF"
  1744. INFO "$cmake_d"
  1745. cmake $cmake_d ..
  1746. make -j$THREADS && make install
  1747. make clean
  1748. if [ -d $_inst ]; then
  1749. _create_inst_shortcut
  1750. else
  1751. ERROR "Blosc-$OPENVDB_BLOSC_VERSION failed to compile, exiting"
  1752. exit 1
  1753. fi
  1754. cd $CWD
  1755. INFO "Done compiling Blosc-$OPENVDB_BLOSC_VERSION!"
  1756. else
  1757. INFO "Own Blosc-$OPENVDB_BLOSC_VERSION is up to date, nothing to do!"
  1758. INFO "If you want to force rebuild of this lib (and openvdb), use the --force-openvdb option."
  1759. fi
  1760. magic_compile_set blosc-$OPENVDB_BLOSC_VERSION $blosc_magic
  1761. run_ldconfig "blosc"
  1762. }
  1763. #### Build OpenVDB ####
  1764. _init_openvdb() {
  1765. _src=$SRC/openvdb-$OPENVDB_VERSION
  1766. _git=false
  1767. _inst=$INST/openvdb-$OPENVDB_VERSION
  1768. _inst_shortcut=$INST/openvdb
  1769. }
  1770. clean_OPENVDB() {
  1771. _init_openvdb
  1772. _clean
  1773. }
  1774. compile_OPENVDB() {
  1775. if [ "$NO_BUILD" = true ]; then
  1776. WARNING "--no-build enabled, OpenVDB will not be compiled!"
  1777. return
  1778. fi
  1779. compile_BLOSC
  1780. PRINT ""
  1781. # To be changed each time we make edits that would modify the compiled result!
  1782. openvdb_magic=1
  1783. _init_openvdb
  1784. # Clean install if needed!
  1785. magic_compile_check openvdb-$OPENVDB_VERSION $openvdb_magic
  1786. if [ $? -eq 1 -o "$OPENVDB_FORCE_REBUILD" = true ]; then
  1787. clean_OPENVDB
  1788. fi
  1789. if [ ! -d $_inst ]; then
  1790. INFO "Building OpenVDB-$OPENVDB_VERSION"
  1791. prepare_opt
  1792. if [ ! -d $_src -o true ]; then
  1793. mkdir -p $SRC
  1794. download OPENVDB_SOURCE[@] "$_src.tar.gz"
  1795. INFO "Unpacking OpenVDB-$OPENVDB_VERSION"
  1796. tar -C $SRC -xf $_src.tar.gz
  1797. fi
  1798. cd $_src
  1799. #~ if [ "$OPENVDB_USE_REPO" = true ]; then
  1800. #~ git remote set-url origin ${OPENVDB_SOURCE_REPO[0]}
  1801. #~ # XXX For now, always update from latest repo...
  1802. #~ git pull --no-edit -X theirs origin $OPENVDB_SOURCE_REPO_BRANCH
  1803. #~ # Stick to same rev as windows' libs...
  1804. #~ git checkout $OPENVDB_SOURCE_REPO_UID
  1805. #~ git reset --hard
  1806. #~ fi
  1807. # Source builds here
  1808. cd openvdb
  1809. make_d="DESTDIR=$_inst"
  1810. make_d="$make_d HDSO=/usr"
  1811. if [ -d $INST/boost ]; then
  1812. make_d="$make_d BOOST_INCL_DIR=$INST/boost/include BOOST_LIB_DIR=$INST/boost/lib"
  1813. fi
  1814. if [ "$_with_built_openexr" = true ]; then
  1815. make_d="$make_d ILMBASE_INCL_DIR=$INST/openexr/include ILMBASE_LIB_DIR=$INST/openexr/lib"
  1816. make_d="$make_d EXR_INCL_DIR=$INST/openexr/include EXR_LIB_DIR=$INST/openexr/lib"
  1817. INFO "ILMBASE_HOME=$INST/openexr"
  1818. fi
  1819. if [ -d $INST/blosc ]; then
  1820. make_d="$make_d BLOSC_INCL_DIR=$INST/blosc/include BLOSC_LIB_DIR=$INST/blosc/lib"
  1821. fi
  1822. # Build without log4cplus, glfw, python module & docs
  1823. make_d="$make_d LOG4CPLUS_INCL_DIR= GLFW_INCL_DIR= PYTHON_VERSION= DOXYGEN="
  1824. make -j$THREADS lib $make_d install
  1825. make clean
  1826. if [ -d $_inst ]; then
  1827. _create_inst_shortcut
  1828. else
  1829. ERROR "OpenVDB-$OPENVDB_VERSION failed to compile, exiting"
  1830. exit 1
  1831. fi
  1832. magic_compile_set openvdb-$OPENVDB_VERSION $openvdb_magic
  1833. cd $CWD
  1834. INFO "Done compiling OpenVDB-$OPENVDB_VERSION!"
  1835. else
  1836. INFO "Own OpenVDB-$OPENVDB_VERSION is up to date, nothing to do!"
  1837. INFO "If you want to force rebuild of this lib, use the --force-openvdb option."
  1838. fi
  1839. run_ldconfig "openvdb"
  1840. }
  1841. #### Build Alembic ####
  1842. _init_alembic() {
  1843. _src=$SRC/alembic-$ALEMBIC_VERSION
  1844. _git=false
  1845. _inst=$INST/alembic-$ALEMBIC_VERSION
  1846. _inst_shortcut=$INST/alembic
  1847. }
  1848. clean_ALEMBIC() {
  1849. _init_alembic
  1850. _clean
  1851. }
  1852. compile_ALEMBIC() {
  1853. if [ "$NO_BUILD" = true ]; then
  1854. WARNING "--no-build enabled, Alembic will not be compiled!"
  1855. return
  1856. fi
  1857. # To be changed each time we make edits that would modify the compiled result!
  1858. alembic_magic=2
  1859. _init_alembic
  1860. # Clean install if needed!
  1861. magic_compile_check alembic-$ALEMBIC_VERSION $alembic_magic
  1862. if [ $? -eq 1 -o "$ALEMBIC_FORCE_REBUILD" = true ]; then
  1863. clean_ALEMBIC
  1864. fi
  1865. if [ ! -d $_inst ]; then
  1866. INFO "Building Alembic-$ALEMBIC_VERSION"
  1867. prepare_opt
  1868. if [ ! -d $_src -o true ]; then
  1869. mkdir -p $SRC
  1870. download ALEMBIC_SOURCE[@] "$_src.tar.gz"
  1871. INFO "Unpacking Alembic-$ALEMBIC_VERSION"
  1872. tar -C $SRC -xf $_src.tar.gz
  1873. fi
  1874. cd $_src
  1875. cmake_d="-D CMAKE_INSTALL_PREFIX=$_inst"
  1876. # Without Boost or TR1, Alembic requires C++11.
  1877. if [ "$USE_CXX11" != true ]; then
  1878. cmake_d="$cmake_d -D ALEMBIC_LIB_USES_BOOST=ON"
  1879. cmake_d="$cmake_d -D ALEMBIC_LIB_USES_TR1=OFF"
  1880. fi
  1881. if [ -d $INST/boost ]; then
  1882. if [ -d $INST/boost ]; then
  1883. cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost"
  1884. fi
  1885. cmake_d="$cmake_d -D USE_STATIC_BOOST=ON"
  1886. else
  1887. cmake_d="$cmake_d -D USE_STATIC_BOOST=OFF"
  1888. fi
  1889. if [ "$_with_built_openexr" = true ]; then
  1890. cmake_d="$cmake_d -D ILMBASE_ROOT=$INST/openexr"
  1891. cmake_d="$cmake_d -D USE_ARNOLD=OFF"
  1892. cmake_d="$cmake_d -D USE_BINARIES=OFF"
  1893. cmake_d="$cmake_d -D USE_EXAMPLES=OFF"
  1894. cmake_d="$cmake_d -D USE_HDF5=OFF"
  1895. cmake_d="$cmake_d -D USE_MAYA=OFF"
  1896. cmake_d="$cmake_d -D USE_PRMAN=OFF"
  1897. cmake_d="$cmake_d -D USE_PYALEMBIC=OFF"
  1898. cmake_d="$cmake_d -D USE_STATIC_HDF5=OFF"
  1899. cmake_d="$cmake_d -D ALEMBIC_ILMBASE_LINK_STATIC=OFF"
  1900. cmake_d="$cmake_d -D ALEMBIC_SHARED_LIBS=OFF"
  1901. INFO "ILMBASE_ROOT=$INST/openexr"
  1902. fi
  1903. cmake $cmake_d ./
  1904. make -j$THREADS install
  1905. make clean
  1906. if [ -d $_inst ]; then
  1907. _create_inst_shortcut
  1908. else
  1909. ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting"
  1910. exit 1
  1911. fi
  1912. magic_compile_set alembic-$ALEMBIC_VERSION $alembic_magic
  1913. cd $CWD
  1914. INFO "Done compiling Alembic-$ALEMBIC_VERSION!"
  1915. else
  1916. INFO "Own Alembic-$ALEMBIC_VERSION is up to date, nothing to do!"
  1917. INFO "If you want to force rebuild of this lib, use the --force-alembic option."
  1918. fi
  1919. run_ldconfig "alembic"
  1920. }
  1921. #### Build OpenCOLLADA ####
  1922. _init_opencollada() {
  1923. _src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
  1924. _git=true
  1925. _inst=$INST/opencollada-$OPENCOLLADA_VERSION
  1926. _inst_shortcut=$INST/opencollada
  1927. }
  1928. clean_OpenCOLLADA() {
  1929. _init_opencollada
  1930. _clean
  1931. }
  1932. compile_OpenCOLLADA() {
  1933. if [ "$NO_BUILD" = true ]; then
  1934. WARNING "--no-build enabled, OpenCOLLADA will not be compiled!"
  1935. return
  1936. fi
  1937. # To be changed each time we make edits that would modify the compiled results!
  1938. opencollada_magic=9
  1939. _init_opencollada
  1940. # Clean install if needed!
  1941. magic_compile_check opencollada-$OPENCOLLADA_VERSION $opencollada_magic
  1942. if [ $? -eq 1 -o "$OPENCOLLADA_FORCE_REBUILD" = true ]; then
  1943. clean_OpenCOLLADA
  1944. fi
  1945. if [ ! -d $_inst ]; then
  1946. INFO "Building OpenCOLLADA-$OPENCOLLADA_VERSION"
  1947. prepare_opt
  1948. if [ ! -d $_src ]; then
  1949. mkdir -p $SRC
  1950. git clone $OPENCOLLADA_SOURCE $_src
  1951. fi
  1952. cd $_src
  1953. # XXX For now, always update from latest repo...
  1954. git pull origin $OPENCOLLADA_REPO_BRANCH
  1955. # Stick to same rev as windows' libs...
  1956. git checkout $OPENCOLLADA_REPO_UID
  1957. git reset --hard
  1958. # Always refresh the whole build!
  1959. if [ -d build ]; then
  1960. rm -rf build
  1961. fi
  1962. mkdir build
  1963. cd build
  1964. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1965. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1966. cmake_d="$cmake_d -D USE_EXPAT=OFF"
  1967. cmake_d="$cmake_d -D USE_LIBXML=ON"
  1968. # XXX Does not work!
  1969. # cmake_d="$cmake_d -D USE_STATIC=OFF"
  1970. cmake_d="$cmake_d -D USE_STATIC=ON"
  1971. cmake $cmake_d ../
  1972. make -j$THREADS && make install
  1973. make clean
  1974. if [ -d $_inst ]; then
  1975. _create_inst_shortcut
  1976. else
  1977. ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting"
  1978. exit 1
  1979. fi
  1980. magic_compile_set opencollada-$OPENCOLLADA_VERSION $opencollada_magic
  1981. cd $CWD
  1982. INFO "Done compiling OpenCOLLADA-$OPENCOLLADA_VERSION!"
  1983. else
  1984. INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!"
  1985. INFO "If you want to force rebuild of this lib, use the --force-opencollada option."
  1986. fi
  1987. }
  1988. #### Build FFMPEG ####
  1989. _init_ffmpeg() {
  1990. _src=$SRC/ffmpeg-$FFMPEG_VERSION
  1991. _inst=$INST/ffmpeg-$FFMPEG_VERSION
  1992. _inst_shortcut=$INST/ffmpeg
  1993. }
  1994. clean_FFmpeg() {
  1995. _init_ffmpeg
  1996. _clean
  1997. }
  1998. compile_FFmpeg() {
  1999. if [ "$NO_BUILD" = true ]; then
  2000. WARNING "--no-build enabled, ffmpeg will not be compiled!"
  2001. return
  2002. fi
  2003. # To be changed each time we make edits that would modify the compiled result!
  2004. ffmpeg_magic=5
  2005. _init_ffmpeg
  2006. # Clean install if needed!
  2007. magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
  2008. if [ $? -eq 1 -o "$FFMPEG_FORCE_REBUILD" = true ]; then
  2009. clean_FFmpeg
  2010. fi
  2011. if [ ! -d $_inst ]; then
  2012. INFO "Building ffmpeg-$FFMPEG_VERSION"
  2013. prepare_opt
  2014. if [ ! -d $_src ]; then
  2015. INFO "Downloading ffmpeg-$FFMPEG_VERSION"
  2016. mkdir -p $SRC
  2017. download FFMPEG_SOURCE[@] "$_src.tar.bz2"
  2018. INFO "Unpacking ffmpeg-$FFMPEG_VERSION"
  2019. tar -C $SRC -xf $_src.tar.bz2
  2020. fi
  2021. cd $_src
  2022. extra=""
  2023. if [ "$VORBIS_USE" = true ]; then
  2024. extra="$extra --enable-libvorbis"
  2025. fi
  2026. if [ "$THEORA_USE" = true ]; then
  2027. extra="$extra --enable-libtheora"
  2028. fi
  2029. if [ "$XVID_USE" = true ]; then
  2030. extra="$extra --enable-libxvid"
  2031. fi
  2032. if [ "$X264_USE" = true ]; then
  2033. extra="$extra --enable-libx264"
  2034. fi
  2035. if [ "$VPX_USE" = true ]; then
  2036. extra="$extra --enable-libvpx"
  2037. fi
  2038. if [ "$MP3LAME_USE" = true ]; then
  2039. extra="$extra --enable-libmp3lame"
  2040. fi
  2041. if [ "$OPENJPEG_USE" = true ]; then
  2042. extra="$extra --enable-libopenjpeg"
  2043. fi
  2044. ./configure --cc="gcc -Wl,--as-needed" \
  2045. --extra-ldflags="-pthread -static-libgcc" \
  2046. --prefix=$_inst --enable-static \
  2047. --disable-ffplay --disable-ffserver --disable-doc \
  2048. --enable-gray \
  2049. --enable-avfilter --disable-vdpau \
  2050. --disable-bzlib --disable-libgsm --disable-libspeex \
  2051. --enable-pthreads --enable-zlib --enable-stripping --enable-runtime-cpudetect \
  2052. --disable-vaapi --disable-nonfree --enable-gpl \
  2053. --disable-postproc --disable-librtmp --disable-libopencore-amrnb \
  2054. --disable-libopencore-amrwb --disable-libdc1394 --disable-version3 --disable-outdev=sdl \
  2055. --disable-libxcb \
  2056. --disable-outdev=xv --disable-indev=sndio --disable-outdev=sndio \
  2057. --disable-outdev=alsa --disable-indev=sdl --disable-indev=alsa --disable-indev=jack \
  2058. --disable-indev=lavfi $extra
  2059. make -j$THREADS && make install
  2060. make clean
  2061. if [ -d $_inst ]; then
  2062. _create_inst_shortcut
  2063. else
  2064. ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
  2065. exit 1
  2066. fi
  2067. magic_compile_set ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
  2068. cd $CWD
  2069. INFO "Done compiling ffmpeg-$FFMPEG_VERSION!"
  2070. else
  2071. INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
  2072. INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
  2073. fi
  2074. }
  2075. #### Install on DEB-like ####
  2076. get_package_version_DEB() {
  2077. dpkg-query -W -f '${Version}' $1 | sed -r 's/([0-9]+:)?(([0-9]+\.?)+([0-9]+)).*/\2/'
  2078. }
  2079. check_package_DEB() {
  2080. r=`apt-cache show $1 | grep -c 'Package:'`
  2081. if [ $r -ge 1 ]; then
  2082. return 0
  2083. else
  2084. return 1
  2085. fi
  2086. }
  2087. check_package_installed_DEB() {
  2088. r=`dpkg-query -W -f='${Status}' $1 | grep -c "install ok"`
  2089. if [ $r -ge 1 ]; then
  2090. return 0
  2091. else
  2092. return 1
  2093. fi
  2094. }
  2095. check_package_version_match_DEB() {
  2096. v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'`
  2097. if [ -z "$v" ]; then
  2098. return 1
  2099. fi
  2100. version_match $v $2
  2101. return $?
  2102. }
  2103. check_package_version_ge_DEB() {
  2104. v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'`
  2105. if [ -z "$v" ]; then
  2106. return 1
  2107. fi
  2108. version_ge $v $2
  2109. return $?
  2110. }
  2111. check_package_version_ge_lt_DEB() {
  2112. v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'`
  2113. if [ -z "$v" ]; then
  2114. return 1
  2115. fi
  2116. version_ge_lt $v $2 $3
  2117. return $?
  2118. }
  2119. install_packages_DEB() {
  2120. if [ ! $SUDO ]; then
  2121. WARNING "--no-sudo enabled, impossible to run apt-get install for $@, you'll have to do it yourself..."
  2122. else
  2123. $SUDO apt-get install -y $@
  2124. if [ $? -ge 1 ]; then
  2125. ERROR "apt-get failed to install requested packages, exiting."
  2126. exit 1
  2127. fi
  2128. fi
  2129. }
  2130. install_DEB() {
  2131. PRINT ""
  2132. INFO "Installing dependencies for DEB-based distribution"
  2133. PRINT ""
  2134. PRINT "`eval _echo "$COMMON_INFO"`"
  2135. PRINT ""
  2136. if [ "$NO_CONFIRM" = false ]; then
  2137. read -p "Do you want to continue (Y/n)?"
  2138. [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
  2139. fi
  2140. if [ ! $SUDO ]; then
  2141. WARNING "--no-sudo enabled, impossible to run apt-get update, you'll have to do it yourself..."
  2142. else
  2143. $SUDO apt-get update
  2144. fi
  2145. # These libs should always be available in debian/ubuntu official repository...
  2146. VORBIS_DEV="libvorbis-dev"
  2147. OGG_DEV="libogg-dev"
  2148. THEORA_DEV="libtheora-dev"
  2149. _packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \
  2150. git libfreetype6-dev libx11-dev flex bison libtbb-dev libxxf86vm-dev \
  2151. libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
  2152. libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
  2153. libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
  2154. libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev"
  2155. # libglewmx-dev (broken in deb testing currently...)
  2156. VORBIS_USE=true
  2157. OGG_USE=true
  2158. THEORA_USE=true
  2159. PRINT ""
  2160. # New Ubuntu crap (17.04 and more) have no openjpeg lib!
  2161. OPENJPEG_DEV="libopenjpeg-dev"
  2162. check_package_DEB $OPENJPEG_DEV
  2163. if [ $? -eq 0 ]; then
  2164. _packages="$_packages $OPENJPEG_DEV"
  2165. OPENJPEG_USE=true
  2166. fi
  2167. PRINT ""
  2168. # Some not-so-old distro (ubuntu 12.4) do not have it, do not fail in this case, just warn.
  2169. YAMLCPP_DEV="libyaml-cpp-dev"
  2170. check_package_DEB $YAMLCPP_DEV
  2171. if [ $? -eq 0 ]; then
  2172. _packages="$_packages $YAMLCPP_DEV"
  2173. else
  2174. PRINT ""
  2175. WARNING "libyaml-cpp-dev not found, you may have to install it by hand to get Blender compiling..."
  2176. PRINT ""
  2177. fi
  2178. if [ "$WITH_JACK" = true ]; then
  2179. _packages="$_packages libspnav-dev"
  2180. # Only install jack if jack2 is not already installed!
  2181. JACK="libjack-dev"
  2182. JACK2="libjack-jackd2-dev"
  2183. check_package_installed_DEB $JACK2
  2184. if [ $? -eq 0 ]; then
  2185. _packages="$_packages $JACK2"
  2186. else
  2187. _packages="$_packages $JACK"
  2188. fi
  2189. fi
  2190. PRINT ""
  2191. install_packages_DEB $_packages
  2192. PRINT""
  2193. SNDFILE_DEV="libsndfile1-dev"
  2194. check_package_DEB $SNDFILE_DEV
  2195. if [ $? -eq 0 ]; then
  2196. install_packages_DEB $SNDFILE_DEV
  2197. fi
  2198. PRINT ""
  2199. X264_DEV="libx264-dev"
  2200. check_package_version_ge_DEB $X264_DEV $X264_VERSION_MIN
  2201. if [ $? -eq 0 ]; then
  2202. install_packages_DEB $X264_DEV
  2203. X264_USE=true
  2204. fi
  2205. if [ "$WITH_ALL" = true ]; then
  2206. PRINT ""
  2207. XVID_DEV="libxvidcore-dev"
  2208. check_package_DEB $XVID_DEV
  2209. if [ $? -eq 0 ]; then
  2210. install_packages_DEB $XVID_DEV
  2211. XVID_USE=true
  2212. fi
  2213. PRINT ""
  2214. MP3LAME_DEV="libmp3lame-dev"
  2215. check_package_DEB $MP3LAME_DEV
  2216. if [ $? -eq 0 ]; then
  2217. install_packages_DEB $MP3LAME_DEV
  2218. MP3LAME_USE=true
  2219. fi
  2220. PRINT ""
  2221. VPX_DEV="libvpx-dev"
  2222. check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN
  2223. if [ $? -eq 0 ]; then
  2224. install_packages_DEB $VPX_DEV
  2225. VPX_USE=true
  2226. fi
  2227. fi
  2228. # Check cmake/glew versions and disable features for older distros.
  2229. # This is so Blender can at least compile.
  2230. PRINT ""
  2231. _cmake=`get_package_version_DEB cmake`
  2232. version_ge $_cmake "2.8.10"
  2233. if [ $? -eq 1 ]; then
  2234. version_ge $_cmake "2.8.8"
  2235. if [ $? -eq 1 ]; then
  2236. WARNING "OpenVDB and OpenCOLLADA disabled because cmake-$_cmake is not enough"
  2237. OPENVDB_SKIP=true
  2238. OPENCOLLADA_SKIP=true
  2239. else
  2240. WARNING "OpenVDB disabled because cmake-$_cmake is not enough"
  2241. OPENVDB_SKIP=true
  2242. fi
  2243. fi
  2244. PRINT ""
  2245. _glew=`get_package_version_DEB libglew-dev`
  2246. if [ -z $_glew ]; then
  2247. # Stupid virtual package in Ubuntu 12.04 doesn't show version number...
  2248. _glew=`apt-cache showpkg libglew-dev|tail -n1|awk '{print $2}'|sed 's/-.*//'`
  2249. fi
  2250. version_ge $_glew "1.9.0"
  2251. if [ $? -eq 1 ]; then
  2252. version_ge $_glew "1.7.0"
  2253. if [ $? -eq 1 ]; then
  2254. WARNING "OpenSubdiv disabled because GLEW-$_glew is not enough"
  2255. WARNING "Blender will not use system GLEW library"
  2256. OSD_SKIP=true
  2257. NO_SYSTEM_GLEW=true
  2258. else
  2259. WARNING "OpenSubdiv will compile with GLEW-$_glew but with limited capability"
  2260. WARNING "Blender will not use system GLEW library"
  2261. NO_SYSTEM_GLEW=true
  2262. fi
  2263. fi
  2264. PRINT ""
  2265. _do_compile_python=false
  2266. if [ "$PYTHON_SKIP" = true ]; then
  2267. WARNING "Skipping Python/NumPy installation, as requested..."
  2268. elif [ "$PYTHON_FORCE_BUILD" = true ]; then
  2269. INFO "Forced Python/NumPy building, as requested..."
  2270. _do_compile_python=true
  2271. else
  2272. check_package_DEB python$PYTHON_VERSION_MIN-dev
  2273. if [ $? -eq 0 ]; then
  2274. install_packages_DEB python$PYTHON_VERSION_MIN-dev
  2275. clean_Python
  2276. PRINT ""
  2277. if [ "$NUMPY_SKIP" = true ]; then
  2278. WARNING "Skipping NumPy installation, as requested..."
  2279. else
  2280. check_package_DEB python3-numpy
  2281. if [ $? -eq 0 ]; then
  2282. install_packages_DEB python3-numpy
  2283. else
  2284. WARNING "Sorry, using python package but no valid numpy package available!" \
  2285. " Use --build-numpy to force building of both Python and NumPy."
  2286. fi
  2287. fi
  2288. else
  2289. _do_compile_python=true
  2290. fi
  2291. fi
  2292. if $_do_compile_python; then
  2293. compile_Python
  2294. PRINT ""
  2295. if [ "$NUMPY_SKIP" = true ]; then
  2296. WARNING "Skipping NumPy installation, as requested..."
  2297. else
  2298. compile_Numpy
  2299. fi
  2300. fi
  2301. PRINT ""
  2302. if [ "$BOOST_SKIP" = true ]; then
  2303. WARNING "Skipping Boost installation, as requested..."
  2304. elif [ "$BOOST_FORCE_BUILD" = true ]; then
  2305. INFO "Forced Boost building, as requested..."
  2306. compile_Boost
  2307. else
  2308. check_package_version_ge_DEB libboost-dev $BOOST_VERSION_MIN
  2309. if [ $? -eq 0 ]; then
  2310. install_packages_DEB libboost-dev
  2311. boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
  2312. install_packages_DEB libboost-{filesystem,iostreams,locale,regex,system,thread,wave,program-options}$boost_version-dev
  2313. clean_Boost
  2314. else
  2315. compile_Boost
  2316. fi
  2317. fi
  2318. PRINT ""
  2319. if [ "$OCIO_SKIP" = true ]; then
  2320. WARNING "Skipping OpenColorIO installation, as requested..."
  2321. elif [ "$OCIO_FORCE_BUILD" = true ]; then
  2322. INFO "Forced OpenColorIO building, as requested..."
  2323. compile_OCIO
  2324. else
  2325. # XXX Always force build of own OCIO, until linux distro guys update their package to default libyaml-cpp ver (0.5)!
  2326. #check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN
  2327. #if [ $? -eq 0 ]; then
  2328. #install_packages_DEB libopencolorio-dev
  2329. #clean_OCIO
  2330. #else
  2331. compile_OCIO
  2332. #fi
  2333. fi
  2334. PRINT ""
  2335. if [ "$OPENEXR_SKIP" = true ]; then
  2336. WARNING "Skipping ILMBase/OpenEXR installation, as requested..."
  2337. elif [ "$OPENEXR_FORCE_BUILD" = true ]; then
  2338. INFO "Forced ILMBase/OpenEXR building, as requested..."
  2339. compile_OPENEXR
  2340. else
  2341. check_package_version_ge_DEB libopenexr-dev $OPENEXR_VERSION_MIN
  2342. if [ $? -eq 0 ]; then
  2343. install_packages_DEB libopenexr-dev
  2344. OPENEXR_VERSION=`get_package_version_DEB libopenexr-dev`
  2345. ILMBASE_VERSION=$OPENEXR_VERSION
  2346. clean_OPENEXR
  2347. else
  2348. compile_OPENEXR
  2349. fi
  2350. fi
  2351. PRINT ""
  2352. if [ "$OIIO_SKIP" = true ]; then
  2353. WARNING "Skipping OpenImageIO installation, as requested..."
  2354. elif [ "$OIIO_FORCE_BUILD" = true ]; then
  2355. INFO "Forced OpenImageIO building, as requested..."
  2356. compile_OIIO
  2357. else
  2358. # XXX Debian Testing / Ubuntu 16.04 pulls in WAY too many deps (gtk2/opencv ?!) incl. OCIO build against libyaml-cpp0.3 so build for now...
  2359. #check_package_version_ge_lt_DEB libopenimageio-dev $OIIO_VERSION_MIN $OIIO_VERSION_MAX
  2360. #if [ $? -eq 0 -a "$_with_built_openexr" = false ]; then
  2361. # install_packages_DEB libopenimageio-dev
  2362. # clean_OIIO
  2363. #else
  2364. compile_OIIO
  2365. #fi
  2366. fi
  2367. PRINT ""
  2368. have_llvm=false
  2369. _do_compile_llvm=false
  2370. if [ "$LLVM_SKIP" = true ]; then
  2371. WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
  2372. OSL_SKIP=true
  2373. elif [ "$LLVM_FORCE_BUILD" = true ]; then
  2374. INFO "Forced LLVM building, as requested..."
  2375. _do_compile_llvm=true
  2376. else
  2377. check_package_DEB clang-$LLVM_VERSION
  2378. if [ $? -eq 0 ]; then
  2379. install_packages_DEB llvm-$LLVM_VERSION-dev clang-$LLVM_VERSION
  2380. have_llvm=true
  2381. LLVM_VERSION_FOUND=$LLVM_VERSION
  2382. clean_LLVM
  2383. else
  2384. _do_compile_llvm=true
  2385. fi
  2386. fi
  2387. if [ "$_do_compile_llvm" = true ]; then
  2388. install_packages_DEB libffi-dev
  2389. # LLVM can't find the debian ffi header dir
  2390. _FFI_INCLUDE_DIR=`dpkg -L libffi-dev | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
  2391. PRINT ""
  2392. compile_LLVM
  2393. have_llvm=true
  2394. LLVM_VERSION_FOUND=$LLVM_VERSION
  2395. fi
  2396. PRINT ""
  2397. _do_compile_osl=false
  2398. if [ "$OSL_SKIP" = true ]; then
  2399. WARNING "Skipping OpenShadingLanguage installation, as requested..."
  2400. elif [ "$OSL_FORCE_BUILD" = true ]; then
  2401. INFO "Forced OpenShadingLanguage building, as requested..."
  2402. _do_compile_osl=true
  2403. else
  2404. # No package currently!
  2405. _do_compile_osl=true
  2406. fi
  2407. if [ "$_do_compile_osl" = true ]; then
  2408. if [ "$have_llvm" = true ]; then
  2409. PRINT ""
  2410. compile_OSL
  2411. else
  2412. WARNING "No LLVM available, cannot build OSL!"
  2413. fi
  2414. fi
  2415. PRINT ""
  2416. if [ "$OSD_SKIP" = true ]; then
  2417. WARNING "Skipping OpenSubdiv installation, as requested..."
  2418. elif [ "$OSD_FORCE_BUILD" = true ]; then
  2419. INFO "Forced OpenSubdiv building, as requested..."
  2420. compile_OSD
  2421. else
  2422. # No package currently!
  2423. PRINT ""
  2424. compile_OSD
  2425. fi
  2426. PRINT ""
  2427. if [ "$OPENVDB_SKIP" = true ]; then
  2428. WARNING "Skipping OpenVDB installation, as requested..."
  2429. elif [ "$OPENVDB_FORCE_BUILD" = true ]; then
  2430. INFO "Forced OpenVDB building, as requested..."
  2431. compile_OPENVDB
  2432. else
  2433. check_package_version_ge_DEB libopenvdb-dev $OPENVDB_VERSION_MIN
  2434. if [ $? -eq 0 ]; then
  2435. install_packages_DEB libopenvdb-dev libblosc-dev
  2436. clean_OPENVDB
  2437. else
  2438. compile_OPENVDB
  2439. fi
  2440. fi
  2441. PRINT ""
  2442. if [ "$ALEMBIC_SKIP" = true ]; then
  2443. WARNING "Skipping Alembic installation, as requested..."
  2444. elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then
  2445. INFO "Forced Alembic building, as requested..."
  2446. compile_ALEMBIC
  2447. else
  2448. # No package currently, only HDF5!
  2449. compile_ALEMBIC
  2450. fi
  2451. if [ "$WITH_OPENCOLLADA" = true ]; then
  2452. _do_compile_collada=false
  2453. PRINT ""
  2454. if [ "$OPENCOLLADA_SKIP" = true ]; then
  2455. WARNING "Skipping OpenCOLLADA installation, as requested..."
  2456. elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then
  2457. INFO "Forced OpenCollada building, as requested..."
  2458. _do_compile_collada=true
  2459. else
  2460. # No package currently!
  2461. _do_compile_collada=true
  2462. fi
  2463. if [ "$_do_compile_collada" = true ]; then
  2464. install_packages_DEB libpcre3-dev
  2465. # Find path to libxml shared lib...
  2466. _XML2_LIB=`dpkg -L libxml2-dev | grep -e ".*/libxml2.so"`
  2467. # No package
  2468. PRINT ""
  2469. compile_OpenCOLLADA
  2470. fi
  2471. fi
  2472. PRINT ""
  2473. if [ "$FFMPEG_SKIP" = true ]; then
  2474. WARNING "Skipping FFMpeg installation, as requested..."
  2475. elif [ "$FFMPEG_FORCE_BUILD" = true ]; then
  2476. INFO "Forced FFMpeg building, as requested..."
  2477. compile_FFmpeg
  2478. else
  2479. # XXX Debian Testing / Ubuntu 16.04 finally includes FFmpeg, so check as usual
  2480. check_package_DEB ffmpeg
  2481. if [ $? -eq 0 ]; then
  2482. check_package_version_ge_DEB ffmpeg $FFMPEG_VERSION_MIN
  2483. if [ $? -eq 0 ]; then
  2484. install_packages_DEB libavdevice-dev
  2485. clean_FFmpeg
  2486. else
  2487. compile_FFmpeg
  2488. fi
  2489. else
  2490. compile_FFmpeg
  2491. fi
  2492. fi
  2493. }
  2494. #### Install on RPM-like ####
  2495. rpm_flavour() {
  2496. if [ -f /etc/redhat-release ]; then
  2497. if [ "`grep '[6-7]\.' /etc/redhat-release`" ]; then
  2498. RPM="RHEL"
  2499. else
  2500. RPM="FEDORA"
  2501. fi
  2502. elif [ -f /etc/SuSE-release ]; then
  2503. RPM="SUSE"
  2504. fi
  2505. }
  2506. get_package_version_RPM() {
  2507. rpm_flavour
  2508. if [ "$RPM" = "RHEL" ]; then
  2509. yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
  2510. elif [ "$RPM" = "FEDORA" ]; then
  2511. dnf info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
  2512. elif [ "$RPM" = "SUSE" ]; then
  2513. zypper info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
  2514. fi
  2515. }
  2516. check_package_RPM() {
  2517. rpm_flavour
  2518. if [ "$RPM" = "RHEL" ]; then
  2519. r=`yum info $1 | grep -c 'Summary'`
  2520. elif [ "$RPM" = "FEDORA" ]; then
  2521. r=`dnf info $1 | grep -c 'Summary'`
  2522. elif [ "$RPM" = "SUSE" ]; then
  2523. r=`zypper info $1 | grep -c 'Summary'`
  2524. fi
  2525. if [ $r -ge 1 ]; then
  2526. return 0
  2527. else
  2528. return 1
  2529. fi
  2530. }
  2531. check_package_version_match_RPM() {
  2532. v=`get_package_version_RPM $1`
  2533. if [ -z "$v" ]; then
  2534. return 1
  2535. fi
  2536. version_match $v $2
  2537. return $?
  2538. }
  2539. check_package_version_ge_RPM() {
  2540. v=`get_package_version_RPM $1`
  2541. if [ -z "$v" ]; then
  2542. return 1
  2543. fi
  2544. version_ge $v $2
  2545. return $?
  2546. }
  2547. check_package_version_ge_lt_RPM() {
  2548. v=`get_package_version_RPM $1`
  2549. if [ -z "$v" ]; then
  2550. return 1
  2551. fi
  2552. version_ge_lt $v $2 $3
  2553. return $?
  2554. }
  2555. install_packages_RPM() {
  2556. rpm_flavour
  2557. if [ ! $SUDO ]; then
  2558. WARNING "--no-sudo enabled, impossible to install $@, you'll have to do it yourself..."
  2559. fi
  2560. if [ "$RPM" = "RHEL" ]; then
  2561. $SUDO yum install -y $@
  2562. if [ $? -ge 1 ]; then
  2563. ERROR "yum failed to install requested packages, exiting."
  2564. exit 1
  2565. fi
  2566. elif [ "$RPM" = "FEDORA" ]; then
  2567. $SUDO dnf install -y $@
  2568. if [ $? -ge 1 ]; then
  2569. ERROR "dnf failed to install requested packages, exiting."
  2570. exit 1
  2571. fi
  2572. elif [ "$RPM" = "SUSE" ]; then
  2573. $SUDO zypper --non-interactive install --auto-agree-with-licenses $@
  2574. if [ $? -ge 1 ]; then
  2575. ERROR "zypper failed to install requested packages, exiting."
  2576. exit 1
  2577. fi
  2578. fi
  2579. }
  2580. install_RPM() {
  2581. PRINT ""
  2582. INFO "Installing dependencies for RPM-based distribution"
  2583. PRINT ""
  2584. PRINT "`eval _echo "$COMMON_INFO"`"
  2585. PRINT ""
  2586. if [ "$NO_CONFIRM" = false ]; then
  2587. read -p "Do you want to continue (Y/n)?"
  2588. [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
  2589. fi
  2590. # Enable non-free repositories for all flavours
  2591. if [ ! $SUDO ]; then
  2592. WARNING "--no-sudo enabled, impossible to install third party repositories, you'll have to do it yourself..."
  2593. else
  2594. rpm_flavour
  2595. if [ "$RPM" = "FEDORA" ]; then
  2596. _fedora_rel="`egrep "[0-9]{1,}" /etc/fedora-release -o`"
  2597. $SUDO dnf -y install --nogpgcheck \
  2598. http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$_fedora_rel.noarch.rpm \
  2599. http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$_fedora_rel.noarch.rpm
  2600. $SUDO dnf -y update
  2601. elif [ "$RPM" = "RHEL" ]; then
  2602. if [ "`grep '6\.' /etc/redhat-release`" ]; then
  2603. ERROR "Building with GCC 4.4 is not supported!"
  2604. exit 1
  2605. else
  2606. $SUDO yum -y install --nogpgcheck \
  2607. http://download.fedoraproject.org/pub/epel/7/$(uname -i)/e/epel-release-7-6.noarch.rpm \
  2608. http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
  2609. $SUDO yum -y update
  2610. fi
  2611. elif [ "$RPM" = "SUSE" ]; then
  2612. # Packman repo now includes name in link...
  2613. _suse_rel="`grep -w VERSION /etc/os-release | sed 's/[^0-9.]*//g'`"
  2614. _suse_name="`grep -w NAME /etc/os-release | gawk '{print $2}' | sed 's/\"//'`"
  2615. if [ $_suse_name ]; then
  2616. _suse_rel="${_suse_name}_${_suse_rel}"
  2617. fi
  2618. PRINT ""
  2619. INFO "About to add 'packman' repository from http://packman.inode.at/suse/openSUSE_$_suse_rel/"
  2620. INFO "This is only needed if you do not already have a packman repository enabled..."
  2621. read -p "Do you want to add this repo (Y/n)?"
  2622. if [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" == "y" ]; then
  2623. INFO " Installing packman..."
  2624. $SUDO zypper ar -f -n packman http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_$_suse_rel/ packman
  2625. INFO " Done."
  2626. else
  2627. INFO " Skipping packman installation."
  2628. fi
  2629. $SUDO zypper --non-interactive --gpg-auto-import-keys update --auto-agree-with-licenses
  2630. fi
  2631. fi
  2632. # These libs should always be available in fedora/suse official repository...
  2633. OPENJPEG_DEV="openjpeg-devel"
  2634. VORBIS_DEV="libvorbis-devel"
  2635. OGG_DEV="libogg-devel"
  2636. THEORA_DEV="libtheora-devel"
  2637. _packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison \
  2638. libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL-devel \
  2639. libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
  2640. wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
  2641. glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
  2642. libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel"
  2643. OPENJPEG_USE=true
  2644. VORBIS_USE=true
  2645. OGG_USE=true
  2646. THEORA_USE=true
  2647. if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
  2648. _packages="$_packages freetype-devel tbb-devel"
  2649. if [ "$WITH_JACK" = true ]; then
  2650. _packages="$_packages jack-audio-connection-kit-devel"
  2651. fi
  2652. PRINT ""
  2653. install_packages_RPM $_packages
  2654. PRINT ""
  2655. X264_DEV="x264-devel"
  2656. check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
  2657. if [ $? -eq 0 ]; then
  2658. install_packages_RPM $X264_DEV
  2659. X264_USE=true
  2660. fi
  2661. if [ "$WITH_ALL" = true ]; then
  2662. PRINT ""
  2663. XVID_DEV="xvidcore-devel"
  2664. check_package_RPM $XVID_DEV
  2665. if [ $? -eq 0 ]; then
  2666. install_packages_RPM $XVID_DEV
  2667. XVID_USE=true
  2668. fi
  2669. PRINT ""
  2670. MP3LAME_DEV="lame-devel"
  2671. check_package_RPM $MP3LAME_DEV
  2672. if [ $? -eq 0 ]; then
  2673. install_packages_RPM $MP3LAME_DEV
  2674. MP3LAME_USE=true
  2675. fi
  2676. fi
  2677. elif [ "$RPM" = "SUSE" ]; then
  2678. _packages="$_packages freetype2-devel"
  2679. PRINT ""
  2680. install_packages_RPM $_packages
  2681. PRINT ""
  2682. # Install TBB on openSUSE, from temporary repo
  2683. check_package_RPM tbb-devel
  2684. if [ $? -eq 0 ]; then
  2685. install_packages_RPM tbb-devel
  2686. else
  2687. $SUDO zypper ar -f http://download.opensuse.org/repositories/devel:/libraries:/c_c++/openSUSE_$_suse_rel/devel:libraries:c_c++.repo
  2688. $SUDO zypper -n --gpg-auto-import-keys install tbb-devel
  2689. $SUDO zypper rr devel_libraries_c_c++
  2690. fi
  2691. PRINT ""
  2692. X264_DEV="libx264-devel"
  2693. check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
  2694. if [ $? -eq 0 ]; then
  2695. install_packages_RPM $X264_DEV
  2696. X264_USE=true
  2697. fi
  2698. if [ "$WITH_ALL" = true ]; then
  2699. PRINT ""
  2700. XVID_DEV="libxvidcore-devel"
  2701. check_package_RPM $XVID_DEV
  2702. if [ $? -eq 0 ]; then
  2703. install_packages_RPM $XVID_DEV
  2704. XVID_USE=true
  2705. fi
  2706. PRINT ""
  2707. MP3LAME_DEV="libmp3lame-devel"
  2708. check_package_RPM $MP3LAME_DEV
  2709. if [ $? -eq 0 ]; then
  2710. install_packages_RPM $MP3LAME_DEV
  2711. MP3LAME_USE=true
  2712. fi
  2713. fi
  2714. fi
  2715. PRINT""
  2716. SNDFILE_DEV="libsndfile-devel"
  2717. check_package_RPM $SNDFILE_DEV
  2718. if [ $? -eq 0 ]; then
  2719. install_packages_RPM $SNDFILE_DEV
  2720. fi
  2721. if [ "$WITH_ALL" = true ]; then
  2722. PRINT ""
  2723. VPX_DEV="libvpx-devel"
  2724. check_package_version_ge_RPM $VPX_DEV $VPX_VERSION_MIN
  2725. if [ $? -eq 0 ]; then
  2726. install_packages_RPM $VPX_DEV
  2727. VPX_USE=true
  2728. fi
  2729. PRINT ""
  2730. install_packages_RPM libspnav-devel
  2731. fi
  2732. PRINT ""
  2733. _do_compile_python=false
  2734. if [ "$PYTHON_SKIP" = true ]; then
  2735. WARNING "Skipping Python installation, as requested..."
  2736. elif [ "$PYTHON_FORCE_BUILD" = true ]; then
  2737. INFO "Forced Python/NumPy building, as requested..."
  2738. _do_compile_python=true
  2739. else
  2740. check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN
  2741. if [ $? -eq 0 ]; then
  2742. install_packages_RPM python3-devel
  2743. clean_Python
  2744. PRINT ""
  2745. if [ "$NUMPY_SKIP" = true ]; then
  2746. WARNING "Skipping NumPy installation, as requested..."
  2747. else
  2748. check_package_version_ge_RPM python3-numpy $NUMPY_VERSION_MIN
  2749. if [ $? -eq 0 ]; then
  2750. install_packages_RPM python3-numpy
  2751. else
  2752. WARNING "Sorry, using python package but no valid numpy package available!" \
  2753. " Use --build-numpy to force building of both Python and NumPy."
  2754. fi
  2755. fi
  2756. else
  2757. _do_compile_python=true
  2758. fi
  2759. fi
  2760. if [ "$_do_compile_python" = true ]; then
  2761. compile_Python
  2762. PRINT ""
  2763. if [ "$NUMPY_SKIP" = true ]; then
  2764. WARNING "Skipping NumPy installation, as requested..."
  2765. else
  2766. compile_Numpy
  2767. fi
  2768. fi
  2769. PRINT ""
  2770. _do_compile_boost=false
  2771. if [ "$BOOST_SKIP" = true ]; then
  2772. WARNING "Skipping Boost installation, as requested..."
  2773. elif [ "$BOOST_FORCE_BUILD" = true ]; then
  2774. INFO "Forced Boost building, as requested..."
  2775. _do_compile_boost=true
  2776. else
  2777. check_package_version_ge_RPM boost-devel $BOOST_VERSION_MIN
  2778. if [ $? -eq 0 ]; then
  2779. install_packages_RPM boost-devel
  2780. clean_Boost
  2781. else
  2782. _do_compile_boost=true
  2783. fi
  2784. fi
  2785. if [ "$_do_compile_boost" = true ]; then
  2786. if [ "$RPM" = "SUSE" ]; then
  2787. install_packages_RPM gcc-fortran
  2788. else
  2789. install_packages_RPM libquadmath-devel bzip2-devel
  2790. fi
  2791. PRINT ""
  2792. compile_Boost
  2793. fi
  2794. PRINT ""
  2795. if [ "$OCIO_SKIP" = true ]; then
  2796. WARNING "Skipping OpenColorIO installation, as requested..."
  2797. elif [ "$OCIO_FORCE_BUILD" = true ]; then
  2798. INFO "Forced OpenColorIO building, as requested..."
  2799. compile_OCIO
  2800. else
  2801. if [ "$RPM" = "SUSE" ]; then
  2802. check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN
  2803. if [ $? -eq 0 ]; then
  2804. install_packages_RPM OpenColorIO-devel
  2805. clean_OCIO
  2806. else
  2807. compile_OCIO
  2808. fi
  2809. # XXX Fedora/RHEL OCIO still depends on libyaml-cpp v0.3 even when system default is v0.5!
  2810. else
  2811. compile_OCIO
  2812. fi
  2813. fi
  2814. PRINT ""
  2815. if [ "$OPENEXR_SKIP" = true ]; then
  2816. WARNING "Skipping ILMBase/OpenEXR installation, as requested..."
  2817. elif [ "$OPENEXR_FORCE_BUILD" = true ]; then
  2818. INFO "Forced ILMBase/OpenEXR building, as requested..."
  2819. compile_OPENEXR
  2820. else
  2821. check_package_version_ge_RPM openexr-devel $OPENEXR_VERSION_MIN
  2822. if [ $? -eq 0 ]; then
  2823. install_packages_RPM openexr-devel
  2824. OPENEXR_VERSION=`get_package_version_RPM openexr-devel`
  2825. ILMBASE_VERSION=$OPENEXR_VERSION
  2826. clean_OPENEXR
  2827. else
  2828. compile_OPENEXR
  2829. fi
  2830. fi
  2831. PRINT ""
  2832. if [ "$OIIO_SKIP" = true ]; then
  2833. WARNING "Skipping OpenImageIO installation, as requested..."
  2834. elif [ "$OIIO_FORCE_BUILD" = true ]; then
  2835. INFO "Forced OpenImageIO building, as requested..."
  2836. compile_OIIO
  2837. else
  2838. # XXX RPM distros pulls in too much and depends on old libs, so better to build for now...
  2839. #check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MAX
  2840. #if [ $? -eq 0 -a $_with_built_openexr == false ]; then
  2841. # install_packages_RPM OpenImageIO-devel
  2842. # clean_OIIO
  2843. #else
  2844. compile_OIIO
  2845. #fi
  2846. fi
  2847. PRINT ""
  2848. have_llvm=false
  2849. _do_compile_llvm=false
  2850. if [ "$LLVM_SKIP" = true ]; then
  2851. WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
  2852. OSL_SKIP=true
  2853. elif [ "$LLVM_FORCE_BUILD" = true ]; then
  2854. INFO "Forced LLVM building, as requested..."
  2855. _do_compile_llvm=true
  2856. else
  2857. if [ "$RPM" = "SUSE" ]; then
  2858. CLANG_DEV="llvm-clang-devel"
  2859. else
  2860. CLANG_DEV="clang-devel"
  2861. fi
  2862. # XXX RHEL has 3.4 in repo but OSL complains about not finding MCJIT_LIBRARY, so compile for now...
  2863. #check_package_version_match_RPM $CLANG_DEV $LLVM_VERSION
  2864. #if [ $? -eq 0 ]; then
  2865. # install_packages_RPM llvm-devel $CLANG_DEV
  2866. # have_llvm=true
  2867. # LLVM_VERSION_FOUND=$LLVM_VERSION
  2868. # clean_LLVM
  2869. #else
  2870. _do_compile_llvm=true
  2871. #fi
  2872. fi
  2873. if [ "$_do_compile_llvm" = true ]; then
  2874. install_packages_RPM libffi-devel
  2875. # LLVM can't find the fedora ffi header dir...
  2876. _FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
  2877. PRINT ""
  2878. compile_LLVM
  2879. have_llvm=true
  2880. LLVM_VERSION_FOUND=$LLVM_VERSION
  2881. fi
  2882. PRINT ""
  2883. _do_compile_osl=false
  2884. if [ "$OSL_SKIP" = true ]; then
  2885. WARNING "Skipping OpenShadingLanguage installation, as requested..."
  2886. elif [ "$OSL_FORCE_BUILD" = true ]; then
  2887. INFO "Forced OpenShadingLanguage building, as requested..."
  2888. _do_compile_osl=true
  2889. else
  2890. # No package currently!
  2891. _do_compile_osl=true
  2892. fi
  2893. if [ "$_do_compile_osl" = true ]; then
  2894. if [ "$have_llvm" = true ]; then
  2895. PRINT ""
  2896. compile_OSL
  2897. else
  2898. WARNING "No LLVM available, cannot build OSL!"
  2899. fi
  2900. fi
  2901. PRINT ""
  2902. if [ "$OSD_SKIP" = true ]; then
  2903. WARNING "Skipping OpenSubdiv installation, as requested..."
  2904. elif [ "$OSD_FORCE_BUILD" = true ]; then
  2905. INFO "Forced OpenSubdiv building, as requested..."
  2906. compile_OSD
  2907. else
  2908. # No package currently!
  2909. compile_OSD
  2910. fi
  2911. PRINT ""
  2912. if [ "$OPENVDB_SKIP" = true ]; then
  2913. WARNING "Skipping OpenVDB installation, as requested..."
  2914. elif [ "$OPENVDB_FORCE_BUILD" = true ]; then
  2915. INFO "Forced OpenVDB building, as requested..."
  2916. compile_OPENVDB
  2917. else
  2918. # No package currently!
  2919. compile_OPENVDB
  2920. fi
  2921. PRINT ""
  2922. if [ "$ALEMBIC_SKIP" = true ]; then
  2923. WARNING "Skipping Alembic installation, as requested..."
  2924. elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then
  2925. INFO "Forced Alembic building, as requested..."
  2926. compile_ALEMBIC
  2927. else
  2928. # No package currently!
  2929. compile_ALEMBIC
  2930. fi
  2931. if [ "$WITH_OPENCOLLADA" = true ]; then
  2932. PRINT ""
  2933. _do_compile_collada=false
  2934. if [ "$OPENCOLLADA_SKIP" = true ]; then
  2935. WARNING "Skipping OpenCOLLADA installation, as requested..."
  2936. elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then
  2937. INFO "Forced OpenCollada building, as requested..."
  2938. _do_compile_collada=true
  2939. else
  2940. # No package...
  2941. _do_compile_collada=true
  2942. fi
  2943. if [ "$_do_compile_collada" = true ]; then
  2944. install_packages_RPM pcre-devel
  2945. # Find path to libxml shared lib...
  2946. _XML2_LIB=`rpm -ql libxml2-devel | grep -e ".*/libxml2.so"`
  2947. PRINT ""
  2948. compile_OpenCOLLADA
  2949. fi
  2950. fi
  2951. PRINT ""
  2952. if [ "$FFMPEG_SKIP" = true ]; then
  2953. WARNING "Skipping FFMpeg installation, as requested..."
  2954. elif [ "$FFMPEG_FORCE_BUILD" = true ]; then
  2955. INFO "Forced FFMpeg building, as requested..."
  2956. compile_FFmpeg
  2957. else
  2958. check_package_version_ge_RPM ffmpeg-devel $FFMPEG_VERSION_MIN
  2959. if [ $? -eq 0 ]; then
  2960. install_packages_RPM ffmpeg ffmpeg-devel
  2961. clean_FFmpeg
  2962. else
  2963. compile_FFmpeg
  2964. fi
  2965. fi
  2966. }
  2967. #### Install on ARCH-like ####
  2968. get_package_version_ARCH() {
  2969. pacman -Si $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+?(([0-9]+\.?)+).*/\1/'
  2970. }
  2971. check_package_ARCH() {
  2972. r=`pacman -Si $1 | grep -c 'Description'`
  2973. if [ $r -ge 1 ]; then
  2974. return 0
  2975. else
  2976. return 1
  2977. fi
  2978. }
  2979. check_package_version_match_ARCH() {
  2980. v=`get_package_version_ARCH $1`
  2981. if [ -z "$v" ]; then
  2982. return 1
  2983. fi
  2984. version_match $v $2
  2985. return $?
  2986. }
  2987. check_package_version_ge_ARCH() {
  2988. v=`get_package_version_ARCH $1`
  2989. if [ -z "$v" ]; then
  2990. return 1
  2991. fi
  2992. version_ge $v $2
  2993. return $?
  2994. }
  2995. check_package_version_ge_lt_ARCH() {
  2996. v=`get_package_version_ARCH $1`
  2997. if [ -z "$v" ]; then
  2998. return 1
  2999. fi
  3000. version_ge_lt $v $2 $3
  3001. return $?
  3002. }
  3003. install_packages_ARCH() {
  3004. if [ ! $SUDO ]; then
  3005. WARNING "--no-sudo enabled, impossible to run pacman for $@, you'll have to do it yourself..."
  3006. else
  3007. $SUDO pacman -S --needed --noconfirm $@
  3008. if [ $? -ge 1 ]; then
  3009. ERROR "pacman failed to install requested packages, exiting."
  3010. exit 1
  3011. fi
  3012. fi
  3013. }
  3014. install_ARCH() {
  3015. PRINT ""
  3016. INFO "Installing dependencies for ARCH-based distribution"
  3017. PRINT ""
  3018. PRINT "`eval _echo "$COMMON_INFO"`"
  3019. PRINT ""
  3020. if [ "$NO_CONFIRM" = false ]; then
  3021. read -p "Do you want to continue (Y/n)?"
  3022. [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
  3023. fi
  3024. # Check for sudo...
  3025. if [ $SUDO ]; then
  3026. if [ ! -x "/usr/bin/sudo" ]; then
  3027. PRINT ""
  3028. ERROR "This script requires sudo but it is not installed."
  3029. PRINT "Please setup sudo according to:"
  3030. PRINT "https://wiki.archlinux.org/index.php/Sudo"
  3031. PRINT "and try again."
  3032. PRINT ""
  3033. exit
  3034. fi
  3035. fi
  3036. if [ ! $SUDO ]; then
  3037. WARNING "--no-sudo enabled, impossible to run pacman -Sy, you'll have to do it yourself..."
  3038. else
  3039. $SUDO pacman -Sy
  3040. fi
  3041. # These libs should always be available in arch official repository...
  3042. OPENJPEG_DEV="openjpeg"
  3043. VORBIS_DEV="libvorbis"
  3044. OGG_DEV="libogg"
  3045. THEORA_DEV="libtheora"
  3046. BASE_DEVEL="base-devel"
  3047. # Avoid conflicts when gcc-multilib is installed
  3048. pacman -Qi gcc-multilib &>/dev/null
  3049. if [ $? -eq 0 ]; then
  3050. BASE_DEVEL=`pacman -Sgq base-devel | sed -e 's/^gcc$/gcc-multilib/g' | paste -s -d' '`
  3051. fi
  3052. _packages="$BASE_DEVEL git cmake \
  3053. libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
  3054. $OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl fftw intel-tbb \
  3055. libxml2 yaml-cpp tinyxml python-requests jemalloc"
  3056. OPENJPEG_USE=true
  3057. VORBIS_USE=true
  3058. OGG_USE=true
  3059. THEORA_USE=true
  3060. if [ "$WITH_ALL" = true ]; then
  3061. _packages="$_packages libspnav"
  3062. fi
  3063. if [ "$WITH_JACK" = true ]; then
  3064. _packages="$_packages jack"
  3065. fi
  3066. PRINT ""
  3067. install_packages_ARCH $_packages
  3068. PRINT""
  3069. SNDFILE_DEV="libsndfile"
  3070. check_package_ARCH $SNDFILE_DEV
  3071. if [ $? -eq 0 ]; then
  3072. install_packages_ARCH $SNDFILE_DEV
  3073. fi
  3074. PRINT ""
  3075. X264_DEV="x264"
  3076. check_package_version_ge_ARCH $X264_DEV $X264_VERSION_MIN
  3077. if [ $? -eq 0 ]; then
  3078. install_packages_ARCH $X264_DEV
  3079. X264_USE=true
  3080. fi
  3081. if [ "$WITH_ALL" = true ]; then
  3082. PRINT ""
  3083. XVID_DEV="xvidcore"
  3084. check_package_ARCH $XVID_DEV
  3085. if [ $? -eq 0 ]; then
  3086. install_packages_ARCH $XVID_DEV
  3087. XVID_USE=true
  3088. fi
  3089. PRINT ""
  3090. MP3LAME_DEV="lame"
  3091. check_package_ARCH $MP3LAME_DEV
  3092. if [ $? -eq 0 ]; then
  3093. install_packages_ARCH $MP3LAME_DEV
  3094. MP3LAME_USE=true
  3095. fi
  3096. PRINT ""
  3097. VPX_DEV="libvpx"
  3098. check_package_version_ge_ARCH $VPX_DEV $VPX_VERSION_MIN
  3099. if [ $? -eq 0 ]; then
  3100. install_packages_ARCH $VPX_DEV
  3101. VPX_USE=true
  3102. fi
  3103. fi
  3104. PRINT ""
  3105. _do_compile_python=false
  3106. if [ "$PYTHON_SKIP" = true ]; then
  3107. WARNING "Skipping Python installation, as requested..."
  3108. elif [ "$PYTHON_FORCE_BUILD" = true ]; then
  3109. INFO "Forced Python/NumPy building, as requested..."
  3110. _do_compile_python=true
  3111. else
  3112. check_package_version_ge_ARCH python $PYTHON_VERSION_MIN
  3113. if [ $? -eq 0 ]; then
  3114. install_packages_ARCH python
  3115. clean_Python
  3116. PRINT ""
  3117. if [ "$NUMPY_SKIP" = true ]; then
  3118. WARNING "Skipping NumPy installation, as requested..."
  3119. else
  3120. check_package_version_ge_ARCH python-numpy $NUMPY_VERSION_MIN
  3121. if [ $? -eq 0 ]; then
  3122. install_packages_ARCH python-numpy
  3123. else
  3124. WARNING "Sorry, using python package but no valid numpy package available!" \
  3125. "Use --build-numpy to force building of both Python and NumPy."
  3126. fi
  3127. fi
  3128. else
  3129. _do_compile_python=true
  3130. fi
  3131. fi
  3132. if [ "$_do_compile_python" = true ]; then
  3133. compile_Python
  3134. PRINT ""
  3135. if [ "$NUMPY_SKIP" = true ]; then
  3136. WARNING "Skipping NumPy installation, as requested..."
  3137. else
  3138. compile_Numpy
  3139. fi
  3140. fi
  3141. PRINT ""
  3142. if [ "$BOOST_SKIP" = true ]; then
  3143. WARNING "Skipping Boost installation, as requested..."
  3144. elif [ "$BOOST_FORCE_BUILD" = true ]; then
  3145. INFO "Forced Boost building, as requested..."
  3146. compile_Boost
  3147. else
  3148. check_package_version_ge_ARCH boost $BOOST_VERSION_MIN
  3149. if [ $? -eq 0 ]; then
  3150. install_packages_ARCH boost
  3151. clean_Boost
  3152. else
  3153. compile_Boost
  3154. fi
  3155. fi
  3156. PRINT ""
  3157. if [ "$OCIO_SKIP" = true ]; then
  3158. WARNING "Skipping OpenColorIO installation, as requested..."
  3159. elif [ "$OCIO_FORCE_BUILD" = true ]; then
  3160. INFO "Forced OpenColorIO building, as requested..."
  3161. compile_OCIO
  3162. else
  3163. check_package_version_ge_ARCH opencolorio $OCIO_VERSION_MIN
  3164. if [ $? -eq 0 ]; then
  3165. install_packages_ARCH opencolorio
  3166. clean_OCIO
  3167. else
  3168. compile_OCIO
  3169. fi
  3170. fi
  3171. PRINT ""
  3172. if [ "$OPENEXR_SKIP" = true ]; then
  3173. WARNING "Skipping ILMBase/OpenEXR installation, as requested..."
  3174. elif [ "$OPENEXR_FORCE_BUILD" = true ]; then
  3175. INFO "Forced ILMBase/OpenEXR building, as requested..."
  3176. compile_OPENEXR
  3177. else
  3178. check_package_version_ge_ARCH openexr $OPENEXR_VERSION_MIN
  3179. if [ $? -eq 0 ]; then
  3180. install_packages_ARCH openexr
  3181. OPENEXR_VERSION=`get_package_version_ARCH openexr`
  3182. ILMBASE_VERSION=$OPENEXR_VERSION
  3183. clean_OPENEXR
  3184. else
  3185. compile_OPENEXR
  3186. fi
  3187. fi
  3188. PRINT ""
  3189. if [ "$OIIO_SKIP" = true ]; then
  3190. WARNING "Skipping OpenImageIO installation, as requested..."
  3191. elif [ "$OIIO_FORCE_BUILD" = true ]; then
  3192. INFO "Forced OpenImageIO building, as requested..."
  3193. compile_OIIO
  3194. else
  3195. check_package_version_ge_lt_ARCH openimageio $OIIO_VERSION_MIN $OIIO_VERSION_MAX
  3196. if [ $? -eq 0 ]; then
  3197. install_packages_ARCH openimageio
  3198. clean_OIIO
  3199. else
  3200. compile_OIIO
  3201. fi
  3202. fi
  3203. PRINT ""
  3204. have_llvm=false
  3205. _do_compile_llvm=false
  3206. if [ "$LLVM_SKIP" = true ]; then
  3207. WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
  3208. OSL_SKIP=true
  3209. elif [ "$LLVM_FORCE_BUILD" = true ]; then
  3210. INFO "Forced LLVM building, as requested..."
  3211. _do_compile_llvm=true
  3212. else
  3213. check_package_version_match_ARCH llvm35 $LLVM_VERSION_MIN
  3214. if [ $? -eq 0 ]; then
  3215. install_packages_ARCH llvm35 clang35
  3216. have_llvm=true
  3217. LLVM_VERSION=`get_package_version_ARCH llvm35`
  3218. LLVM_VERSION_FOUND=$LLVM_VERSION
  3219. clean_LLVM
  3220. else
  3221. _do_compile_llvm=true
  3222. fi
  3223. fi
  3224. if [ "$_do_compile_llvm" = true ]; then
  3225. install_packages_ARCH libffi
  3226. # LLVM can't find the arch ffi header dir...
  3227. _FFI_INCLUDE_DIR=`pacman -Ql libffi | grep -e ".*/ffi.h" | awk '{print $2}' | sed -r 's/(.*)\/ffi.h/\1/'`
  3228. PRINT ""
  3229. compile_LLVM
  3230. have_llvm=true
  3231. LLVM_VERSION_FOUND=$LLVM_VERSION
  3232. fi
  3233. PRINT ""
  3234. _do_compile_osl=false
  3235. if [ "$OSL_SKIP" = true ]; then
  3236. WARNING "Skipping OpenShadingLanguage installation, as requested..."
  3237. elif [ "$OSL_FORCE_BUILD" = true ]; then
  3238. INFO "Forced OpenShadingLanguage building, as requested..."
  3239. _do_compile_osl=true
  3240. else
  3241. # XXX Compile for now due to requirement of LLVM 3.4 ...
  3242. #check_package_version_ge_ARCH openshadinglanguage $OSL_VERSION_MIN
  3243. #if [ $? -eq 0 ]; then
  3244. # install_packages_ARCH openshadinglanguage
  3245. # clean_OSL
  3246. #else
  3247. _do_compile_osl=true
  3248. #fi
  3249. fi
  3250. if [ "$_do_compile_osl" = true ]; then
  3251. if [ "$have_llvm" = true ]; then
  3252. PRINT ""
  3253. compile_OSL
  3254. else
  3255. WARNING "No LLVM available, cannot build OSL!"
  3256. fi
  3257. fi
  3258. PRINT ""
  3259. if [ "$OSD_SKIP" = true ]; then
  3260. WARNING "Skipping OpenSubdiv installation, as requested..."
  3261. elif [ "$OSD_FORCE_BUILD" = true ]; then
  3262. INFO "Forced OpenSubdiv building, as requested..."
  3263. compile_OSD
  3264. else
  3265. check_package_version_ge_ARCH opensubdiv $OSD_VERSION_MIN
  3266. if [ $? -eq 0 ]; then
  3267. install_packages_ARCH opensubdiv
  3268. clean_OSD
  3269. else
  3270. compile_OSD
  3271. fi
  3272. fi
  3273. PRINT ""
  3274. if [ "$OPENVDB_SKIP" = true ]; then
  3275. WARNING "Skipping OpenVDB installation, as requested..."
  3276. elif [ "$OPENVDB_FORCE_BUILD" = true ]; then
  3277. INFO "Forced OpenVDB building, as requested..."
  3278. compile_OPENVDB
  3279. else
  3280. check_package_version_ge_ARCH openvdb $OPENVDB_VERSION_MIN
  3281. if [ $? -eq 0 ]; then
  3282. install_packages_ARCH openvdb
  3283. clean_OPENVDB
  3284. else
  3285. compile_OPENVDB
  3286. fi
  3287. fi
  3288. PRINT ""
  3289. if [ "$ALEMBIC_SKIP" = true ]; then
  3290. WARNING "Skipping Alembic installation, as requested..."
  3291. elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then
  3292. INFO "Forced Alembic building, as requested..."
  3293. compile_ALEMBIC
  3294. else
  3295. compile_ALEMBIC
  3296. fi
  3297. if [ "$WITH_OPENCOLLADA" = true ]; then
  3298. PRINT ""
  3299. _do_compile_collada=false
  3300. if [ "$OPENCOLLADA_SKIP" = true ]; then
  3301. WARNING "Skipping OpenCOLLADA installation, as requested..."
  3302. elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then
  3303. INFO "Forced OpenCollada building, as requested..."
  3304. _do_compile_collada=true
  3305. else
  3306. check_package_ARCH opencollada
  3307. if [ $? -eq 0 ]; then
  3308. install_packages_ARCH opencollada
  3309. clean_OpenCOLLADA
  3310. else
  3311. _do_compile_collada=true
  3312. fi
  3313. fi
  3314. if [ "$_do_compile_collada" = true ]; then
  3315. install_packages_ARCH pcre
  3316. # Find path to libxml shared lib...
  3317. _XML2_LIB=`pacman -Ql libxml2 | grep -e ".*/libxml2.so$" | gawk '{print $2}'`
  3318. PRINT ""
  3319. compile_OpenCOLLADA
  3320. fi
  3321. fi
  3322. PRINT ""
  3323. if [ "$FFMPEG_SKIP" = true ]; then
  3324. WARNING "Skipping FFMpeg installation, as requested..."
  3325. elif [ "$FFMPEG_FORCE_BUILD" = true ]; then
  3326. INFO "Forced FFMpeg building, as requested..."
  3327. compile_FFmpeg
  3328. else
  3329. check_package_version_ge_ARCH ffmpeg $FFMPEG_VERSION_MIN
  3330. if [ $? -eq 0 ]; then
  3331. install_packages_ARCH ffmpeg
  3332. clean_FFmpeg
  3333. else
  3334. compile_FFmpeg
  3335. fi
  3336. fi
  3337. }
  3338. #### Install on other distro (very limited!) ####
  3339. install_OTHER() {
  3340. PRINT ""
  3341. WARNING "Attempt to build main dependencies for other linux distributions."
  3342. PRINT ""
  3343. PRINT "`eval _echo "$COMMON_INFO"`"
  3344. PRINT ""
  3345. ERROR "Failed to detect distribution type."
  3346. PRINT ""
  3347. PRINT "Your distribution is not supported by this script, you'll have to install dependencies and"
  3348. PRINT "dev packages yourself. However, this script can still attempt to build main (complex) libraries for you,"
  3349. PRINT "if you use '--build-foo' options (you can try '--build-all' one first)."
  3350. PRINT ""
  3351. PRINT "Quite obviously, it assumes dependencies from those libraries are already available, otherwise please"
  3352. PRINT "install them (you can also use error messages printed out by build process to find missing libraries...)."
  3353. PRINT ""
  3354. PRINT "`eval _echo "$DEPS_COMMON_INFO"`"
  3355. PRINT ""
  3356. PRINT "`eval _echo "$DEPS_SPECIFIC_INFO"`"
  3357. PRINT ""
  3358. if [ "$NO_CONFIRM" = false ]; then
  3359. read -p "Do you want to continue (Y/n)?"
  3360. [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
  3361. fi
  3362. PRINT ""
  3363. _do_compile_python=false
  3364. if [ "$PYTHON_SKIP" = true ]; then
  3365. WARNING "Skipping Python/NumPy installation, as requested..."
  3366. elif [ "$PYTHON_FORCE_BUILD" = true ]; then
  3367. INFO "Forced Python/NumPy building, as requested..."
  3368. _do_compile_python=true
  3369. fi
  3370. if [ "$_do_compile_python" = true ]; then
  3371. compile_Python
  3372. PRINT ""
  3373. if [ "$NUMPY_SKIP" = true ]; then
  3374. WARNING "Skipping NumPy installation, as requested..."
  3375. else
  3376. compile_Numpy
  3377. fi
  3378. fi
  3379. PRINT ""
  3380. if [ "$BOOST_SKIP" = true ]; then
  3381. WARNING "Skipping Boost installation, as requested..."
  3382. elif [ "$BOOST_FORCE_BUILD" = true ]; then
  3383. INFO "Forced Boost building, as requested..."
  3384. compile_Boost
  3385. fi
  3386. PRINT ""
  3387. if [ "$OCIO_SKIP" = true ]; then
  3388. WARNING "Skipping OpenColorIO installation, as requested..."
  3389. elif [ "$OCIO_FORCE_BUILD" = true ]; then
  3390. INFO "Forced OpenColorIO building, as requested..."
  3391. compile_OCIO
  3392. fi
  3393. PRINT ""
  3394. if [ "$OPENEXR_SKIP" = true ]; then
  3395. WARNING "Skipping ILMBase/OpenEXR installation, as requested..."
  3396. elif [ "$OPENEXR_FORCE_BUILD" = true ]; then
  3397. INFO "Forced ILMBase/OpenEXR building, as requested..."
  3398. compile_OPENEXR
  3399. fi
  3400. PRINT ""
  3401. if [ "$OIIO_SKIP" = true ]; then
  3402. WARNING "Skipping OpenImageIO installation, as requested..."
  3403. elif [ "$OIIO_FORCE_BUILD" = true ]; then
  3404. INFO "Forced OpenImageIO building, as requested..."
  3405. compile_OIIO
  3406. fi
  3407. PRINT ""
  3408. have_llvm=false
  3409. _do_compile_llvm=false
  3410. if [ "$LLVM_SKIP" = true ]; then
  3411. WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
  3412. elif [ "$LLVM_FORCE_BUILD" = true ]; then
  3413. INFO "Forced LLVM building, as requested..."
  3414. _do_compile_llvm=true
  3415. fi
  3416. if [ "$_do_compile_llvm" = true ]; then
  3417. PRINT ""
  3418. compile_LLVM
  3419. have_llvm=true
  3420. LLVM_VERSION_FOUND=$LLVM_VERSION
  3421. fi
  3422. PRINT ""
  3423. _do_compile_osl=false
  3424. if [ "$OSL_SKIP" = true ]; then
  3425. WARNING "Skipping OpenShadingLanguage installation, as requested..."
  3426. elif [ "$OSL_FORCE_BUILD" = true ]; then
  3427. INFO "Forced OpenShadingLanguage building, as requested..."
  3428. _do_compile_osl=true
  3429. fi
  3430. if [ "$_do_compile_osl" = true ]; then
  3431. if [ "$have_llvm" = true ]; then
  3432. PRINT ""
  3433. compile_OSL
  3434. else
  3435. WARNING "No LLVM available, cannot build OSL!"
  3436. fi
  3437. fi
  3438. PRINT ""
  3439. _do_compile_osd=false
  3440. if [ "$OSD_SKIP" = true ]; then
  3441. WARNING "Skipping OpenSubdiv installation, as requested..."
  3442. elif [ "$OSD_FORCE_BUILD" = true ]; then
  3443. INFO "Forced OpenSubdiv building, as requested..."
  3444. _do_compile_osd=true
  3445. fi
  3446. if [ "$_do_compile_osd" = true ]; then
  3447. PRINT ""
  3448. compile_OSD
  3449. fi
  3450. if [ "$WITH_OPENCOLLADA" = true ]; then
  3451. _do_compile_collada=false
  3452. PRINT ""
  3453. if [ "$OPENCOLLADA_SKIP" = true ]; then
  3454. WARNING "Skipping OpenCOLLADA installation, as requested..."
  3455. elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then
  3456. INFO "Forced OpenCollada building, as requested..."
  3457. _do_compile_collada=true
  3458. fi
  3459. if [ "$_do_compile_collada" = true ]; then
  3460. PRINT ""
  3461. compile_OpenCOLLADA
  3462. fi
  3463. fi
  3464. PRINT ""
  3465. if [ "$FFMPEG_SKIP" = true ]; then
  3466. WARNING "Skipping FFMpeg installation, as requested..."
  3467. elif [ "$FFMPEG_FORCE_BUILD" = true ]; then
  3468. INFO "Forced FFMpeg building, as requested..."
  3469. compile_FFmpeg
  3470. fi
  3471. }
  3472. #### Printing User Info ####
  3473. print_info_ffmpeglink_DEB() {
  3474. dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
  3475. }
  3476. print_info_ffmpeglink_RPM() {
  3477. rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
  3478. }
  3479. print_info_ffmpeglink_ARCH() {
  3480. pacman -Ql $_packages | grep -e ".*\/lib[^\/]\+\.so$" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
  3481. }
  3482. print_info_ffmpeglink() {
  3483. # This func must only print a ';'-separated list of libs...
  3484. if [ -z "$DISTRO" ]; then
  3485. ERROR "Failed to detect distribution type"
  3486. exit 1
  3487. fi
  3488. # Create list of packages from which to get libs names...
  3489. _packages=""
  3490. if [ "$THEORA_USE" = true ]; then
  3491. _packages="$_packages $THEORA_DEV"
  3492. fi
  3493. if [ "$VORBIS_USE" = true ]; then
  3494. _packages="$_packages $VORBIS_DEV"
  3495. fi
  3496. if [ "$OGG_USE" = true ]; then
  3497. _packages="$_packages $OGG_DEV"
  3498. fi
  3499. if [ "$XVID_USE" = true ]; then
  3500. _packages="$_packages $XVID_DEV"
  3501. fi
  3502. if [ "$VPX_USE" = true ]; then
  3503. _packages="$_packages $VPX_DEV"
  3504. fi
  3505. if [ "$MP3LAME_USE" = true ]; then
  3506. _packages="$_packages $MP3LAME_DEV"
  3507. fi
  3508. if [ "$X264_USE" = true ]; then
  3509. _packages="$_packages $X264_DEV"
  3510. fi
  3511. if [ "$OPENJPEG_USE" = true ]; then
  3512. _packages="$_packages $OPENJPEG_DEV"
  3513. fi
  3514. if [ "$DISTRO" = "DEB" ]; then
  3515. print_info_ffmpeglink_DEB
  3516. elif [ "$DISTRO" = "RPM" ]; then
  3517. print_info_ffmpeglink_RPM
  3518. elif [ "$DISTRO" = "ARCH" ]; then
  3519. print_info_ffmpeglink_ARCH
  3520. # XXX TODO!
  3521. else
  3522. PRINT "<Could not determine additional link libraries needed for ffmpeg, replace this by valid list of libs...>"
  3523. fi
  3524. }
  3525. print_info() {
  3526. PRINT ""
  3527. PRINT ""
  3528. PRINT "Ran with:"
  3529. PRINT " install_deps.sh $COMMANDLINE"
  3530. PRINT ""
  3531. PRINT ""
  3532. PRINT "If you're using CMake add this to your configuration flags:"
  3533. _buildargs="-U *SNDFILE* -U *PYTHON* -U *BOOST* -U *Boost*"
  3534. _buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES*"
  3535. _buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC*"
  3536. if [ "$USE_CXX11" = true ]; then
  3537. _1="-D WITH_CXX11=ON"
  3538. PRINT " $_1"
  3539. _buildargs="$_buildargs $_1"
  3540. fi
  3541. _1="-D WITH_CODEC_SNDFILE=ON"
  3542. PRINT " $_1"
  3543. _buildargs="$_buildargs $_1"
  3544. _1="-D PYTHON_VERSION=$PYTHON_VERSION_MIN"
  3545. PRINT " $_1"
  3546. _buildargs="$_buildargs $_1"
  3547. if [ -d $INST/python-$PYTHON_VERSION_MIN ]; then
  3548. _1="-D PYTHON_ROOT_DIR=$INST/python-$PYTHON_VERSION_MIN"
  3549. PRINT " $_1"
  3550. _buildargs="$_buildargs $_1"
  3551. fi
  3552. if [ -d $INST/boost ]; then
  3553. _1="-D BOOST_ROOT=$INST/boost"
  3554. _2="-D Boost_NO_SYSTEM_PATHS=ON"
  3555. PRINT " $_1"
  3556. PRINT " $_2"
  3557. _buildargs="$_buildargs $_1 $_2"
  3558. fi
  3559. if [ "$OCIO_SKIP" = false ]; then
  3560. _1="-D WITH_OPENCOLORIO=ON"
  3561. PRINT " $_1"
  3562. _buildargs="$_buildargs $_1"
  3563. if [ -d $INST/ocio ]; then
  3564. _1="-D OPENCOLORIO_ROOT_DIR=$INST/ocio"
  3565. PRINT " $_1"
  3566. _buildargs="$_buildargs $_1"
  3567. fi
  3568. fi
  3569. if [ -d $INST/openexr ]; then
  3570. _1="-D OPENEXR_ROOT_DIR=$INST/openexr"
  3571. PRINT " $_1"
  3572. _buildargs="$_buildargs $_1"
  3573. fi
  3574. if [ -d $INST/oiio ]; then
  3575. _1="-D WITH_OPENIMAGEIO=ON"
  3576. _2="-D OPENIMAGEIO_ROOT_DIR=$INST/oiio"
  3577. PRINT " $_1"
  3578. PRINT " $_2"
  3579. _buildargs="$_buildargs $_1 $_2"
  3580. fi
  3581. if [ "$OSL_SKIP" = false ]; then
  3582. _1="-D WITH_CYCLES_OSL=ON"
  3583. _2="-D WITH_LLVM=ON"
  3584. _3="-D LLVM_VERSION=$LLVM_VERSION_FOUND"
  3585. PRINT " $_1"
  3586. PRINT " $_2"
  3587. PRINT " $_3"
  3588. _buildargs="$_buildargs $_1 $_2 $_3"
  3589. if [ -d $INST/osl ]; then
  3590. _1="-D OSL_ROOT_DIR=$INST/osl"
  3591. PRINT " $_1"
  3592. _buildargs="$_buildargs $_1"
  3593. fi
  3594. if [ -d $INST/llvm ]; then
  3595. _1="-D LLVM_ROOT_DIR=$INST/llvm"
  3596. _2="-D LLVM_STATIC=ON"
  3597. PRINT " $_1"
  3598. PRINT " $_2"
  3599. _buildargs="$_buildargs $_1 $_2"
  3600. fi
  3601. else
  3602. _1="-D WITH_CYCLES_OSL=OFF"
  3603. _2="-D WITH_LLVM=OFF"
  3604. PRINT " $_1"
  3605. PRINT " $_2"
  3606. _buildargs="$_buildargs $_1 $_2"
  3607. fi
  3608. if [ "$OSD_SKIP" = false ]; then
  3609. _1="-D WITH_OPENSUBDIV=ON"
  3610. PRINT " $_1"
  3611. _buildargs="$_buildargs $_1"
  3612. if [ -d $INST/osd ]; then
  3613. _1="-D OPENSUBDIV_ROOT_DIR=$INST/osd"
  3614. PRINT " $_1"
  3615. _buildargs="$_buildargs $_1"
  3616. fi
  3617. fi
  3618. if [ "$OPENVDB_SKIP" = false ]; then
  3619. _1="-D WITH_OPENVDB=ON"
  3620. _2="-D WITH_OPENVDB_BLOSC=ON"
  3621. PRINT " $_1"
  3622. PRINT " $_2"
  3623. _buildargs="$_buildargs $_1 $_2"
  3624. if [ -d $INST/openvdb ]; then
  3625. _1="-D OPENVDB_ROOT_DIR=$INST/openvdb"
  3626. PRINT " $_1"
  3627. _buildargs="$_buildargs $_1"
  3628. fi
  3629. fi
  3630. if [ "$WITH_OPENCOLLADA" = true ]; then
  3631. _1="-D WITH_OPENCOLLADA=ON"
  3632. PRINT " $_1"
  3633. _buildargs="$_buildargs $_1"
  3634. fi
  3635. if [ "$WITH_JACK" = true ]; then
  3636. _1="-D WITH_JACK=ON"
  3637. _2="-D WITH_JACK_DYNLOAD=ON"
  3638. PRINT " $_1"
  3639. PRINT " $_2"
  3640. _buildargs="$_buildargs $_1 $_2"
  3641. fi
  3642. if [ "$ALEMBIC_SKIP" = false ]; then
  3643. _1="-D WITH_ALEMBIC=ON"
  3644. PRINT " $_1"
  3645. _buildargs="$_buildargs $_1"
  3646. if [ -d $INST/alembic ]; then
  3647. _1="-D ALEMBIC_ROOT_DIR=$INST/alembic"
  3648. PRINT " $_1"
  3649. _buildargs="$_buildargs $_1"
  3650. fi
  3651. fi
  3652. if [ "$NO_SYSTEM_GLEW" = true ]; then
  3653. _1="-D WITH_SYSTEM_GLEW=OFF"
  3654. PRINT " $_1"
  3655. _buildargs="$_buildargs $_1"
  3656. fi
  3657. if [ "$FFMPEG_SKIP" = false ]; then
  3658. _1="-D WITH_CODEC_FFMPEG=ON"
  3659. _2="-D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;swresample;lzma;rt;`print_info_ffmpeglink`'"
  3660. PRINT " $_1"
  3661. PRINT " $_2"
  3662. _buildargs="$_buildargs $_1 $_2"
  3663. if [ -d $INST/ffmpeg ]; then
  3664. _1="-D FFMPEG=$INST/ffmpeg"
  3665. PRINT " $_1"
  3666. _buildargs="$_buildargs $_1"
  3667. fi
  3668. fi
  3669. PRINT ""
  3670. PRINT "Or even simpler, just run (in your blender-source dir):"
  3671. PRINT " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""
  3672. }
  3673. #### "Main" ####
  3674. # Detect distribution type used on this machine
  3675. if [ -f /etc/debian_version ]; then
  3676. DISTRO="DEB"
  3677. install_DEB
  3678. elif [ -f /etc/arch-release ]; then
  3679. DISTRO="ARCH"
  3680. install_ARCH
  3681. elif [ -f /etc/redhat-release -o /etc/SuSE-release ]; then
  3682. DISTRO="RPM"
  3683. install_RPM
  3684. else
  3685. DISTRO="OTHER"
  3686. install_OTHER
  3687. fi
  3688. print_info | tee $INFO_PATH/BUILD_NOTES.txt
  3689. PRINT ""
  3690. PRINT "This information has been written to $INFO_PATH/BUILD_NOTES.txt"
  3691. PRINT ""
  3692. # Switch back to user language.
  3693. LANG=LANG_BACK
  3694. export LANG
  3695. CXXFLAGS=$CXXFLAGS_BACK
  3696. export CXXFLAGS