bsd.port.mk 99 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470
  1. #-*- mode: Makefile; tab-width: 4; -*-
  2. # ex:ts=4 sw=4 filetype=make:
  3. # $OpenBSD: bsd.port.mk,v 1.1355 2017/06/05 21:53:12 sthen Exp $
  4. #
  5. # bsd.port.mk - 940820 Jordan K. Hubbard.
  6. # This file is in the public domain.
  7. # Each port has a MAINTAINER, which is the email address(es) of the person(s)
  8. # to contact if you have questions/suggestions about that specific port.
  9. # To obtain that address, just type
  10. # make show=MAINTAINER
  11. # in the specific port's directory.
  12. #
  13. # The ports@openbsd.org address is the `default' MAINTAINER (the generic
  14. # OpenBSD ports mailing-list).
  15. # The definitive source of documentation to this file's user-visible parts
  16. # is bsd.port.mk(5).
  17. #
  18. # Any variable or target starting with an underscore (e.g., _DEPEND_ECHO)
  19. # is internal to bsd.port.mk, not part of the user's API, and liable to
  20. # change without notice.
  21. #
  22. # a few experimental variables are voluntarily NOT documented
  23. # PORTS_BUILD_XENOCARA_TOO, XENOCARA_COMPONENT,
  24. # PARALLEL_BUILD, PARALLEL_INSTALL, DANGEROUS, GLOBAL_DEPENDS_CACHE
  25. #
  26. # Enquiries as to the bsd.port.mk framework should usually be directed
  27. # to ports@openbsd.org.
  28. # Sequence for "all" is: fetch checksum prepare extract patch configure build
  29. #
  30. # Please read the comments in the targets section below, you
  31. # should be able to use the pre-* or post-* targets (which
  32. # are available for every stage except checksum) or provide
  33. # an overriding do-* target to do pretty much anything you
  34. # want.
  35. #
  36. # For historical reasons, the distpatch target is a subtarget of patch.
  37. # If you provide a do-patch, you MUST call distpatch explicitly.
  38. # The sequence of hooks actually run is:
  39. #
  40. # pre-patch `real distpatch' post-distpatch `real patch' post-patch
  41. #
  42. #
  43. # tests and variable definitions come first, THEN targets
  44. #
  45. .if ${.MAKEFLAGS:MFLAVOR=*}
  46. ERRORS += "Fatal: Use 'env FLAVOR=${FLAVOR} ${MAKE}' instead."
  47. .endif
  48. .if ${.MAKEFLAGS:MSUBPACKAGE=*}
  49. ERRORS += "Fatal: Use 'env SUBPACKAGE=${SUBPACKAGE} ${MAKE}' instead."
  50. .endif
  51. .for f v in bsd.port.mk _BSD_PORT_MK bsd.port.subdir.mk _BSD_PORT_SUBDIR_MK
  52. . if defined($v)
  53. ERRORS += "Fatal: inclusion of bsd.port.mk from $f"
  54. . endif
  55. .endfor
  56. # include guard so that other parts don't include this twice
  57. _BSD_PORT_MK = Done
  58. # User settings
  59. FETCH_PACKAGES ?= No
  60. CLEANDEPENDS ?= No
  61. BULK ?= Auto
  62. WRKDIR_LINKNAME ?=
  63. USE_MFS ?= No
  64. WRKOBJDIR ?= ${PORTSDIR}/pobj
  65. WRKOBJDIR_MFS ?= /tmp/pobj
  66. FAKEOBJDIR ?=
  67. BULK_TARGETS ?=
  68. BULK_DO ?=
  69. CHECK_LIB_DEPENDS ?= No
  70. FORCE_UPDATE ?= No
  71. DPB ?= All Fetch Test
  72. PREPARE_CHECK_ONLY ?= No
  73. _SHSCRIPT = sh ${PORTSDIR}/infrastructure/bin
  74. DPB_PROPERTIES ?=
  75. # bsd.own.mk overrides
  76. BINMODE = 755
  77. NONBINMODE = 644
  78. # All variables relevant to the port's description (see dump-vars)
  79. _ALL_VARIABLES = BUILD_DEPENDS IS_INTERACTIVE \
  80. SUBPACKAGE FLAVOR BUILD_PACKAGES DPB_PROPERTIES \
  81. MULTI_PACKAGES
  82. # and stuff needing to be MULTI_PACKAGE'd
  83. _ALL_VARIABLES_INDEXED = FULLPKGNAME RUN_DEPENDS LIB_DEPENDS IGNORE
  84. _ALL_VARIABLES_PER_ARCH =
  85. # consumers of (dump-vars) include sqlports generation and dpb
  86. # dpb doesn't need everything, those are speed optimizations
  87. .if ${DPB:L:Mfetch} || ${DPB:L:Mall}
  88. _ALL_VARIABLES += DISTFILES PATCHFILES SUPDISTFILES DIST_SUBDIR MASTER_SITES \
  89. MASTER_SITES0 MASTER_SITES1 MASTER_SITES2 MASTER_SITES3 MASTER_SITES4 \
  90. MASTER_SITES5 MASTER_SITES6 MASTER_SITES7 MASTER_SITES8 MASTER_SITES9 \
  91. CHECKSUM_FILE FETCH_MANUALLY MISSING_FILES \
  92. PERMIT_DISTFILES_FTP
  93. .endif
  94. .if ${DPB:L:Mtest} || ${DPB:L:Mall}
  95. _ALL_VARIABLES += NO_TEST TEST_IS_INTERACTIVE TEST_DEPENDS
  96. .endif
  97. .if ${DPB:L:Mall}
  98. _ALL_VARIABLES += HOMEPAGE DISTNAME \
  99. BROKEN COMES_WITH \
  100. USE_GMAKE USE_GROFF MODULES FLAVORS \
  101. NO_BUILD PSEUDO_FLAVORS \
  102. CONFIGURE_STYLE USE_LIBTOOL SEPARATE_BUILD \
  103. SHARED_LIBS TARGETS PSEUDO_FLAVOR \
  104. MAINTAINER AUTOCONF_VERSION AUTOMAKE_VERSION CONFIGURE_ARGS \
  105. GH_ACCOUNT GH_COMMIT GH_PROJECT GH_TAGNAME PORTROACH \
  106. PORTROACH_COMMENT MAKEFILE_LIST USE_WXNEEDED COMPILER \
  107. COMPILER_LANGS COMPILER_LINKS
  108. _ALL_VARIABLES_PER_ARCH += BROKEN
  109. # and stuff needing to be MULTI_PACKAGE'd
  110. _ALL_VARIABLES_INDEXED += COMMENT PKGNAME \
  111. ONLY_FOR_ARCHS NOT_FOR_ARCHS PKGSPEC PREFIX \
  112. PERMIT_PACKAGE_FTP PERMIT_PACKAGE_CDROM WANTLIB CATEGORIES DESCR \
  113. EPOCH REVISION STATIC_PLIST PKG_ARCH
  114. .endif
  115. PATCH_CHECK_ONLY ?= No
  116. REFETCH ?= false
  117. PORTROACH ?=
  118. # Global path locations.
  119. PORTSDIR ?= /usr/ports
  120. LOCALBASE ?= /usr/local
  121. X11BASE ?= /usr/X11R6
  122. VARBASE ?= /var
  123. DISTDIR ?= ${PORTSDIR}/distfiles
  124. BULK_COOKIES_DIR ?= ${PORTSDIR}/bulk/${MACHINE_ARCH}
  125. UPDATE_COOKIES_DIR ?= ${PORTSDIR}/update/${MACHINE_ARCH}
  126. PLIST_REPOSITORY ?= ${PORTSDIR}/plist
  127. .if !empty(PLIST_REPOSITORY)
  128. PLIST_DB ?= ${PLIST_REPOSITORY}/${MACHINE_ARCH}
  129. .endif
  130. PACKAGE_REPOSITORY ?= ${PORTSDIR}/packages
  131. # experimental, don't touch the default unless you really know
  132. # what you are doing
  133. PORTS_BUILD_XENOCARA_TOO ?= No
  134. .if ${PORTS_BUILD_XENOCARA_TOO:L} == "no"
  135. . if !exists(${X11BASE}/man/mandoc.db)
  136. . if exists(${X11BASE}/man/whatis.db)
  137. ERRORS += "Your X11/system is not current"
  138. . else
  139. ERRORS += "Fatal: building ports requires correctly installed X11"
  140. . endif
  141. . endif
  142. .endif
  143. # stuff common to bsd.port.mk and bsd.port.subdir.mk
  144. # (determination of PKGPATH and various shell fragments:
  145. # flavor determination, dependency caching behavior...)
  146. .include "${PORTSDIR}/infrastructure/mk/pkgpath.mk"
  147. .if ${USE_MFS:L} == "yes"
  148. WRKOBJDIR_${PKGPATH} ?= ${WRKOBJDIR_MFS}
  149. .else
  150. WRKOBJDIR_${PKGPATH} ?= ${WRKOBJDIR}
  151. .endif
  152. FAKEOBJDIR_${PKGPATH} ?= ${FAKEOBJDIR}
  153. BULK_${PKGPATH} ?= ${BULK}
  154. BULK_TARGETS_${PKGPATH} ?= ${BULK_TARGETS}
  155. BULK_DO_${PKGPATH} ?= ${BULK_DO}
  156. CLEANDEPENDS_${PKGPATH} ?= ${CLEANDEPENDS}
  157. # Commands and command settings.
  158. PKG_DBDIR ?= /var/db/pkg
  159. PROGRESS_METER ?= Yes
  160. .if ${PROGRESS_METER:L} == "yes"
  161. _PROGRESS = -m
  162. .else
  163. _PROGRESS =
  164. .endif
  165. FETCH_CMD ?= /usr/bin/ftp -V ${_PROGRESS} -C
  166. # switch for fetching each distfile: avoid warnings for missing
  167. # distinfo and wrong size when running makesum
  168. _MAKESUM ?= false
  169. PKG_TMPDIR ?= /var/tmp
  170. PKG_ADD ?= /usr/sbin/pkg_add
  171. PKG_INFO ?= /usr/sbin/pkg_info
  172. PKG_CREATE ?= /usr/sbin/pkg_create
  173. PKG_DELETE ?= /usr/sbin/pkg_delete
  174. _PKG_ADD = ${PKG_ADD} ${_PROGRESS} -I
  175. _PKG_CREATE = ${PKG_CREATE} ${_PROGRESS}
  176. _PKG_ADD_LOCAL = TRUSTED_PKG_PATH=${_PKG_REPO} ${_PKG_ADD}
  177. _PKG_DELETE = ${PKG_DELETE} ${_PROGRESS}
  178. .if defined(PKG_PATH)
  179. _PKG_PATH = ${PKG_PATH}
  180. .else
  181. _PKG_PATH = installpath
  182. .endif
  183. .if !defined(_ARCH_DEFINES_INCLUDED)
  184. _ARCH_DEFINES_INCLUDED = Done
  185. . include "${PORTSDIR}/infrastructure/mk/arch-defines.mk"
  186. .endif
  187. .if !defined(_MAKEFILE_INC_DONE)
  188. . if exists(${.CURDIR}/../Makefile.inc)
  189. _MAKEFILE_INC_DONE = Yes
  190. . include "${.CURDIR}/../Makefile.inc"
  191. . endif
  192. .endif
  193. # XXX default target varies, so that make show=... and make clean=... work
  194. .if defined(verbose-show)
  195. .MAIN: verbose-show
  196. .elif defined(show)
  197. .MAIN: show
  198. .elif defined(clean)
  199. .MAIN: clean
  200. .elif defined(_internal-clean)
  201. clean = ${_internal-clean}
  202. .MAIN: _internal-clean
  203. .else
  204. .MAIN: all
  205. .endif
  206. # XXX clean is set in stone on the cmdline.
  207. _clean = ${clean}
  208. .if empty(_clean) || ${_clean} == "depends"
  209. _clean += work
  210. .endif
  211. .if ${_clean:Mall}
  212. _clean += work build packages plist
  213. .endif
  214. .if ${CLEANDEPENDS_${PKGPATH}:L} == "yes"
  215. _clean += depends
  216. .endif
  217. .if ${_clean:Mwork} || ${_clean:Mbuild}
  218. _clean += fake
  219. .endif
  220. .if ${_clean:Mforce}
  221. _clean += -f
  222. .endif
  223. _okay_words = depends work fake -f flavors dist install sub packages package \
  224. bulk force plist build all
  225. .for _w in ${_clean}
  226. . if !${_okay_words:M${_w}}
  227. ERRORS += "Fatal: unknown clean command: ${_w}\n(not in ${_okay_words})"
  228. . endif
  229. .endfor
  230. # MODULES support
  231. # reserved name spaces: for module=NAME, modname*, _modname* variables and
  232. # targets.
  233. # These variables must be defined before modules
  234. CONFIGURE_STYLE ?=
  235. NO_DEPENDS ?= No
  236. NO_BUILD ?= No
  237. NO_TEST ?= No
  238. INSTALL_TARGET ?= install
  239. .if !defined(_ARCH_DEFINES_INCLUDED)
  240. _ARCH_DEFINES_INCLUDED = Done
  241. . include "${PORTSDIR}/infrastructure/mk/arch-defines.mk"
  242. .endif
  243. .if ${CONFIGURE_STYLE:L:Mautomake} || ${CONFIGURE_STYLE:L:Mautoconf} || \
  244. ${CONFIGURE_STYLE:L:Mautoupdate}
  245. . if !${CONFIGURE_STYLE:L:Mgnu}
  246. CONFIGURE_STYLE += gnu
  247. . endif
  248. .endif
  249. .if ${CONFIGURE_STYLE:L:Mmodbuild}
  250. . if !${CONFIGURE_STYLE:L:Mperl}
  251. CONFIGURE_STYLE += perl
  252. . endif
  253. .endif
  254. .for _i in perl gnu imake
  255. . if ${CONFIGURE_STYLE:L:M${_i}}
  256. MODULES += ${_i}
  257. . endif
  258. .endfor
  259. MODULES ?=
  260. .if !empty(MODULES) || !empty(COMPILER)
  261. _MODULES_DONE =
  262. . include "${PORTSDIR}/infrastructure/mk/modules.port.mk"
  263. .endif
  264. ###
  265. ### Variable setup that can happen after modules
  266. ###
  267. .for v in PKGREPOSITORY PKGREPOSITORYBASE CDROM_PACKAGES FTP_PACKAGES \
  268. SED_PLIST IGNORE_FILES NO_REGRESS REGRESS_IS_INTERACTIVE REGRESS_DEPENDS \
  269. PERMIT_DISTFILES_CDROM
  270. . if defined($v)
  271. ERRORS += "Fatal: Variable $v is obsolete, see bsd.port.mk(5)"
  272. . endif
  273. .endfor
  274. .for t in pre-fetch do-fetch post-fetch pre-package do-package post-package
  275. . if target($t)
  276. ERRORS += "Fatal: you're not allowed to override $t"
  277. . endif
  278. .endfor
  279. # some introspection
  280. TARGETS =
  281. .for _t in extract patch distpatch configure build fake install
  282. . for _s in pre do post
  283. . if target(${_s}-${_t})
  284. TARGETS += ${_s}-${_t}
  285. . endif
  286. . endfor
  287. .endfor
  288. .for _t in post-extract post-patch pre-configure configure pre-fake post-install
  289. . for _m in ${MODULES:T:U}
  290. . if defined(MOD${_m}_${_t})
  291. TARGETS += MOD${_m}_${_t}
  292. . endif
  293. . endfor
  294. .endfor
  295. SEPARATE_BUILD ?= No
  296. DIST_SUBDIR ?=
  297. .if !empty(DIST_SUBDIR)
  298. FULLDISTDIR ?= ${DISTDIR}/${DIST_SUBDIR}
  299. .else
  300. FULLDISTDIR ?= ${DISTDIR}
  301. .endif
  302. PATCHDIR ?= ${.CURDIR}/patches
  303. PATCH_LIST ?= patch-*
  304. FILESDIR ?= ${.CURDIR}/files
  305. PKGDIR ?= ${.CURDIR}/pkg
  306. PREFIX ?= ${LOCALBASE}
  307. TRUEPREFIX ?= ${PREFIX}
  308. DESTDIRNAME ?= DESTDIR
  309. DESTDIR ?= ${WRKINST}
  310. MAKE_FLAGS ?=
  311. FAKE_FLAGS ?=
  312. LIBTOOL_FLAGS ?=
  313. # User choice, consider read-only from a given port
  314. BASESYSCONFDIR ?= /etc
  315. # where configuration files should actually go
  316. SYSCONFDIR ?= ${BASESYSCONFDIR}
  317. # User choice, consider read-only from a given port
  318. BASELOCALSTATEDIR ?= ${VARBASE}
  319. # Defaut localstatedir for gnu ports
  320. LOCALSTATEDIR ?= ${BASELOCALSTATEDIR}
  321. # Used to build wrapper scripts to run compilers, appended by compiler MODULES
  322. COMPILER_LINKS ?=
  323. RCDIR ?= /etc/rc.d
  324. USE_WXNEEDED ?= No
  325. USE_GMAKE ?= No
  326. .if ${USE_GMAKE:L} == "yes"
  327. BUILD_DEPENDS += devel/gmake
  328. MAKE_PROGRAM = ${GMAKE}
  329. CONFIGURE_ENV += MAKE=${MAKE_PROGRAM}
  330. .else
  331. MAKE_PROGRAM = ${MAKE}
  332. .endif
  333. # Even if a port does not actually use libtool, defaulting to Yes does no
  334. # harm since there is a libtool in the base system.
  335. USE_LIBTOOL ?= Yes
  336. _lt_libs =
  337. .if ${USE_LIBTOOL:L} != "no"
  338. . if ${USE_LIBTOOL:L} == "gnu"
  339. LIBTOOL ?= ${LOCALBASE}/bin/libtool
  340. BUILD_DEPENDS += devel/libtool
  341. . else
  342. LIBTOOL ?= /usr/bin/libtool
  343. MAKE_ENV += PORTSDIR="${PORTSDIR}"
  344. . endif
  345. # Massage into an intermediate variable because python does
  346. # not parse variables with trailing spaces properly and adds
  347. # a bogus "" argument.
  348. _LIBTOOL = ${LIBTOOL}
  349. .if !empty(LIBTOOL_FLAGS)
  350. _LIBTOOL += "${LIBTOOL_FLAGS}"
  351. .endif
  352. CONFIGURE_ENV += LIBTOOL="${_LIBTOOL}" ${_lt_libs}
  353. MAKE_ENV += LIBTOOL="${_LIBTOOL}" ${_lt_libs}
  354. MAKE_FLAGS += LIBTOOL="${_LIBTOOL}" ${_lt_libs}
  355. .endif
  356. # log for the SHARED_LIBS override
  357. MAKE_FLAGS += SHARED_LIBS_LOG=${WRKBUILD}/shared_libs.log
  358. USE_CCACHE ?= No
  359. NO_CCACHE ?= No
  360. CCACHE_ENV ?=
  361. .if ${USE_CCACHE:L} == "yes" && ${NO_CCACHE:L} == "no" && ${NO_BUILD:L} == "no"
  362. CCACHE_DIR ?= ${WRKOBJDIR_${PKGPATH}}/.ccache
  363. MAKE_ENV += CCACHE_DIR=${CCACHE_DIR} ${CCACHE_ENV}
  364. CONFIGURE_ENV += CCACHE_DIR=${CCACHE_DIR}
  365. BUILD_DEPENDS += devel/ccache
  366. COMPILER_WRAPPER = ccache
  367. .endif
  368. # by default, installation (fake) does not need -jN.
  369. ALL_FAKE_FLAGS= ${MAKE_FLAGS:N-j[0-9]*} ${DESTDIRNAME}=${WRKINST} ${FAKE_FLAGS}
  370. .if ${LOCALBASE:L} != "/usr/local"
  371. _PKG_ADD += -L ${LOCALBASE}
  372. .endif
  373. # XXX this stuff is not production-ready, because there are too many bugs in
  374. # parallel make yet. MAKE_JOBS>1 is known to work on a few ports and used
  375. # sparingly by dpb (DPB_PROPERTIES=parallel) for obvious gains.
  376. #
  377. PARALLEL_BUILD ?= Yes
  378. PARALLEL_INSTALL ?= ${PARALLEL_BUILD}
  379. MAKE_JOBS ?= 1
  380. .if ${MAKE_JOBS} != 1
  381. . if ${PARALLEL_BUILD:L} == "yes"
  382. MAKE_FLAGS += -j${MAKE_JOBS}
  383. . endif
  384. . if ${PARALLEL_INSTALL:L} == "yes"
  385. ALL_FAKE_FLAGS += -j${MAKE_JOBS}
  386. . endif
  387. .endif
  388. # Here comes the part that sets BUILD_PACKAGES and various IGNORE* up.
  389. .if !defined(_BSD_PORT_ARCH_MK_INCLUDED)
  390. . include "${PORTSDIR}/infrastructure/mk/bsd.port.arch.mk"
  391. .endif
  392. .for _S in ${MULTI_PACKAGES}
  393. PERMIT_PACKAGE_CDROM${_S} ?= ${PERMIT_PACKAGE_CDROM}
  394. . if defined(PERMIT_PACKAGE_FTP)
  395. PERMIT_PACKAGE_FTP${_S} ?= ${PERMIT_PACKAGE_FTP}
  396. . endif
  397. . if defined(PERMIT_PACKAGE_CDROM${_S}) && ${PERMIT_PACKAGE_CDROM${_S}:L} == "yes"
  398. PERMIT_PACKAGE_FTP${_S} ?= Yes
  399. . endif
  400. . if !defined(PERMIT_PACKAGE_CDROM${_S}) || !defined(PERMIT_PACKAGE_FTP${_S})
  401. ERRORS += "The licensing info for ${FULLPKGNAME${_S}} is incomplete."
  402. _BAD_LICENSING = Yes
  403. . endif
  404. .endfor
  405. .if defined(PERMIT_PACKAGE_CDROM) && ${PERMIT_PACKAGE_CDROM:L} == "yes"
  406. PERMIT_PACKAGE_FTP ?= Yes
  407. PERMIT_DISTFILES_FTP ?= Yes
  408. .elif defined(PERMIT_PACKAGE_FTP) && ${PERMIT_PACKAGE_FTP:L} == "yes"
  409. PERMIT_DISTFILES_FTP ?= Yes
  410. .endif
  411. .if !defined(PERMIT_PACKAGE_CDROM) || !defined(PERMIT_PACKAGE_FTP) || \
  412. !defined(PERMIT_DISTFILES_FTP)
  413. ERRORS += "The licensing info for ${FULLPKGNAME} is incomplete."
  414. _BAD_LICENSING = Yes
  415. .endif
  416. .if defined(_BAD_LICENSING)
  417. ERRORS += "Please notify the OpenBSD port maintainer:"
  418. ERRORS += " ${MAINTAINER}"
  419. PERMIT_PACKAGE_CDROM = No
  420. PERMIT_PACKAGE_FTP = No
  421. PERMIT_DISTFILES_FTP = No
  422. . for _S in ${MULTI_PACKAGES}
  423. PERMIT_PACKAGE_CDROM${_S} = No
  424. PERMIT_PACKAGE_FTP${_S} = No
  425. . endfor
  426. .endif
  427. .if ${MACHINE_ARCH} != ${ARCH}
  428. PKG_ARCH ?= ${MACHINE_ARCH},${ARCH}
  429. .else
  430. PKG_ARCH ?= ${MACHINE_ARCH}
  431. .endif
  432. REVISION ?=
  433. EPOCH ?=
  434. .for _s in ${MULTI_PACKAGES}
  435. REVISION${_s} ?= ${REVISION}
  436. EPOCH${_s} ?= ${EPOCH}
  437. .endfor
  438. FLAVOR ?=
  439. FLAVORS ?=
  440. PSEUDO_FLAVORS ?=
  441. FLAVORS += ${PSEUDO_FLAVORS}
  442. .if !empty(FLAVORS:Mtest) && empty(FLAVOR:Mtest)
  443. NO_TEST = Yes
  444. .endif
  445. .if empty(SUBPACKAGE)
  446. ERRORS += "Fatal: empty SUBPACKAGE is invalid."
  447. .else
  448. . for _i in ${SUBPACKAGE}
  449. . if empty(MULTI_PACKAGES:M${_i})
  450. ERRORS += "Fatal: Subpackage ${SUBPACKAGE} does not exist."
  451. . endif
  452. . endfor
  453. .endif
  454. .if !empty(MULTI_PACKAGES:N-*)
  455. ERRORS += "Fatal: SUBPACKAGES should always begin with -: ${MULTI_PACKAGES:N-*}."
  456. .endif
  457. # Build FLAVOR_EXT, checking that no flavors are misspelled
  458. FLAVOR_EXT :=
  459. BASE_PKGPATH := ${PKGPATH}
  460. # _FLAVOR_EXT2 is used internally for working directories.
  461. # It encodes flavors and pseudo-flavors.
  462. _FLAVOR_EXT2 :=
  463. BUILD_PKGPATH := ${PKGPATH}
  464. _PKG_ARGS =
  465. .if !empty(PLIST_DB)
  466. _PKG_ARGS += -DHISTORY_DIR=${PLIST_DB}/history
  467. .endif
  468. _README_DIR = ${LOCALBASE}/share/doc/pkg-readmes
  469. PSEUDO_FLAVOR =
  470. # (applies only to PLIST for now)
  471. .if !empty(FLAVORS)
  472. . for _i in ${FLAVORS}
  473. . if empty(FLAVOR:M${_i})
  474. _PKG_ARGS += -D${_i}=0
  475. . else
  476. _FLAVOR_EXT2 := ${_FLAVOR_EXT2}-${_i}
  477. BUILD_PKGPATH := ${BUILD_PKGPATH},${_i}
  478. . if empty(PSEUDO_FLAVORS:M${_i})
  479. FLAVOR_EXT := ${FLAVOR_EXT}-${_i}
  480. BASE_PKGPATH := ${BASE_PKGPATH},${_i}
  481. . else
  482. PSEUDO_FLAVOR := ${PSEUDO_FLAVOR},${_i}
  483. . endif
  484. _PKG_ARGS += -D${_i}=1
  485. . endif
  486. . endfor
  487. .endif
  488. .if !${BUILD_PKGPATH:M*,*}
  489. BUILD_PKGPATH := ${BUILD_PKGPATH},
  490. .endif
  491. .if !empty(FLAVORS:M[0-9]*)
  492. ERRORS += "Fatal: flavor should never start with a digit"
  493. .endif
  494. .if !empty(FLAVOR)
  495. . if !empty(FLAVORS)
  496. . for _i in ${FLAVOR}
  497. . if empty(FLAVORS:M${_i})
  498. ERRORS += "Fatal: Unknown flavor: ${_i}"
  499. ERRORS += " (Possible flavors are: ${FLAVORS})."
  500. . endif
  501. . endfor
  502. . else
  503. ERRORS += "Fatal: Unknown flavor(s) ${FLAVOR}"
  504. ERRORS += " (No flavors for this port)."
  505. . endif
  506. .endif
  507. USE_GROFF ?= No
  508. .if ${USE_GROFF:L} == "yes"
  509. BUILD_DEPENDS += textproc/groff>=1.21
  510. _PKG_ARGS += -DUSE_GROFF=1
  511. .endif
  512. PKGNAME ?= ${DISTNAME}
  513. FULLPKGNAME ?= ${PKGNAME}${FLAVOR_EXT}
  514. _MASTER ?=
  515. _DEPENDENCY_STACK ?=
  516. .if ${MULTI_PACKAGES} == "-"
  517. # XXX "parse" FULLPKGNAME: is there a flavor after the version number
  518. . if ${FULLPKGNAME:M*-[0-9]*-*}
  519. . if !empty(REVISION)
  520. # XXX simplest way is to alter FULLPKGNAME in place, even though := is evil...
  521. FULLPKGNAME := ${FULLPKGNAME:C/-([0-9][^-]*)-/-\1p${REVISION}-/}
  522. . endif
  523. . if !empty(EPOCH)
  524. FULLPKGNAME := ${FULLPKGNAME:C/-([0-9][^-]*)-/-\1v${EPOCH}-/}
  525. . endif
  526. . else
  527. . if !empty(REVISION)
  528. FULLPKGNAME := ${FULLPKGNAME}p${REVISION}
  529. . endif
  530. . if !empty(EPOCH)
  531. FULLPKGNAME := ${FULLPKGNAME}v${EPOCH}
  532. . endif
  533. . endif
  534. PKGSPEC ?= ${FULLPKGNAME:C/-[0-9].*/-*/}
  535. PKGSPEC- = ${PKGSPEC}
  536. FULLPKGNAME- = ${FULLPKGNAME}
  537. .else
  538. . for _s in ${MULTI_PACKAGES}
  539. . if defined(FULLPKGNAME${_s})
  540. . if !defined(FULLPKGPATH${_s}) && "${FLAVORS}" != " ${PSEUDO_FLAVORS}"
  541. ERRORS += "Warning: FULLPKGNAME${_s} defined but no FULLPKGPATH${_s}"
  542. . endif
  543. . else
  544. . if defined(PKGNAME${_s})
  545. FULLPKGNAME${_s} = ${PKGNAME${_s}}${FLAVOR_EXT}
  546. . else
  547. FULLPKGNAME${_s} = ${PKGNAME}${_s}${FLAVOR_EXT}
  548. . endif
  549. . endif
  550. # XXX see comments above for !MULTI_PACKAGES case
  551. . if ${FULLPKGNAME${_s}:M*-[0-9]*-*}
  552. . if !empty(REVISION${_s})
  553. FULLPKGNAME${_s} := ${FULLPKGNAME${_s}:C/-([0-9][^-]*)-/-\1p${REVISION${_s}}-/}
  554. . endif
  555. . if !empty(EPOCH${_s})
  556. FULLPKGNAME${_s} := ${FULLPKGNAME${_s}:C/-([0-9][^-]*)-/-\1v${EPOCH${_s}}-/}
  557. . endif
  558. . else
  559. . if !empty(REVISION${_s})
  560. FULLPKGNAME${_s} := ${FULLPKGNAME${_s}}p${REVISION${_s}}
  561. . endif
  562. . if !empty(EPOCH${_s})
  563. FULLPKGNAME${_s} := ${FULLPKGNAME${_s}}v${EPOCH${_s}}
  564. . endif
  565. . endif
  566. PKGSPEC${_s} ?= ${FULLPKGNAME${_s}:C/-[0-9].*/-*/}
  567. . endfor
  568. .endif
  569. _WRKDIR_COOKIE = ${WRKDIR}/.extract_started
  570. _EXTRACT_COOKIE = ${WRKDIR}/.extract_done
  571. _PATCH_COOKIE = ${WRKDIR}/.patch_done
  572. _DISTPATCH_COOKIE = ${WRKDIR}/.distpatch_done
  573. _PREPATCH_COOKIE = ${WRKDIR}/.prepatch_done
  574. _BULK_COOKIE = ${BULK_COOKIES_DIR}/${FULLPKGNAME}
  575. _FAKE_COOKIE = ${WRKINST}/.fake_done
  576. _INSTALL_PRE_COOKIE = ${WRKINST}/.install_started
  577. _UPDATE_COOKIES =
  578. _FUPDATE_COOKIES =
  579. _INSTALL_COOKIES =
  580. .for _S in ${BUILD_PACKAGES}
  581. . if !empty(UPDATE_COOKIES_DIR)
  582. _UPDATE_COOKIE${_S} = ${UPDATE_COOKIES_DIR}/${FULLPKGNAME${_S}}
  583. _FUPDATE_COOKIE${_S} = ${UPDATE_COOKIES_DIR}/F${FULLPKGNAME${_S}}
  584. . else
  585. _UPDATE_COOKIE${_S} = ${WRKDIR}/.update_${FULLPKGNAME${_S}}
  586. _FUPDATE_COOKIE${_S} = ${WRKDIR}/.fupdate_${FULLPKGNAME${_S}}
  587. . endif
  588. _INSTALL_COOKIE${_S} = ${PKG_DBDIR}/${FULLPKGNAME${_S}}/+CONTENTS
  589. _UPDATE_COOKIES += ${_UPDATE_COOKIE${_S}}
  590. _FUPDATE_COOKIES += ${_FUPDATE_COOKIE${_S}}
  591. _INSTALL_COOKIES += ${_INSTALL_COOKIE${_S}}
  592. .endfor
  593. .if ${SEPARATE_BUILD:L} != "no"
  594. _CONFIGURE_COOKIE = ${WRKBUILD}/.configure_done
  595. _BUILD_COOKIE = ${WRKBUILD}/.build_done
  596. _TEST_COOKIE = ${WRKBUILD}/.test_done
  597. .else
  598. _CONFIGURE_COOKIE = ${WRKDIR}/.configure_done
  599. _BUILD_COOKIE = ${WRKDIR}/.build_done
  600. _TEST_COOKIE = ${WRKDIR}/.test_done
  601. .endif
  602. _ALL_COOKIES = ${_EXTRACT_COOKIE} ${_PATCH_COOKIE} ${_CONFIGURE_COOKIE} \
  603. ${_INSTALL_PRE_COOKIE} ${_BUILD_COOKIE} ${_TEST_COOKIE} \
  604. ${_PACKAGE_COOKIES} ${_CACHE_PACKAGE_COOKIES} \
  605. ${_DISTPATCH_COOKIE} ${_PREPATCH_COOKIE} ${_FAKE_COOKIE} \
  606. ${_WRKDIR_COOKIE} ${_DEPBUILD_COOKIES} \
  607. ${_DEPRUN_COOKIES} ${_DEPTEST_COOKIES} ${_UPDATE_COOKIES} \
  608. ${_DEPBUILDLIB_COOKIES} ${_DEPRUNLIB_COOKIES} \
  609. ${_DEPBUILDWANTLIB_COOKIE} ${_DEPRUNWANTLIB_COOKIE} ${_DEPLIBSPECS_COOKIES}
  610. _MAKE_COOKIE = touch
  611. GMAKE ?= gmake
  612. CHECKSUM_FILE ?= ${.CURDIR}/distinfo
  613. # Current digest algorithm
  614. _CIPHER = sha256
  615. PORTPATH ?= ${WRKDIR}/bin:/usr/bin:/bin:/usr/sbin:/sbin:${LOCALBASE}/bin:${X11BASE}/bin
  616. # Add any COPTS to CFLAGS. Note: programs that use imake do not
  617. # use CFLAGS! Also, many (most?) ports hard code CFLAGS, ignoring
  618. # what we pass in.
  619. CFLAGS += ${COPTS}
  620. CXXFLAGS += ${CXXOPTS}
  621. WARNINGS ?= no
  622. .if ${WARNINGS:L} == "yes"
  623. CFLAGS += ${CDIAGFLAGS}
  624. CXXFLAGS += ${CXXDIAGFLAGS}
  625. .endif
  626. # XXX trick ports into trying to write into / instead of the current user's
  627. # homedir.
  628. PORTHOME ?= /${PKGNAME}_writes_to_HOME
  629. MAKE_ENV += PATH='${PORTPATH}' PREFIX='${PREFIX}' \
  630. LOCALBASE='${LOCALBASE}' X11BASE='${X11BASE}' \
  631. CFLAGS='${CFLAGS:C/ *$//}' \
  632. TRUEPREFIX='${PREFIX}' ${DESTDIRNAME}='' \
  633. HOME='${PORTHOME}'
  634. DISTORIG ?= .bak.orig
  635. PATCH ?= /usr/bin/patch
  636. PATCHORIG ?= .orig
  637. PATCH_STRIP ?= -p0
  638. PATCH_DIST_STRIP ?= -p0
  639. PATCH_DEBUG ?= Yes
  640. .if ${PATCH_DEBUG:L} != "no"
  641. PATCH_ARGS ?= -d ${WRKDIST} -z ${PATCHORIG} -E ${PATCH_STRIP}
  642. PATCH_DIST_ARGS ?= -z ${DISTORIG} -d ${WRKDIST} -E ${PATCH_DIST_STRIP}
  643. .else
  644. PATCH_ARGS ?= -d ${WRKDIST} -z ${PATCHORIG} --forward --quiet -E ${PATCH_STRIP}
  645. PATCH_DIST_ARGS ?= -z ${DISTORIG} -d ${WRKDIST} --forward --quiet -E \
  646. ${PATCH_DIST_STRIP}
  647. .endif
  648. .if ${PATCH_CHECK_ONLY:L} == "yes"
  649. PATCH_ARGS += -C
  650. PATCH_DIST_ARGS += -C
  651. .endif
  652. TAR ?= /bin/tar
  653. UNZIP ?= unzip
  654. BZIP2 ?= bzip2
  655. # setup locations of compilers from the base system or environment variables.
  656. # MODULES for compilers (gcc4.port.mk, clang.port.mk) also append to this,
  657. # used to write wrappers to WRKDIR/bin which is at the head of the PATH.
  658. .if ${PROPERTIES:Mclang}
  659. COMPILER_LINKS += clang /usr/bin/clang clang++ /usr/bin/clang++
  660. .endif
  661. .if ! ${COMPILER_LINKS:Mcc}
  662. . if ${CC} == cc
  663. # use the full path for cc/c++ to avoid the script executing itself.
  664. COMPILER_LINKS += cc /usr/bin/cc
  665. . else
  666. # handle "make CC=foo".
  667. COMPILER_LINKS += cc ${CC}
  668. . endif
  669. .endif
  670. .if ! ${COMPILER_LINKS:Mc++}
  671. . if ${CXX} == c++
  672. COMPILER_LINKS += c++ /usr/bin/c++
  673. . else
  674. COMPILER_LINKS += c++ ${CXX}
  675. . endif
  676. .endif
  677. # copy selected info from bsd.own.mk
  678. MAKE_ENV += COMPILER_VERSION=${COMPILER_VERSION} \
  679. PICFLAG="${PICFLAG}" ASPICFLAG=${ASPICFLAG} \
  680. BINGRP=bin BINOWN=root BINMODE=${BINMODE} NONBINMODE=${NONBINMODE} \
  681. DIRMODE=755 \
  682. INSTALL_COPY=-c INSTALL_STRIP=${INSTALL_STRIP} \
  683. MANGRP=bin MANOWN=root MANMODE=${MANMODE}
  684. .if defined(NOPIC)
  685. MAKE_ENV += NOPIC=${NOPIC}
  686. .endif
  687. .if !empty(FAKEOBJDIR_${PKGPATH})
  688. WRKINST ?= ${FAKEOBJDIR_${PKGPATH}}/${PKGNAME}${_FLAVOR_EXT2}
  689. .else
  690. WRKINST ?= ${WRKDIR}/fake-${ARCH}${_FLAVOR_EXT2}
  691. .endif
  692. .if ${SEPARATE_BUILD:L:Mflavored}
  693. _WRKDIR_STEM = ${PKGNAME}
  694. .else
  695. _WRKDIR_STEM = ${PKGNAME}${_FLAVOR_EXT2}
  696. .endif
  697. WRKDIR ?= ${WRKOBJDIR_${PKGPATH}}/${_WRKDIR_STEM}
  698. _WRKDIRS = ${WRKOBJDIR_${PKGPATH}}/${_WRKDIR_STEM}
  699. _WRKDIRS += ${WRKOBJDIR}/${_WRKDIR_STEM}
  700. _WRKDIRS += ${WRKOBJDIR_MFS}/${_WRKDIR_STEM}
  701. # github related variables
  702. GH_TAGNAME ?=
  703. GH_COMMIT ?=
  704. GH_ACCOUNT ?=
  705. GH_PROJECT ?=
  706. .if !empty(GH_TAGNAME)
  707. WRKDIST ?= ${WRKDIR}/${GH_PROJECT}-${GH_TAGNAME:C/^v//}
  708. .elif !empty(GH_COMMIT)
  709. WRKDIST ?= ${WRKDIR}/${GH_PROJECT}-${GH_COMMIT}
  710. .else
  711. . if !defined(DISTNAME)
  712. WRKDIST ?= ${WRKDIR}
  713. . else
  714. WRKDIST ?= ${WRKDIR}/${DISTNAME}
  715. . endif
  716. .endif
  717. .if !empty(GH_PROJECT) && !empty(GH_TAGNAME)
  718. DISTNAME ?= ${GH_PROJECT}-${GH_TAGNAME:C/^v//}
  719. .endif
  720. WRKSRC ?= ${WRKDIST}
  721. .if ${SEPARATE_BUILD:L} != "no"
  722. WRKBUILD ?= ${WRKDIR}/build-${MACHINE_ARCH}${_FLAVOR_EXT2}
  723. .else
  724. WRKBUILD ?= ${WRKSRC}
  725. .endif
  726. WRKCONF ?= ${WRKBUILD}
  727. XENOCARA_COMPONENT ?= No
  728. # XXX autodetermine makefile actual name, can't do this in
  729. # xenocara.port.mk, since WRKBUILD isn't known yet.
  730. .if ${XENOCARA_COMPONENT:L} == "yes"
  731. . if exists(${WRKBUILD}/Makefile.bsd-wrapper)
  732. MAKE_FILE ?= Makefile.bsd-wrapper
  733. . endif
  734. .endif
  735. MAKE_FILE ?= Makefile
  736. ALL_TARGET ?= all
  737. FAKE_TARGET ?= ${INSTALL_TARGET}
  738. TEST_TARGET ?= test
  739. TEST_FLAGS ?=
  740. TEST_ENV ?=
  741. ALL_TEST_FLAGS = ${MAKE_FLAGS} ${TEST_FLAGS}
  742. ALL_TEST_ENV = ${MAKE_ENV} ${TEST_ENV}
  743. TEST_LOGFILE ?= ${WRKDIR}/test.log
  744. TEST_LOG ?= | tee ${TEST_LOGFILE}
  745. IS_INTERACTIVE ?= No
  746. TEST_IS_INTERACTIVE ?= No
  747. .if ${TEST_IS_INTERACTIVE:L} == "x11"
  748. TEST_ENV += DISPLAY=${DISPLAY} XAUTHORITY=${XAUTHORITY}
  749. XAUTHORITY ?= ${HOME}/.Xauthority
  750. .endif
  751. _PACKAGE_COOKIE_DEPS=${_FAKE_COOKIE} ${_FAKESUDO_CHECK_COOKIE}
  752. .for _s in ${BUILD_PACKAGES}
  753. PKGNAMES += ${FULLPKGNAME${_s}}
  754. PKGFILES += ${PKGFILE${_s}}
  755. PKGPATHS += ${FULLPKGPATH${_s}}
  756. .endfor
  757. STATIC_PLIST ?= Yes
  758. .for _s in ${MULTI_PACKAGES}
  759. . for _v in PKG_ARCH RUN_DEPENDS WANTLIB LIB_DEPENDS PREFIX CATEGORIES \
  760. STATIC_PLIST
  761. ${_v}${_s} ?= ${${_v}}
  762. . endfor
  763. .endfor
  764. .for _s in ${MULTI_PACKAGES}
  765. . for _v in MESSAGE UNMESSAGE DESCR PLIST
  766. . if defined(${_v})
  767. ${_v}${_s} ?= ${${_v}}
  768. . endif
  769. . endfor
  770. .endfor
  771. _PACKAGE_LINKS =
  772. NO_ARCH ?= ${MACHINE_ARCH}/no-arch
  773. _PKG_REPO = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/
  774. _TMP_REPO = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/tmp/
  775. _CACHE_REPO = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cache/
  776. PKGFILE = ${_PKG_REPO}${_PKGFILE${SUBPACKAGE}}
  777. .for _S in ${MULTI_PACKAGES}
  778. _PKGFILE${_S} = ${FULLPKGNAME${_S}}.tgz
  779. . if ${PKG_ARCH${_S}} == "*" && ${NO_ARCH} != ${MACHINE_ARCH}/all
  780. _PACKAGE_COOKIE${_S} = ${PACKAGE_REPOSITORY}/${NO_ARCH}/${_PKGFILE${_S}}
  781. . else
  782. _PACKAGE_COOKIE${_S} = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${_PKGFILE${_S}}
  783. . endif
  784. _CACHE_PACKAGE_COOKIES += ${_CACHE_REPO}${_PKGFILE${_S}}
  785. .endfor
  786. .for _S in ${BUILD_PACKAGES}
  787. . if ${PKG_ARCH${_S}} == "*" && ${NO_ARCH} != ${MACHINE_ARCH}/all
  788. _PACKAGE_LINKS += ${MACHINE_ARCH}/all/${_PKGFILE${_S}} ${NO_ARCH}/${_PKGFILE${_S}}
  789. _PACKAGE_COOKIES${_S} += ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${_PKGFILE${_S}}
  790. . endif
  791. _PACKAGE_COOKIES${_S} += ${_PACKAGE_COOKIE${_S}}
  792. . if ${PERMIT_PACKAGE_FTP${_S}:L} == "yes"
  793. _PACKAGE_COOKIES${_S} += ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/ftp/${_PKGFILE${_S}}
  794. _PACKAGE_LINKS += ${MACHINE_ARCH}/ftp/${_PKGFILE${_S}} ${MACHINE_ARCH}/all/${_PKGFILE${_S}}
  795. . endif
  796. . if ${PERMIT_PACKAGE_CDROM${_S}:L} == "yes"
  797. _PACKAGE_COOKIES${_S} += ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cdrom/${_PKGFILE${_S}}
  798. _PACKAGE_LINKS += ${MACHINE_ARCH}/cdrom/${_PKGFILE${_S}} ${MACHINE_ARCH}/all/${_PKGFILE${_S}}
  799. . endif
  800. _PACKAGE_COOKIES += ${_PACKAGE_COOKIES${_S}}
  801. _PACKAGE_COOKIE += ${_PACKAGE_COOKIE${_S}}
  802. PKGFILE${_S} = ${_PKG_REPO}${_PKGFILE${_S}}
  803. .endfor
  804. .if empty(SUBPACKAGE) || ${SUBPACKAGE} == "-"
  805. FULLPKGPATH ?= ${PKGPATH}${FLAVOR_EXT:S/-/,/g}
  806. FULLPKGPATH- = ${FULLPKGPATH}
  807. _FULLPKGPATH = ${PKGPATH}${_FLAVOR_EXT2:S/-/,/g}
  808. _ALLPKGPATHS = ${FULLPKGPATH}
  809. .else
  810. _ALLPKGPATHS = ${PKGPATH}${FLAVOR_EXT:S/-/,/g}
  811. . for _S in ${MULTI_PACKAGES}
  812. FULLPKGPATH${_S} ?= ${PKGPATH},${_S}${FLAVOR_EXT:S/-/,/g}
  813. _ALLPKGPATHS += ${FULLPKGPATH${_S}}
  814. . endfor
  815. FULLPKGPATH = ${FULLPKGPATH${SUBPACKAGE}}
  816. _FULLPKGPATH = ${PKGPATH},${SUBPACKAGE}${_FLAVOR_EXT2:S/-/,/g}
  817. .endif
  818. FAKE_AS_ROOT ?= No
  819. .if ${FAKE_AS_ROOT:L} == "yes"
  820. _FAKESUDO_CHECK_COOKIE = ${WRKDIR}/.test-sudo
  821. _BINOWNGRP = -o ${BINOWN} -g ${BINGRP}
  822. _SHAREOWNGRP = -o ${SHAREOWN} -g ${SHAREGRP}
  823. _MANOWNGRP = -o ${MANOWN} -g ${MANGRP}
  824. .else
  825. _FAKESUDO =
  826. _FAKESUDO_CHECK_COOKIE =
  827. _BINOWNGRP =
  828. _SHAREOWNGRP =
  829. _MANOWNGRP =
  830. _INSTALL_WRAPPER = ${PORTSDIR}/infrastructure/bin/install-wrapper
  831. .endif
  832. .if ${FAKE_AS_ROOT:L:Malways-wrap}
  833. _INSTALL = ${_PERLSCRIPT}/install-wrapper
  834. .elif ${FAKE_AS_ROOT:L:Mno}
  835. _INSTALL ?= ${WRKDIR}/bin/install
  836. .else
  837. _INSTALL ?= /usr/bin/install
  838. .endif
  839. # A few aliases for *-install targets
  840. INSTALL_PROGRAM = \
  841. ${_INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} ${_BINOWNGRP} -m ${BINMODE}
  842. INSTALL_SCRIPT = \
  843. ${_INSTALL} ${INSTALL_COPY} ${_BINOWNGRP} -m ${BINMODE}
  844. INSTALL_DATA = \
  845. ${_INSTALL} ${INSTALL_COPY} ${_SHAREOWNGRP} -m ${SHAREMODE}
  846. INSTALL_MAN = \
  847. ${_INSTALL} ${INSTALL_COPY} ${_MANOWNGRP} -m ${MANMODE}
  848. INSTALL_PROGRAM_DIR = \
  849. ${_INSTALL} -d ${_BINOWNGRP} -m ${DIRMODE}
  850. INSTALL_SCRIPT_DIR = \
  851. ${INSTALL_PROGRAM_DIR}
  852. INSTALL_DATA_DIR = \
  853. ${_INSTALL} -d ${_SHAREOWNGRP} -m ${DIRMODE}
  854. INSTALL_MAN_DIR = \
  855. ${_INSTALL} -d ${_MANOWNGRP} -m ${DIRMODE}
  856. WRKOBJDIR_MODE ?=
  857. DISTDIR_MODE ?= ${WRKOBJDIR_MODE}
  858. PACKAGE_REPOSITORY_MODE ?= ${WRKOBJDIR_MODE}
  859. LOCKDIR_MODE ?= ${WRKOBJDIR_MODE}
  860. PLISTDIR_MODE ?= ${WRKOBJDIR_MODE}
  861. _INSTALL_MACROS = BSD_INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
  862. BSD_INSTALL_SCRIPT="${INSTALL_SCRIPT}" \
  863. BSD_INSTALL_DATA="${INSTALL_DATA}" \
  864. BSD_INSTALL_MAN="${INSTALL_MAN}" \
  865. BSD_INSTALL_PROGRAM_DIR="${INSTALL_PROGRAM_DIR}" \
  866. BSD_INSTALL_SCRIPT_DIR="${INSTALL_SCRIPT_DIR}" \
  867. BSD_INSTALL_DATA_DIR="${INSTALL_DATA_DIR}" \
  868. BSD_INSTALL_MAN_DIR="${INSTALL_MAN_DIR}"
  869. MAKE_ENV += ${_INSTALL_MACROS}
  870. # setup for libtool
  871. SHARED_LIBS ?=
  872. .for _n _v in ${SHARED_LIBS}
  873. LIB${_n}_VERSION = ${_v}
  874. SUBST_VARS += LIB${_n}_VERSION
  875. _lt_libs += LIB${_n}_LTVERSION='-version-info ${_v:S/./:/}:0'
  876. _lt_libs += lib${_n:S/+/_/g:S/-/_/g:S/./_/g}_ltversion=${_v}
  877. .endfor
  878. # Create the generic variable substitution list, from subst vars
  879. SUBST_VARS += MACHINE_ARCH ARCH HOMEPAGE ^PREFIX ^SYSCONFDIR FLAVOR_EXT \
  880. FULLPKGNAME MAINTAINER ^BASE_PKGPATH ^LOCALBASE ^X11BASE ^TRUEPREFIX \
  881. ^RCDIR ^LOCALSTATEDIR
  882. _tmpvars =
  883. _PKG_ADD_AUTO ?=
  884. .if !empty(_DEPENDENCY_STACK)
  885. _PKG_ADD_AUTO += -a
  886. .endif
  887. _TERM_ENV = PKG_TMPDIR=${PKG_TMPDIR}
  888. .for _v in TERM TERMCAP ftp_proxy http_proxy
  889. . if defined(${_v})
  890. _TERM_ENV += ${_v}=${${_v}:Q}
  891. . endif
  892. .endfor
  893. # See bsd.lib.mk:162
  894. .if ${MACHINE_ARCH:Mmips64*}
  895. _PKG_ARGS += -Dno_mips64=0
  896. .else
  897. _PKG_ARGS += -Dno_mips64=1
  898. .endif
  899. _PKG_ARGS += -DFLAVORS=${FLAVOR_EXT:Q}
  900. _tmpvars += FLAVORS=${FLAVOR_EXT:Q}
  901. _PKG_ARGS += -B ${WRKINST}
  902. .if ${LOCALBASE} != "/usr/local"
  903. _PKG_ARGS += -L${LOCALBASE}
  904. .endif
  905. .for _S in ${MULTI_PACKAGES}
  906. PKG_ARGS${_S} ?= ${PKG_ARGS}
  907. PKG_ARGS${_S} += ${_PKG_ARGS}
  908. . for _v in ${SUBST_VARS}
  909. . if defined(${_v:S/^^//}${_S})
  910. _substvars${_S} += -D${_v}=${${_v:S/^^//}${_S}:Q}
  911. _tmpvars += ${_v}${_S}=${${_v:S/^^//}${_S}:Q}
  912. . else
  913. _substvars${_S} += -D${_v}=${${_v:S/^^//}:Q}
  914. _tmpvars += ${_v}=${${_v:S/^^//}:Q}
  915. . endif
  916. . endfor
  917. PKG_ARGS${_S} += ${_substvars${_S}}
  918. PKG_ARGS${_S} += -DFULLPKGPATH=${FULLPKGPATH${_S}}
  919. PKG_ARGS${_S} += -DPERMIT_PACKAGE_CDROM=${PERMIT_PACKAGE_CDROM${_S}:Q}
  920. PKG_ARGS${_S} += -DPERMIT_PACKAGE_FTP=${PERMIT_PACKAGE_FTP${_S}:Q}
  921. . if !empty(REVISION${_S})
  922. PKG_ARGS${_S} += -DREVISION=${REVISION${_S}}
  923. . endif
  924. . if !empty(EPOCH${_S})
  925. PKG_ARGS${_S} += -DEPOCH=${EPOCH${_S}}
  926. . endif
  927. SUBST_CMD${_S} = ${_PERLSCRIPT}/pkg_subst ${_substvars${_S}}
  928. . if ${FAKE_AS_ROOT:L} == "no"
  929. SUBST_CMD${_S} += -i
  930. . endif
  931. SUBST_CMD${_S} += -B ${WRKDIR}
  932. .endfor
  933. SUBST_CMD = ${_PERLSCRIPT}/pkg_subst
  934. .for _v in ${SUBST_VARS}
  935. SUBST_CMD += -D${_v}=${${_v:S/^^//}:Q}
  936. .endfor
  937. .if ${FAKE_AS_ROOT:L} == "no"
  938. SUBST_CMD += -i
  939. .endif
  940. SUBST_CMD += -B ${WRKDIR}
  941. SUBST_PROGRAM = ${SUBST_CMD} -c ${_BINOWNGRP} -m ${BINMODE}
  942. SUBST_DATA = ${SUBST_CMD} -c ${_SHAREOWNGRP} -m ${SHAREMODE}
  943. SUBST_MAN = ${SUBST_CMD} -c ${_MANOWNGRP} -m ${MANMODE}
  944. # XXX
  945. .if ${MULTI_PACKAGES} == "-"
  946. PLIST ?= ${PKGDIR}/PLIST
  947. . if defined(COMMENT${FLAVOR_EXT})
  948. _COMMENT = ${COMMENT${FLAVOR_EXT}}
  949. . elif defined(COMMENT)
  950. _COMMENT = ${COMMENT}
  951. . endif
  952. . if exists(${PKGDIR}/MESSAGE)
  953. MESSAGE ?= ${PKGDIR}/MESSAGE
  954. . endif
  955. . if exists(${PKGDIR}/UNMESSAGE)
  956. UNMESSAGE ?= ${PKGDIR}/UNMESSAGE
  957. . endif
  958. DESCR ?= ${PKGDIR}/DESCR
  959. . for _v in PLIST _COMMENT MESSAGE UNMESSAGE DESCR
  960. . if defined(${_v})
  961. ${_v}- = ${${_v}}
  962. . endif
  963. . endfor
  964. .else
  965. . for _S in ${MULTI_PACKAGES}
  966. PLIST${_S} ?= ${PKGDIR}/PLIST${_S}
  967. . if defined(COMMENT${_S}${FLAVOR_EXT})
  968. _COMMENT${_S} = ${COMMENT${_S}${FLAVOR_EXT}}
  969. . elif defined(COMMENT${_S})
  970. _COMMENT${_S} = ${COMMENT${_S}}
  971. . endif
  972. . if exists(${PKGDIR}/MESSAGE${_S})
  973. MESSAGE${_S} ?= ${PKGDIR}/MESSAGE${_S}
  974. . endif
  975. . if exists(${PKGDIR}/UNMESSAGE${_S})
  976. UNMESSAGE${_S} ?= ${PKGDIR}/UNMESSAGE${_S}
  977. . endif
  978. DESCR${_S} ?= ${PKGDIR}/DESCR${_S}
  979. . endfor
  980. .endif
  981. MTREE_FILE ?=
  982. .if ${XENOCARA_COMPONENT:L} == "yes"
  983. MTREE_FILE += /etc/mtree/BSD.x11.dist
  984. .else
  985. MTREE_FILE += ${PORTSDIR}/infrastructure/db/fake.mtree
  986. .endif
  987. .for _S in ${MULTI_PACKAGES}
  988. # Fill out package command, and package dependencies
  989. PKG_ARGS${_S} += -DCOMMENT=${_COMMENT${_S}:Q} -d ${DESCR${_S}}
  990. PKG_ARGS${_S} += -f ${PLIST${_S}} -p ${PREFIX${_S}}
  991. . if defined(MESSAGE${_S}) && !empty(MESSAGE${_S})
  992. PKG_ARGS${_S} += -M ${MESSAGE${_S}}
  993. . endif
  994. . if defined(UNMESSAGE${_S}) && !empty(UNMESSAGE${_S})
  995. PKG_ARGS${_S} += -U ${UNMESSAGE${_S}}
  996. . endif
  997. PKG_ARGS${_S} += -A'${PKG_ARCH${_S}}'
  998. . if !defined(_COMMENT${_S})
  999. ERRORS += "Fatal: Missing comment for ${_S:S/^-$/main package/}."
  1000. . endif
  1001. .endfor
  1002. GZIP ?= -9
  1003. GZIP_CMD ?= /usr/bin/gzip -nf ${GZIP}
  1004. M4 ?= /usr/bin/m4
  1005. STRIP ?= /usr/bin/strip
  1006. # Autoconf scripts MAY tend to use bison by default otherwise
  1007. YACC ?= yacc
  1008. # XXX ${SETENV} is needed in front of var=value lists whenever the next
  1009. # command is expanded from a variable, as this could be a shell construct
  1010. SETENV ?= /usr/bin/env -i
  1011. # Used to print all the '===>' style prompts - override this to turn them off.
  1012. ECHO_MSG ?= echo
  1013. # basic master sites configuration
  1014. MASTER_SITE_OVERRIDE ?= No
  1015. .if exists(${PORTSDIR}/infrastructure/db/network.conf)
  1016. .include "${PORTSDIR}/infrastructure/db/network.conf"
  1017. .else
  1018. .include "${PORTSDIR}/infrastructure/templates/network.conf.template"
  1019. .endif
  1020. .if !empty(GH_ACCOUNT) && !empty(GH_PROJECT)
  1021. . if !empty(GH_COMMIT) && !empty(GH_TAGNAME)
  1022. ERRORS += "Fatal: specifying both GH_TAGNAME and GH_COMMIT is invalid"
  1023. . endif
  1024. . if ${GH_TAGNAME} == master
  1025. ERRORS += "Fatal: using master as GH_TAGNAME is invalid"
  1026. . endif
  1027. MASTER_SITES_GITHUB += \
  1028. https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/archive/${GH_TAGNAME:S/$/\//}
  1029. MASTER_SITES ?= ${MASTER_SITES_GITHUB}
  1030. HOMEPAGE ?= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}
  1031. .else
  1032. # Empty declarations to avoid "variable XXX is recursive" errors
  1033. MASTER_SITES ?=
  1034. .endif
  1035. # I guess we're in the master distribution business! :) As we gain mirror
  1036. # sites for distfiles, add them to this list.
  1037. .if ${MASTER_SITE_OVERRIDE:L} == "no"
  1038. MASTER_SITES := ${MASTER_SITES} ${MASTER_SITE_BACKUP}
  1039. .else
  1040. MASTER_SITES := ${MASTER_SITE_OVERRIDE} ${MASTER_SITES}
  1041. .endif
  1042. _warn_checksum = :
  1043. .if !empty(MASTER_SITES:M*[^/])
  1044. _warn_checksum += ;echo ">>> MASTER_SITES not ending in /: ${MASTER_SITES:M*[^/]}"
  1045. .endif
  1046. .for _I in 0 1 2 3 4 5 6 7 8 9
  1047. . if defined(MASTER_SITES${_I})
  1048. . if !empty(MASTER_SITES${_I}:M*[^/])
  1049. _warn_checksum += ;echo ">>> MASTER_SITES${_I} not ending in /: ${MASTER_SITES${_I}:M*[^/]}"
  1050. . endif
  1051. . if ${MASTER_SITE_OVERRIDE:L} == "no"
  1052. MASTER_SITES${_I} := ${MASTER_SITES${_I}} ${MASTER_SITE_BACKUP}
  1053. . else
  1054. MASTER_SITES${_I} := ${MASTER_SITE_OVERRIDE} ${MASTER_SITES${_I}}
  1055. . endif
  1056. . endif
  1057. .endfor
  1058. EXTRACT_SUFX ?= .tar.gz
  1059. .if !empty(GH_COMMIT)
  1060. DISTFILES ?= ${DISTNAME}-${GH_COMMIT:C/(........).*/\1/}${EXTRACT_SUFX}{${GH_COMMIT}${EXTRACT_SUFX}}
  1061. .else
  1062. . if defined(DISTNAME)
  1063. DISTFILES ?= ${DISTNAME}${EXTRACT_SUFX}
  1064. . endif
  1065. .endif
  1066. PATCHFILES ?=
  1067. SUPDISTFILES ?=
  1068. # the following loop "parses" DISTFILES-style files
  1069. # _PATH_x contains filenames with SUBDIR prepended when necessary
  1070. # _LIST_x contains pure filenames
  1071. #
  1072. # _FULL_FETCH_LIST is used for creating all targets later on:
  1073. # say if DISTFILES=filename{url}sufx:0 DIST_SUBDIR=foo/
  1074. # it will expand to foo/filenamesufx filename MASTER_SITES0 urlsufx
  1075. #
  1076. # _FILES is used to de-duplicates names
  1077. # the order matters: DISTFILES PATCHFILES SUPDISTFILES
  1078. # - we never have the same names in DISTFILES and PATCHFILES
  1079. # - SUPDISTFILES has to happen later
  1080. _FILES=
  1081. .for v in DISTFILES PATCHFILES SUPDISTFILES
  1082. . if !empty($v)
  1083. . for e in ${$v}
  1084. . for f m u in ${e:C/:[0-9]$//:C/(.*)\{.*\}(.*)/\1\2/} MASTER_SITES${e:M*\:[0-9]:C/.*:([0-9])/\1/} ${e:C/:[0-9]$//:C/.*\{(.*)\}(.*)/\1\2/}
  1085. . if empty(_FILES:M$f)
  1086. _FILES += $f
  1087. . if empty(DIST_SUBDIR)
  1088. _FULL_FETCH_LIST += $f $f $m $u
  1089. _PATH_$v += $f
  1090. . else
  1091. _FULL_FETCH_LIST += ${DIST_SUBDIR}/$f $f $m $u
  1092. _PATH_$v += ${DIST_SUBDIR}/$f
  1093. . endif
  1094. _LIST_$v += $f
  1095. . endif
  1096. . endfor
  1097. . endfor
  1098. . else
  1099. _PATH_$v =
  1100. _LIST_$v =
  1101. . endif
  1102. .endfor
  1103. _FULL_FETCHLIST ?=
  1104. CHECKSUMFILES = ${_PATH_DISTFILES} ${_PATH_PATCHFILES}
  1105. MAKESUMFILES = ${CHECKSUMFILES} ${_PATH_SUPDISTFILES}
  1106. # This is what is actually going to be extracted, and is overridable
  1107. # by the user.
  1108. EXTRACT_ONLY ?= ${_LIST_DISTFILES}
  1109. PATCH_CASES ?=
  1110. EXTRACT_CASES ?=
  1111. _LIST_EXTRACTED = ${EXTRACT_ONLY} ${_LIST_PATCHFILES}
  1112. # okay, time for some guess work
  1113. # this is mostly ad-hoc, we may want to add more PATCH_CASES eventually.
  1114. .if !empty(_LIST_EXTRACTED:M*.zip)
  1115. BUILD_DEPENDS += archivers/unzip
  1116. EXTRACT_CASES += *.zip) \
  1117. ${UNZIP} -oq ${FULLDISTDIR}/$$archive -d ${WRKDIR};;
  1118. .endif
  1119. .if !empty(_LIST_EXTRACTED:M*.xz) || \
  1120. !empty(_LIST_EXTRACTED:M*.lzma)
  1121. BUILD_DEPENDS += archivers/xz
  1122. EXTRACT_CASES += *.tar.xz) \
  1123. xzdec <${FULLDISTDIR}/$$archive | ${TAR} xf -;;
  1124. EXTRACT_CASES += *.tar.lzma) \
  1125. lzmadec <${FULLDISTDIR}/$$archive | ${TAR} xf -;;
  1126. .endif
  1127. .if !empty(_LIST_EXTRACTED:M*.tar.lz)
  1128. BUILD_DEPENDS += archivers/lzip/lunzip
  1129. EXTRACT_CASES += *.tar.lz) \
  1130. lunzip <${FULLDISTDIR}/$$archive | ${TAR} xf -;;
  1131. PATCH_CASES += *.lz) \
  1132. lunzip <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
  1133. .endif
  1134. .if !empty(_LIST_EXTRACTED:M*.bz2) || \
  1135. !empty(_LIST_EXTRACTED:M*.tbz2) || \
  1136. !empty(_LIST_EXTRACTED:M*.tbz)
  1137. BUILD_DEPENDS += archivers/bzip2
  1138. EXTRACT_CASES += *.tar.bz2|*.tbz2|*.tbz) \
  1139. ${BZIP2} -d <${FULLDISTDIR}/$$archive | ${TAR} xf -;;
  1140. PATCH_CASES += *.bz2) \
  1141. ${BZIP2} -d <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
  1142. .endif
  1143. _PERL_FIX_SHAR ?= perl -ne 'print if $$s || ($$s = m:^\#(\!\s*/bin/sh\s*| This is a shell archive):)'
  1144. EXTRACT_CASES += *.tar) \
  1145. ${TAR} xf ${FULLDISTDIR}/$$archive;;
  1146. EXTRACT_CASES += *.shar.gz|*.shar.Z|*.sh.gz|*.sh.Z) \
  1147. ${GZIP_CMD} -d <${FULLDISTDIR}/$$archive | ${_PERL_FIX_SHAR} | /bin/sh;;
  1148. EXTRACT_CASES += *.shar | *.sh) \
  1149. ${_PERL_FIX_SHAR} ${FULLDISTDIR}/$$archive | /bin/sh;;
  1150. EXTRACT_CASES += *.tar.gz|*.tgz) \
  1151. ${GZIP_CMD} -d <${FULLDISTDIR}/$$archive | ${TAR} xf -;;
  1152. EXTRACT_CASES += *.gz) \
  1153. ${GZIP_CMD} -d <${FULLDISTDIR}/$$archive >$$(basename $$archive .gz);;
  1154. EXTRACT_CASES += *) \
  1155. ${GZIP_CMD} -d <${FULLDISTDIR}/$$archive | ${TAR} xf -;;
  1156. PATCH_CASES += *.Z|*.gz) \
  1157. ${GZIP_CMD} -d <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
  1158. PATCH_CASES += *) \
  1159. ${PATCH} ${PATCH_DIST_ARGS} < $$patchfile;;
  1160. # Documentation
  1161. MAINTAINER ?= The OpenBSD ports mailing-list <ports@openbsd.org>
  1162. .if empty(MAINTAINER)
  1163. ERRORS += "Fatal: defining MAINTAINER to empty is an error"
  1164. .endif
  1165. .if !defined(CATEGORIES)
  1166. ERRORS += "Fatal: CATEGORIES is mandatory."
  1167. .else
  1168. _badcat = Yes
  1169. . for _i in ${CATEGORIES}
  1170. . if ${_badcat} == "Yes"
  1171. . if ${PKGPATH:M${_i}/*}
  1172. _badcat = No
  1173. . endif
  1174. . endif
  1175. . endfor
  1176. . if ${_badcat} == "Yes"
  1177. ERRORS += "Fatal: one category in ${CATEGORIES} should match PKGPATH=${PKGPATH}"
  1178. . if ${PKGPATH:N*/*}
  1179. ERRORS += "Fatal: bogus PKGPATH=${PKGPATH} (no subdirectory)"
  1180. . endif
  1181. . endif
  1182. .endif
  1183. CONFIGURE_SCRIPT ?= configure
  1184. .if ${CONFIGURE_SCRIPT:M/*}
  1185. _CONFIGURE_SCRIPT = ${CONFIGURE_SCRIPT}
  1186. .else
  1187. . if ${SEPARATE_BUILD:L} != "no"
  1188. _CONFIGURE_SCRIPT = ${WRKSRC}/${CONFIGURE_SCRIPT}
  1189. . else
  1190. _CONFIGURE_SCRIPT = ./${CONFIGURE_SCRIPT}
  1191. . endif
  1192. .endif
  1193. CONFIGURE_ENV += PATH=${PORTPATH}
  1194. FETCH_MANUALLY ?= No
  1195. MISSING_FILES =
  1196. .if ${FETCH_MANUALLY:L} != "no"
  1197. . for _F in ${CHECKSUMFILES}
  1198. . if !exists(${DISTDIR}/${_F})
  1199. MISSING_FILES += ${_F}
  1200. . endif
  1201. . endfor
  1202. .endif
  1203. ################################################################
  1204. # Many ways to disable a port.
  1205. #
  1206. # A lot of them actually occur earlier on, in bsd.port.arch.mk
  1207. #
  1208. # If we're in BATCH mode and the port is interactive, or we're
  1209. # in interactive mode and the port is non-interactive, skip all
  1210. # the important targets. The reason we have two modes is that
  1211. # one might want to leave a build in BATCH mode running
  1212. # overnight, then come back in the morning and do _only_ the
  1213. # interactive ones that required your intervention.
  1214. #
  1215. # Ignore ports that can't be resold if building for a CDROM.
  1216. #
  1217. # Don't build a port if it's broken.
  1218. #
  1219. # Don't build a port if it comes with the base system.
  1220. ################################################################
  1221. TRY_BROKEN ?= No
  1222. _IGNORE_TEST ?=
  1223. .if ${TEST_IS_INTERACTIVE:L} != "no" && defined(BATCH)
  1224. _IGNORE_TEST += "has interactive tests"
  1225. .elif ${TEST_IS_INTERACTIVE:L} == "no" && defined(INTERACTIVE)
  1226. _IGNORE_TEST += "does not have interactive tests"
  1227. .endif
  1228. .if ${IS_INTERACTIVE:L} != "no" && defined(BATCH)
  1229. IGNORE += "is an interactive port"
  1230. .elif !(${IS_INTERACTIVE:L} != "no" || !empty(MISSING_FILES)) && defined(INTERACTIVE)
  1231. IGNORE += "is not an interactive port"
  1232. .endif
  1233. .if !empty(MISSING_FILES) && defined(BATCH)
  1234. _EXTRA_IGNORE += "is an interactive port: missing files"
  1235. .endif
  1236. .if ${TRY_BROKEN:L} != "yes"
  1237. . if defined(BROKEN-${ARCH})
  1238. IGNORE += "is marked as broken for ${ARCH}: ${BROKEN-${ARCH}:Q}"
  1239. . endif
  1240. . if ${MACHINE_ARCH} != ${ARCH} && defined(BROKEN-${MACHINE_ARCH})
  1241. IGNORE += "is marked as broken for ${MACHINE_ARCH}: ${BROKEN-${MACHINE_ARCH}:Q}"
  1242. . endif
  1243. . if defined(BROKEN)
  1244. IGNORE += "is marked as broken: ${BROKEN:Q}"
  1245. . endif
  1246. .endif
  1247. .if defined(COMES_WITH)
  1248. IGNORE += "-- ${FULLPKGNAME${SUBPACKAGE}:C/-[0-9].*//g} comes with OpenBSD as of release ${COMES_WITH}"
  1249. .endif
  1250. IGNORE_IS_FATAL ?= "No"
  1251. # XXX even if subpackage is invalid, define this, so that errors come out
  1252. # from ERRORS and not make internals.
  1253. IGNORE${SUBPACKAGE} ?=
  1254. .if (!empty(IGNORE${SUBPACKAGE}) || defined(_EXTRA_IGNORE)) && ${IGNORE_IS_FATAL:L} == "yes"
  1255. ERRORS += "Fatal: can't build"
  1256. ERRORS += ${IGNORE${SUBPACKAGE}} ${_EXTRA_IGNORE}
  1257. .endif
  1258. _DEPENDS_TARGET ?= install
  1259. ################################################################
  1260. # Dependency checking
  1261. ################################################################
  1262. # Various dependency styles
  1263. _resolve_lib = LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} \
  1264. ${_PERLSCRIPT}/resolve-lib
  1265. PKG_CREATE_NO_CHECKS ?= No
  1266. .if ${PKG_CREATE_NO_CHECKS:L} == "yes"
  1267. _pkg_wantlib_args = fake-wantlib-args
  1268. .elif ${PKG_CREATE_NO_CHECKS:L} == "warn"
  1269. _pkg_wantlib_args = wantlib-args
  1270. _check_msg = Warning
  1271. # ignore diff error
  1272. _check_error = || true
  1273. .else
  1274. _pkg_wantlib_args = wantlib-args
  1275. _check_msg = Error
  1276. # let diff error out
  1277. _check_error =
  1278. .endif
  1279. wantlib_args ?= port-wantlib-args
  1280. lib_depends_args ?= lib-depends-args
  1281. .if ${FORCE_UPDATE:L} == "yes" || ${FORCE_UPDATE:L} == "hard"
  1282. _force_update_fragment = { \
  1283. ${ECHO_MSG} "===> Verifying update for $$pkg in $$dir"; \
  1284. if ( eval $$toset exec ${MAKE} subupdate ); then \
  1285. ${ECHO_MSG} "===> Returning to build of ${FULLPKGNAME${SUBPACKAGE}}${_MASTER}"; \
  1286. else \
  1287. ${REPORT_PROBLEM}; \
  1288. exit 1; \
  1289. fi; \
  1290. }
  1291. _PKG_ADD_FORCE = -D update -D updatedepends
  1292. . if ${FORCE_UPDATE:L} == "hard"
  1293. _PKG_ADD_FORCE += -D installed
  1294. . endif
  1295. .else
  1296. _force_update_fragment = :
  1297. _PKG_ADD_FORCE =
  1298. .endif
  1299. _FULL_PACKAGE_NAME ?= No
  1300. # We check for dependency syntax errors before rewriting things.
  1301. _CHECK_DEPENDS =
  1302. .for _v in BUILD LIB RUN TEST
  1303. _CHECK_DEPENDS +:= ${${_v}_DEPENDS}
  1304. .endfor
  1305. .for _s in ${MULTI_PACKAGES}
  1306. . for _v in RUN LIB
  1307. _CHECK_DEPENDS +:= ${${_v}_DEPENDS${_s}}
  1308. . endfor
  1309. .endfor
  1310. .if ${_CHECK_DEPENDS:M\:*}
  1311. ERRORS += "Fatal: old style depends ${_CHECK_DEPENDS:M\:*}"
  1312. .endif
  1313. # the C,...., part basically does this:
  1314. # if the depends contains only pkgpath>=something
  1315. # then we rebuild it as STEM->=something:pkgpath
  1316. .for _v in BUILD LIB RUN TEST
  1317. ${_v}_DEPENDS := ${${_v}_DEPENDS:C,^([^:]+/[^:<=>]+)([<=>][^:]+)$,STEM-\2:\1,}
  1318. .endfor
  1319. .for _v in BUILD TEST
  1320. ${_v}_DEPENDS := ${${_v}_DEPENDS:C,^([^:]+/[^:<=>]+)([<=>][^:]+)(:patch|:configure|:build)$,STEM-\2:\1\3,}
  1321. .endfor
  1322. .for _s in ${MULTI_PACKAGES}
  1323. . for _v in RUN LIB
  1324. ${_v}_DEPENDS${_s} := ${${_v}_DEPENDS${_s}:C,^([^:]+/[^:<=>]+)([<=>][^:]+)$,STEM-\2:\1,}
  1325. . endfor
  1326. .endfor
  1327. _BUILDLIB_DEPENDS =
  1328. _BUILDWANTLIB =
  1329. # strip inter-multi-packages dependencies during building
  1330. .for _path in ${PKGPATH:S,^mystuff/,,}
  1331. . for _s in ${BUILD_PACKAGES}
  1332. _BUILDLIB_DEPENDS += ${LIB_DEPENDS${_s}:N*\:${_path}:N*\:${_path},*:N${_path}:N${_path},*}
  1333. _BUILDWANTLIB += ${WANTLIB${_s}}
  1334. _LIB4${_s} = ${LIB_DEPENDS${_s}:M*\:${_path}} ${LIB_DEPENDS${_s}:M*\:${_path},*} ${LIB_DEPENDS${_s}:M${_path}} ${LIB_DEPENDS${_s}:M${_path},*}
  1335. _LIB4 += ${_LIB4${_s}}
  1336. . endfor
  1337. .endfor
  1338. # automatically try to determine USE_X11 from wantlib
  1339. USE_X11 ?= No
  1340. .for _lib in X11 GL ICE xcb pixman freetype Xft
  1341. . if ${USE_X11:L} != "yes"
  1342. . for _b in ${_BUILDWANTLIB:C/[>=].*//}
  1343. . if "${_b:M${_lib}}"
  1344. USE_X11 = Yes
  1345. . endif
  1346. . endfor
  1347. . endif
  1348. .endfor
  1349. .if ${USE_X11:L} == "yes" && ${PORTS_BUILD_XENOCARA_TOO:L} == "yes"
  1350. BUILD_DEPENDS += base/xenocara/meta
  1351. .endif
  1352. .if ${NO_DEPENDS:L} == "no"
  1353. _BUILD_DEPLIST = ${BUILD_DEPENDS}
  1354. _RUN_DEPLIST = ${RUN_DEPENDS${SUBPACKAGE}}
  1355. _TEST_DEPLIST = ${TEST_DEPENDS}
  1356. _BUILDLIB_DEPLIST = ${_BUILDLIB_DEPENDS}
  1357. _RUNLIB_DEPLIST = ${LIB_DEPENDS${SUBPACKAGE}}
  1358. .endif
  1359. _DEPLIST = ${_BUILD_DEPLIST} ${_RUN_DEPLIST} ${_TEST_DEPLIST} \
  1360. ${_BUILDLIB_DEPLIST} ${_RUNLIB_DEPLIST}
  1361. # compute DEPBUILD_COOKIES and friends
  1362. .for _DEP in BUILD RUN BUILDLIB RUNLIB TEST
  1363. . for _i in ${_${_DEP}_DEPLIST}
  1364. _DEP${_DEP}_COOKIES += ${WRKDIR}/.dep-${_i:C,>=,ge-,g:C,<=,le-,g:C,<,lt-,g:C,>,gt-,g:C,\*,ANY,g:C,[|:/=],-,g}
  1365. . endfor
  1366. _DEP${_DEP}_COOKIES ?=
  1367. .endfor
  1368. # Normal user-mode targets are PHONY targets, e.g., don't create the
  1369. # corresponding file. However, there is nothing phony about the cookie.
  1370. MODSIMPLE_configure = \
  1371. cd ${WRKCONF} && ${SETENV} \
  1372. CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS:C/ *$//}" \
  1373. CXX="${CXX}" ac_cv_path_CXX="${CXX}" CXXFLAGS="${CXXFLAGS:C/ *$//}" \
  1374. INSTALL="${_INSTALL} -c ${_BINOWNGRP}" \
  1375. ac_given_INSTALL="${_INSTALL} -c ${_BINOWNGRP}" \
  1376. INSTALL_PROGRAM="${INSTALL_PROGRAM}" INSTALL_MAN="${INSTALL_MAN}" \
  1377. INSTALL_SCRIPT="${INSTALL_SCRIPT}" INSTALL_DATA="${INSTALL_DATA}" \
  1378. YACC="${YACC}" \
  1379. ${CONFIGURE_ENV} ${_CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
  1380. FAKE_SETUP = PATH='${PORTPATH}' TRUEPREFIX=${PREFIX} \
  1381. PREFIX=${WRKINST}${PREFIX} ${DESTDIRNAME}=${WRKINST}
  1382. _CLEANDEPENDS ?= Yes
  1383. # Internal variables, used by dependencies targets
  1384. # Only keep pkg:dir spec, strip extra target
  1385. .for _mod in C/:(patch|configure|build)$$//
  1386. _BUILD_DEP2 = ${BUILD_DEPENDS:${_mod}}
  1387. _BUILD_DEP3 = ${BUILD_DEPENDS:${_mod}}
  1388. _RUN_DEP2 = ${RUN_DEPENDS${SUBPACKAGE}:${_mod}}
  1389. _RUN_DEP3 = ${RUN_DEPENDS${SUBPACKAGE}:${_mod}}
  1390. _TEST_DEP2 = ${TEST_DEPENDS:${_mod}}
  1391. _TEST_DEP3 = ${_TEST_DEP2}
  1392. _RUN_DEP2 += ${LIB_DEPENDS${SUBPACKAGE}:${_mod}}
  1393. _LIB_DEP3 = ${LIB_DEPENDS${SUBPACKAGE}}
  1394. _BUILD_DEP2 += ${_BUILDLIB_DEPENDS:${_mod}}
  1395. . for _S in ${MULTI_PACKAGES}
  1396. _BUILD_DEP3${_S} = ${_BUILD_DEP3}
  1397. _RUN_DEP3${_S} = ${RUN_DEPENDS${_S}:${_mod}}
  1398. _LIB_DEP3${_S} = ${LIB_DEPENDS${_S}}
  1399. . endfor
  1400. .endfor
  1401. _DEPBUILDLIBS = ${_BUILDWANTLIB}
  1402. _DEPRUNLIBS = ${WANTLIB${SUBPACKAGE}}
  1403. # the _DEP*LIBSPECS_COOKIES are only there to force reevaluation of
  1404. # _DEPBUILDWANTLIB_COOKIE and _DEPRUNWANTLIB_COOKIE when the dependencies
  1405. # change (the list will change, and so the cookie will be regenerated)
  1406. .if ${NO_DEPENDS:L} == "no"
  1407. . for i in ${_DEPBUILDLIBS:C,>=,-ge-,g:C,=,-gt-,g:C,/,-,g}
  1408. _DEPBUILDLIBSPECS_COOKIES += ${WRKDIR}/.spec-$i
  1409. . endfor
  1410. _DEPBUILDWANTLIB_COOKIE = ${WRKDIR}/.buildwantlibs
  1411. . for i in ${_DEPRUNLIBS:C,>=,-ge-,g:C,=,-gt-,g:C,/,-,g}
  1412. _DEPRUNLIBSPECS_COOKIES += ${WRKDIR}/.spec-$i
  1413. . endfor
  1414. _DEPRUNWANTLIB_COOKIE = ${WRKDIR}/.runwantlibs${SUBPACKAGE}
  1415. .else
  1416. _DEPBUILDWANTLIB_COOKIE =
  1417. _DEPRUNWANTLIB_COOKIE =
  1418. .endif
  1419. _DEPLIBSPECS_COOKIES = ${_DEPBUILDLIBSPECS_COOKIES} ${_DEPRUNLIBSPECS_COOKIES}
  1420. # strip optional pkgspec, only keep the path
  1421. _BUILD_DEP = ${_BUILD_DEP2:C,^[^:/]*:,,}
  1422. _RUN_DEP = ${_RUN_DEP2:C,^[^:/]*:,,}
  1423. _TEST_DEP = ${_TEST_DEP2:C,^[^:/]*:,,}
  1424. REORDER_DEPENDENCIES ?=
  1425. ECHO_REORDER ?= :
  1426. # recheck WRK...
  1427. .for w in WRKDIR WRKDIST WRKSRC WRKCONF WRKBUILD WRKINST DIST_SUBDIR
  1428. . if ${$w:M*/}
  1429. ERRORS += "Fatal: $w ends with a slash"
  1430. . endif
  1431. .endfor
  1432. # Lock infrastructure:
  1433. # to remove locks handling, define LOCKDIR to an empty value
  1434. LOCKDIR ?= ${WRKOBJDIR}/locks
  1435. LOCK_CMD ?= ${_PERLSCRIPT}/dolock
  1436. UNLOCK_CMD ?= rm -f
  1437. _LOCKS_HELD ?=
  1438. LOCK_VERBOSE ?= No
  1439. .if !empty(LOCKDIR)
  1440. . if ${LOCK_VERBOSE:L} == "yes"
  1441. _LOCK = echo "Locking $$lock (${BUILD_PKGPATH}) from $@"; ${LOCK_CMD} ${LOCKDIR_MODE} ${LOCKDIR}/$$lock.lock ${BUILD_PKGPATH}
  1442. _UNLOCK = echo "Unlocking $$lock from $@"; ${UNLOCK_CMD} ${LOCKDIR}/$$lock.lock
  1443. . else
  1444. _LOCK = ${LOCK_CMD} ${LOCKDIR_MODE} ${LOCKDIR}/$$lock.lock ${BUILD_PKGPATH}
  1445. _UNLOCK = ${UNLOCK_CMD} ${LOCKDIR}/$$lock.lock
  1446. . endif
  1447. . if ${SEPARATE_BUILD:L:Mflavored}
  1448. _LOCKNAME = ${FULLPKGNAME}
  1449. . else
  1450. _LOCKNAME = ${PKGNAME}
  1451. . endif
  1452. . for _i in ${_LOCKNAME}
  1453. . if empty(_LOCKS_HELD:M${_i})
  1454. _DO_LOCK = \
  1455. lock=${_LOCKNAME}; \
  1456. _LOCKS_HELD="${_LOCKS_HELD} ${_LOCKNAME}"; export _LOCKS_HELD; \
  1457. ${_SIMPLE_LOCK}
  1458. . endif
  1459. . endfor
  1460. _SIMPLE_LOCK = \
  1461. ${_LOCK}; locked=true; \
  1462. trap 'if $$locked; then ${_UNLOCK}; locked=false; fi' 0; \
  1463. trap 'exit 1' 1 2 3 13 15
  1464. .endif
  1465. _SIMPLE_LOCK ?= :
  1466. _DO_LOCK ?= :
  1467. CHECKSUM_PACKAGES ?= No
  1468. _PACKAGE_CHECKSUM_DIR = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cksums
  1469. _do_checksum_package = \
  1470. install -d ${PACKAGE_REPOSITORY_MODE} ${_PACKAGE_CHECKSUM_DIR} && \
  1471. cd ${_TMP_REPO} && \
  1472. cksum -b -a sha256 $$pkgname \
  1473. >${_PACKAGE_CHECKSUM_DIR}/$$(basename $$pkgname .tgz).sha256
  1474. .if ${CHECKSUM_PACKAGES:L} == "yes"
  1475. _checksum_package = ${_do_checksum_package}
  1476. .elif ${CHECKSUM_PACKAGES:L} == "ftp"
  1477. _checksum_package = \
  1478. case $${permit_ftp} in yes) \
  1479. ${_do_checksum_package};; \
  1480. esac
  1481. .elif ${CHECKSUM_PACKAGES:L} == "cdrom"
  1482. _checksum_package = \
  1483. case $${permit_cdrom} in yes) \
  1484. ${_do_checksum_package};; \
  1485. esac
  1486. .else
  1487. _checksum_package = :
  1488. .endif
  1489. _size_fragment = perl -e '$$s = (stat $$ARGV[0])[7]; print "SIZE ($$ARGV[1]) = $$s\n";'
  1490. # commands used all the time
  1491. _lines2list = tr '\012' '\040' | sed -e 's, $$,,'
  1492. _zap_last_line = sed -e '$$d'
  1493. _sort_dependencies = tsort -r|${_zap_last_line}
  1494. _version2stem = sed -e 's,-[0-9].*,,'
  1495. _grab_libs_from_plist = sed -n -e '/^@lib /{ s///; p; }' \
  1496. -e '/^@file .*\/lib\/lib.*\.a$$/{ s/^@file //; p; }'
  1497. # used in the following pattern
  1498. # while $(_read_spec); do $(_parse_spec); done
  1499. _read_spec = IFS=: read pkg subdir target
  1500. _parse_spec = \
  1501. d="$$pkg$${subdir:+:}$$subdir$${target:+:}$$target"; \
  1502. extra_msg="(DEPENDS was $$d) in ${FULLPKGPATH}"; \
  1503. case "X$$pkg" in \
  1504. */*) target="$$subdir"; subdir="$$pkg"; pkg=;; \
  1505. esac; ${_flavor_fragment}
  1506. _compute_default = \
  1507. set -f; \
  1508. if set -- $$(eval $$toset exec ${MAKE} _print-metadata); then \
  1509. default=$$1; pkgspec=$$2; pkgpath=$$3; \
  1510. else \
  1511. echo 1>&2 "Problem with dependency $$d"; \
  1512. exit 1; \
  1513. fi; \
  1514. set +f
  1515. _complete_pkgspec = \
  1516. ${_compute_default}; \
  1517. case "X$$pkg" in \
  1518. X) \
  1519. pkg=$$pkgspec;; \
  1520. XSTEM*) \
  1521. stem=$$(echo $$default|${_version2stem}); \
  1522. pkg="$$stem$${pkg\#STEM}";; \
  1523. esac
  1524. _emit_lib_depends = for i in ${LIB_DEPENDS${SUBPACKAGE}:QL}; do echo "$$i"; done
  1525. _emit_run_depends = for i in ${RUN_DEPENDS${SUBPACKAGE}:QL}; do echo "$$i"; done
  1526. # computing libraries from the ports tree is expensive, so cache as many of
  1527. # these as we can
  1528. # XXX assumes it's running under _cache_fragment, either directly, or from
  1529. # a target up there
  1530. # XXX if we can't move the tmpfile, we remove it, because we've been pre-empted
  1531. # by someone with more rights who created the correct file for us
  1532. _libs2cache = \
  1533. cached_libs=$${_DEPENDS_CACHE}/$$(echo $$subdir|sed -e 's/\//--/g'); \
  1534. if ! test -f $$cached_libs; then \
  1535. t=$$(mktemp $${_DEPENDS_CACHE}/tmp.XXXXXXXXXX||exit 1); \
  1536. if eval $$toset ${MAKE} print-plist-libs >$$t; \
  1537. then \
  1538. chmod 0644 $$t; \
  1539. mv $$t $$cached_libs || rm $$t; \
  1540. else \
  1541. echo 1>&2 "Problem with dependency $$subdir"; \
  1542. exit 1; \
  1543. fi; \
  1544. fi
  1545. # is this subdir actually needed as a libs depend ?
  1546. _if_check_needed = \
  1547. ${_parse_spec}; \
  1548. ${_libs2cache}; \
  1549. if ${_resolve_lib} -needed ${_DEPRUNLIBS:QL} <$$cached_libs
  1550. # turn a list of found libraries into parameters for pkg_create,
  1551. # zap .a in the meantime
  1552. _show_found = \
  1553. for k in $$found; do \
  1554. case $$k in *.a) ;; \
  1555. *) echo "-W $$k";; \
  1556. esac; \
  1557. done
  1558. # fairly good approximation of libraries we want
  1559. # XXX this is ksh, be less perfect with pure sh
  1560. _lib=/lib*.{so.+([0-9]).+([0-9]),a}
  1561. _list_system_libs = \
  1562. for i in /usr/lib${_lib} ${X11BASE}/lib${_lib}; do echo $$i; done
  1563. _list_port_libs = \
  1564. { ${MAKE} show-run-depends|while read subdir; do \
  1565. ${_flavor_fragment}; \
  1566. ${_libs2cache}; \
  1567. cat $$cached_libs; \
  1568. done; ${_list_system_libs}; }
  1569. .if empty(PLIST_DB)
  1570. _register_plist =:
  1571. .else
  1572. _register_plist = install -d ${PLISTDIR_MODE} ${PLIST_DB:S/:/ /g} && ${_PERLSCRIPT}/register-plist ${PLIST_DB}
  1573. .endif
  1574. .if ${CHECK_LIB_DEPENDS:L} == "yes"
  1575. _check_lib_depends = ${_CHECK_LIB_DEPENDS}
  1576. .else
  1577. _check_lib_depends =:
  1578. .endif
  1579. _CHECK_LIB_DEPENDS = PORTSDIR=${PORTSDIR} ${_PERLSCRIPT}/check-lib-depends
  1580. _CHECK_LIB_DEPENDS += -d ${_PKG_REPO} -B ${WRKINST}
  1581. .for _s in ${MULTI_PACKAGES}
  1582. . if ${STATIC_PLIST${_s}:L} == "no"
  1583. _register_plist${_s} = :
  1584. . else
  1585. _register_plist${_s} = ${_register_plist}
  1586. . endif
  1587. .endfor
  1588. ###
  1589. ### end of variable setup. Only targets now
  1590. ###
  1591. dump-vars:
  1592. .if ${MULTI_PACKAGES} == "-"
  1593. . for _v in ${_ALL_VARIABLES} ${_ALL_VARIABLES_INDEXED}
  1594. . if defined(${_v}-)
  1595. . if !empty(${_v}-)
  1596. @echo ${FULLPKGPATH}.${_v}=${${_v}-:Q}
  1597. . endif
  1598. . elif defined(${_v}) && !empty(${_v})
  1599. @echo ${FULLPKGPATH}.${_v}=${${_v}:Q}
  1600. . endif
  1601. . endfor
  1602. . for _v in ${_ALL_VARIABLES_PER_ARCH}
  1603. . for _a in ${ALL_ARCHS}
  1604. . if defined(${_v}-${_a}) && !empty(${_v}-${_a})
  1605. @echo ${FULLPKGPATH}.${_v}-${_a}=${${_v}-${_a}:Q}
  1606. . endif
  1607. . endfor
  1608. . endfor
  1609. .else
  1610. . for _S in ${MULTI_PACKAGES}
  1611. . for _v in ${_ALL_VARIABLES}
  1612. . if defined(${_v}) && !empty(${_v})
  1613. @echo ${FULLPKGPATH${_S}}.${_v}=${${_v}:Q}
  1614. . endif
  1615. . endfor
  1616. . for _v in ${_ALL_VARIABLES_PER_ARCH}
  1617. . for _a in ${ALL_ARCHS}
  1618. . if defined(${_v}-${_a}) && !empty(${_v}-${_a})
  1619. @echo ${FULLPKGPATH${_S}}.${_v}-${_a}=${${_v}-${_a}:Q}
  1620. . endif
  1621. . endfor
  1622. . endfor
  1623. . for _v in ${_ALL_VARIABLES_INDEXED}
  1624. . if defined(${_v}${_S}) && !empty(${_v}${_S})
  1625. @echo ${FULLPKGPATH${_S}}.${_v}=${${_v}${_S}:Q}
  1626. . endif
  1627. . endfor
  1628. . endfor
  1629. .endif
  1630. check-register:
  1631. .if empty(PLIST_DB)
  1632. @exit 1
  1633. .else
  1634. @if cd ${.CURDIR} && PKGPATH=${PKGPATH} ${MAKE} print-plist-with-depends | ${_PERLSCRIPT}/register-plist -p ${PLIST_DB}; then \
  1635. echo "${FULLPKGNAME${SUBPACKAGE}} okay"; \
  1636. else \
  1637. echo "${FULLPKGNAME${SUBPACKAGE}} BAD"; \
  1638. fi
  1639. .endif
  1640. check-register-all:
  1641. .for _S in ${MULTI_PACKAGES}
  1642. @cd ${.CURDIR} && SUBPACKAGE=${_S} PKGPATH=${PKGPATH} ${MAKE} check-register
  1643. .endfor
  1644. .for _S in ${MULTI_PACKAGES}
  1645. ${_CACHE_REPO}${_PKGFILE${_S}}:
  1646. @install -d ${PACKAGE_REPOSITORY_MODE} ${@D}
  1647. @${ECHO_MSG} -n "===> Looking for ${_PKGFILE${_S}} in \$$PKG_PATH - "
  1648. @if ${SETENV} ${_TERM_ENV} PKG_CACHE=${_CACHE_REPO} PKG_PATH=${_CACHE_REPO}:${_PKG_REPO}:${PACKAGE_REPOSITORY}/${NO_ARCH}/:${_PKG_PATH} ${_PKG_ADD} -n -q ${_PKG_ADD_FORCE} -r -D installed -D downgrade ${_PKGFILE${_S}} >/dev/null 2>&1; then \
  1649. ${ECHO_MSG} "found"; \
  1650. exit 0; \
  1651. else \
  1652. ${ECHO_MSG} "not found"; \
  1653. exit 1; \
  1654. fi
  1655. # The real package
  1656. ${_PACKAGE_COOKIE${_S}}:
  1657. @install -d ${PACKAGE_REPOSITORY_MODE} ${@D} ${_TMP_REPO}
  1658. . if ${FETCH_PACKAGES:L} == "yes" && !defined(_TRIED_FETCHING_${_PACKAGE_COOKIE${_S}})
  1659. @f=${_CACHE_REPO}${_PKGFILE${_S}}; \
  1660. cd ${.CURDIR} && ${MAKE} $$f && \
  1661. { ln $$f $@ 2>/dev/null || cp -p $$f $@ ; } || \
  1662. cd ${.CURDIR} && ${MAKE} _TRIED_FETCHING_${_PACKAGE_COOKIE${_S}}=Yes _internal-package-only
  1663. . else
  1664. @${_MAKE} ${_PACKAGE_COOKIE_DEPS}
  1665. # What PACKAGE normally does:
  1666. @${ECHO_MSG} "===> Building package for ${FULLPKGNAME${_S}}"
  1667. @${ECHO_MSG} "Create ${_PACKAGE_COOKIE${_S}}"
  1668. @cd ${.CURDIR} && \
  1669. tmp=${_TMP_REPO}${_PKGFILE${_S}} pkgname=${_PKGFILE${_S}} permit_ftp=${PERMIT_PACKAGE_FTP${_S}:L:Q} permit_cdrom=${PERMIT_PACKAGE_CDROM${_S}:L:Q} && \
  1670. if deps=$$(SUBPACKAGE=${_S} wantlib_args=${_pkg_wantlib_args} \
  1671. ${MAKE} print-package-args) && \
  1672. ${_FAKESUDO} ${_PKG_CREATE} -DPORTSDIR="${PORTSDIR}" \
  1673. $$deps ${PKG_ARGS${_S}} $$tmp && \
  1674. ${_check_lib_depends} $$tmp && \
  1675. ${_register_plist${_S}} $$tmp && \
  1676. ${_checksum_package} && \
  1677. mv $$tmp ${_PACKAGE_COOKIE${_S}} && \
  1678. mode=$$(id -u):$$(id -g) && \
  1679. ${_FAKESUDO} chown $${mode} ${_PACKAGE_COOKIE${_S}}; then \
  1680. exit 0; \
  1681. else \
  1682. ${_FAKESUDO} rm -f $$tmp; \
  1683. exit 1; \
  1684. fi
  1685. # End of PACKAGE.
  1686. @-rm -f ${_BULK_COOKIE} ${_UPDATE_COOKIE${_S}} ${_FUPDATE_COOKIE${_S}}
  1687. . endif
  1688. # The real install
  1689. ${_INSTALL_COOKIE${_S}}:
  1690. . if ${FETCH_PACKAGES:L} == "yes"
  1691. @cd ${.CURDIR} && SUBPACKAGE=${_S} PKGPATH=${PKGPATH} exec ${MAKE} subpackage
  1692. . else
  1693. @${_MAKE} package
  1694. . endif
  1695. @cd ${.CURDIR} && SUBPACKAGE=${_S} _DEPENDS_TARGET=install PKGPATH=${PKGPATH} \
  1696. exec ${MAKE} _internal-install-depends
  1697. @${ECHO_MSG} "===> Installing ${FULLPKGNAME${_S}} from ${_PKG_REPO}"
  1698. @if ${PKG_INFO} -e ${FULLPKGNAME${_S}}; then \
  1699. echo "Package ${FULLPKGNAME${_S}} is already installed"; \
  1700. else \
  1701. ${SUDO} ${SETENV} ${_TERM_ENV} ${_PKG_ADD_LOCAL} ${_PKG_ADD_AUTO} ${PKGFILE${_S}}; \
  1702. fi
  1703. @-${SUDO} ${_MAKE_COOKIE} $@
  1704. ${_UPDATE_COOKIE${_S}}:
  1705. @${_MAKE} _internal-package
  1706. . if empty(UPDATE_COOKIES_DIR)
  1707. @${_MAKE} ${WRKDIR}
  1708. . else
  1709. @mkdir -p ${UPDATE_COOKIES_DIR}
  1710. . endif
  1711. @${ECHO_MSG} "===> Updating for ${FULLPKGNAME${_S}}"
  1712. @b=$$(cd ${.CURDIR} && SUBPACKAGE=${_S} ${MAKE} print-plist|sed -ne '/^@pkgpath /s,,-e ,p'); \
  1713. a=$$(${PKG_INFO} -e ${FULLPKGPATH${_S}} $$b 2>/dev/null |sort -u); \
  1714. case $$a in \
  1715. '') ${ECHO_MSG} "Not installed, no update";; \
  1716. *) cd ${.CURDIR} && SUBPACKAGE=${_S} _DEPENDS_TARGET=package PKGPATH=${PKGPATH} \
  1717. ${MAKE} _internal-install-depends; \
  1718. ${ECHO_MSG} "Upgrading from $$a"; \
  1719. ${SUDO} ${SETENV} ${_TERM_ENV} ${_PKG_ADD_LOCAL} ${_PKG_ADD_AUTO} -r ${_PKG_ADD_FORCE} ${PKGFILE${_S}};; \
  1720. esac
  1721. @${_MAKE_COOKIE} $@
  1722. ${_FUPDATE_COOKIE${_S}}:
  1723. @${_MAKE} _internal-package
  1724. @cd ${.CURDIR} && SUBPACKAGE=${_S} _DEPENDS_TARGET=package PKGPATH=${PKGPATH} \
  1725. exec ${MAKE} _internal-install-depends
  1726. . if empty(UPDATE_COOKIES_DIR)
  1727. @${_MAKE} ${WRKDIR}
  1728. . else
  1729. @mkdir -p ${UPDATE_COOKIES_DIR}
  1730. . endif
  1731. @${ECHO_MSG} "===> Updating/installing for ${FULLPKGNAME${_S}}"
  1732. @${SUDO} ${SETENV} ${_TERM_ENV} ${_PKG_ADD_LOCAL} ${_PKG_ADD_AUTO} -r ${_PKG_ADD_FORCE} ${PKGFILE${_S}}
  1733. @${_MAKE_COOKIE} $@
  1734. .endfor
  1735. .PRECIOUS: ${_PACKAGE_COOKIES} ${_INSTALL_COOKIES}
  1736. makesum:
  1737. @${_warn_checksum}
  1738. @mv -f ${CHECKSUM_FILE}{,.orig} 2>/dev/null || true
  1739. @${MAKE} fetch-all _MAKESUM=true
  1740. .if !empty(MAKESUMFILES)
  1741. @cd ${DISTDIR} && cksum -b -a "${_CIPHER}" ${MAKESUMFILES} >> ${CHECKSUM_FILE}
  1742. @cd ${DISTDIR} && \
  1743. for file in ${MAKESUMFILES}; do \
  1744. ${_size_fragment} $$file $$file >> ${CHECKSUM_FILE}; \
  1745. done
  1746. @sort -u -o ${CHECKSUM_FILE} ${CHECKSUM_FILE}
  1747. @diff -Lold -Lnew -u ${CHECKSUM_FILE}{.orig,} 2>/dev/null|| true
  1748. @rm -f ${CHECKSUM_FILE}.orig
  1749. .endif
  1750. ################################################################
  1751. # Dependency checking
  1752. ################################################################
  1753. _internal-prepare: ${_DEPBUILD_COOKIES} ${_DEPBUILDLIB_COOKIES} \
  1754. ${_DEPBUILDWANTLIB_COOKIE}
  1755. _internal-install-depends: ${_DEPRUN_COOKIES} ${_DEPRUNLIB_COOKIES} \
  1756. ${_DEPRUNWANTLIB_COOKIE}
  1757. _internal-test-depends: ${_DEPTEST_COOKIES}
  1758. # and the rules for the actual dependencies
  1759. _print-metadata:
  1760. @echo '${FULLPKGNAME${SUBPACKAGE}}' '${PKGSPEC${SUBPACKAGE}}' '${FULLPKGPATH${SUBPACKAGE}}'
  1761. _print-packagename:
  1762. .if ${_FULL_PACKAGE_NAME:L} == "yes"
  1763. @echo '${PKGPATH}/${FULLPKGNAME${SUBPACKAGE}}'
  1764. .else
  1765. @echo ${FULLPKGNAME${SUBPACKAGE}}
  1766. .endif
  1767. .for _i in ${_DEPLIST}
  1768. . if !target(${WRKDIR}/.dep-${_i:C,>=,ge-,g:C,<=,le-,g:C,<,lt-,g:C,>,gt-,g:C,\*,ANY,g:C,[|:/=],-,g})
  1769. ${WRKDIR}/.dep-${_i:C,>=,ge-,g:C,<=,le-,g:C,<,lt-,g:C,>,gt-,g:C,\*,ANY,g:C,[|:/=],-,g}: ${_WRKDIR_COOKIE}
  1770. @unset _DEPENDS_TARGET _MASTER WRKDIR|| true; \
  1771. echo '${_i}'| while ${_read_spec}; do \
  1772. ${_parse_spec}; \
  1773. _ignore_cookie=${@:S/.dep/.ignored/}; \
  1774. toset="$$toset _IGNORE_COOKIE=$${_ignore_cookie}"; \
  1775. case "X$$target" in X) target=${_DEPENDS_TARGET};; esac; \
  1776. case "X$$target" in \
  1777. Xinstall|Xreinstall) wantsub=false; check_installed=true; try_install=true;; \
  1778. Xpackage|Xfake) wantsub=false; check_installed=true; try_install=false;; \
  1779. Xpatch|Xconfigure|Xbuild) \
  1780. wantsub=true; check_installed=false; try_install=false; \
  1781. install -d ${WRKOBJDIR_MODE} `dirname ${WRKDIR}`; \
  1782. mkdir -p ${WRKDIR}/$$dir; \
  1783. toset="$$toset _MASTER='[${FULLPKGNAME${SUBPACKAGE}}]${_MASTER}' WRKDIR=${WRKDIR}/$$dir";; \
  1784. *) \
  1785. ${ECHO_MSG} "===> Error: can't depend on $$target"; \
  1786. ${REPORT_PROBLEM}; \
  1787. exit 1;; \
  1788. esac; \
  1789. ${_complete_pkgspec}; \
  1790. toset="$$toset _DEPENDENCY_STACK='${_DEPENDENCY_STACK} ${PKGPATH}'"; \
  1791. h="===> ${FULLPKGNAME${SUBPACKAGE}}${_MASTER} depends on: $$pkg -"; \
  1792. for second_pass in false true; do \
  1793. if $$check_installed; then \
  1794. case ${PREPARE_CHECK_ONLY:L} in \
  1795. yes) \
  1796. second_pass=true;; \
  1797. esac; \
  1798. $$try_install && ${_force_update_fragment}; \
  1799. if $$(${PKG_INFO} -e "$$pkg" -r "$$pkg" $$default >$@t); then \
  1800. sed -ne '/^inst:/s///p' <$@t| \
  1801. { read v || v=found; \
  1802. echo "$$v" >$@; \
  1803. ${ECHO_MSG} "$$h> $$v"; } ;\
  1804. rm $@t; \
  1805. break; \
  1806. else \
  1807. r=$$?; \
  1808. rm $@t; \
  1809. case $$r in \
  1810. 1|3) \
  1811. ${ECHO_MSG} "$$h not found";; \
  1812. esac; \
  1813. case $$r in \
  1814. 2|3) \
  1815. ${ECHO_MSG} "$$h default $$default does not match"; \
  1816. ${REPORT_PROBLEM}; \
  1817. exit 1;; \
  1818. esac; \
  1819. fi; \
  1820. else \
  1821. if ! ${PKG_INFO} -q -r "$$pkg" $$default; \
  1822. then \
  1823. ${ECHO_MSG} "$$h default $$default does not match"; \
  1824. ${REPORT_PROBLEM}; \
  1825. exit 1; \
  1826. fi; \
  1827. fi; \
  1828. if $$second_pass; then \
  1829. ${ECHO_MSG} "Dependency check failed"; \
  1830. ${REPORT_PROBLEM}; \
  1831. exit 1; \
  1832. fi; \
  1833. ${ECHO_MSG} "===> Verifying $$target for $$pkg in $$dir"; \
  1834. if (eval $$toset exec ${MAKE} $$target) && \
  1835. ! test -e $${_ignore_cookie}; then \
  1836. if $$wantsub; then \
  1837. eval $$toset ${MAKE} show-prepare-results >$@; \
  1838. fi; \
  1839. ${ECHO_MSG} "===> Returning to build of ${FULLPKGNAME${SUBPACKAGE}}${_MASTER}"; \
  1840. else \
  1841. ${REPORT_PROBLEM}; \
  1842. exit 1; \
  1843. fi; \
  1844. $$try_install || break; \
  1845. done; \
  1846. done
  1847. @install -d ${WRKOBJDIR_MODE} `dirname ${WRKDIR}`
  1848. @mkdir -p ${WRKDIR} ${WRKDIR}/bin
  1849. @${_MAKE_COOKIE} $@
  1850. . endif
  1851. .endfor
  1852. show-prepare-results: prepare
  1853. @sort -u ${_DEPBUILD_COOKIES} ${_DEPBUILDLIB_COOKIES} /dev/null
  1854. show-prepare-test-results: prepare test-depends
  1855. @sort -u ${_DEPBUILD_COOKIES} ${_DEPBUILDLIB_COOKIES} ${_DEPTEST_COOKIES} /dev/null
  1856. # very quick rule, create this to force reevaluation of next rule when
  1857. # the dependencies in the Makefile are changed
  1858. . if !empty(_DEPLIBSPECS_COOKIES)
  1859. ${_DEPLIBSPECS_COOKIES}: ${_WRKDIR_COOKIE}
  1860. @${_MAKE_COOKIE} $@
  1861. .endif
  1862. # similar rules for _DEPBUILDWANTLIB_COOKIE and _DEPRUNWANTLIB_COOKIE
  1863. .for _m in BUILD RUN
  1864. . if !empty(_DEP${_m}WANTLIB_COOKIE)
  1865. ${_DEP${_m}WANTLIB_COOKIE}: ${_DEP${_m}LIBSPECS_COOKIES} \
  1866. ${_DEP${_m}LIB_COOKIES} ${_DEPBUILD_COOKIES} ${_WRKDIR_COOKIE}
  1867. . if !empty(_DEP${_m}LIBS)
  1868. @${ECHO_MSG} "===> Verifying specs: ${_DEP${_m}LIBS}"
  1869. @${_cache_fragment}; if found=`{ \
  1870. for i in ${_LIB4:QL}; do echo "$$i"; done | \
  1871. while ${_read_spec}; do \
  1872. ${_parse_spec}; \
  1873. ${_libs2cache}; \
  1874. cat $$cached_libs; \
  1875. done; \
  1876. for i in ${LOCALBASE}/lib${_lib}; do echo $$i; done; \
  1877. ${_list_system_libs}; \
  1878. for d in ${_DEP${_m}LIBS:QL}; do \
  1879. case "$$d" in \
  1880. /*) echo $${d%/*}${_lib};; \
  1881. */*) echo ${LOCALBASE}/$${d%/*}${_lib};; \
  1882. esac; \
  1883. done; } | ${_resolve_lib} ${_DEP${_m}LIBS:QL}`; \
  1884. then \
  1885. line="===> found"; \
  1886. for k in $$found; do line="$$line $$k"; done; \
  1887. ${ECHO_MSG} "$$line"; \
  1888. else \
  1889. echo 1>&2 "Fatal error"; \
  1890. exit 1; \
  1891. fi
  1892. . endif
  1893. @${_MAKE_COOKIE} $@
  1894. . endif
  1895. .endfor
  1896. _internal-fetch-all:
  1897. # See ports/infrastructure/templates/Makefile.template
  1898. @${ECHO_MSG} "===> Checking files for ${FULLPKGNAME}${_MASTER}"
  1899. # What FETCH-ALL normally does:
  1900. . if !empty(MAKESUMFILES)
  1901. @${_MAKE} ${MAKESUMFILES:S@^@${DISTDIR}/@}
  1902. . endif
  1903. # End of FETCH
  1904. .if (!empty(IGNORE${SUBPACKAGE}) || defined(_EXTRA_IGNORE)) && !defined(NO_IGNORE)
  1905. _internal-all _internal-build _internal-checksum _internal-configure \
  1906. _internal-deinstall _internal-extract _internal-fake _internal-fetch \
  1907. _internal-install _internal-install-all _internal-manpages-check \
  1908. _internal-package _internal-patch _internal-plist _internal-test \
  1909. _internal-subpackage _internal-subupdate _internal-uninstall \
  1910. _internal-update _internal-update-or-install \
  1911. _internal-update-or-install-all _internal-update-plist \
  1912. lib-depends-check port-lib-depends-check update-patches:
  1913. . if !defined(IGNORE_SILENT)
  1914. @${ECHO_MSG} "===> ${FULLPKGNAME${SUBPACKAGE}}${_MASTER} ${IGNORE${SUBPACKAGE}} ${_EXTRA_IGNORE}."
  1915. . endif
  1916. . if defined(_IGNORE_COOKIE)
  1917. @echo "${IGNORE${SUBPACKAGE}} ${_EXTRA_IGNORE}" >${_IGNORE_COOKIE}
  1918. . endif
  1919. .else
  1920. lib-depends-check:
  1921. @${_cache_fragment}; cd ${.CURDIR} && ${MAKE} package; \
  1922. ${_CHECK_LIB_DEPENDS} ${_PACKAGE_COOKIE}
  1923. ${WRKINST}/.saved_libs: ${_FAKE_COOKIE} ${_FAKESUDO_CHECK_COOKIE}
  1924. @${_FAKESUDO} ${_CHECK_LIB_DEPENDS} -O $@t && ${_FAKESUDO} mv $@t $@
  1925. port-lib-depends-check: ${WRKINST}/.saved_libs
  1926. @-${_cache_fragment}; for s in ${BUILD_PACKAGES}; do \
  1927. SUBPACKAGE=$$s ${MAKE} print-plist-with-depends \
  1928. lib_depends_args=all-lib-depends-args \
  1929. wantlib_args=fake-wantlib-args| \
  1930. ${_CHECK_LIB_DEPENDS} -i -s ${WRKINST}/.saved_libs; \
  1931. done
  1932. _internal-manpages-check: ${_FAKE_COOKIE} ${_FAKESUDO_CHECK_COOKIE}
  1933. @cd ${WRKINST}${TRUEPREFIX}/man && \
  1934. ${_FAKESUDO} /usr/libexec/makewhatis -p . && \
  1935. cat mandoc.db
  1936. # Most standard port targets create a cookie to avoid being re-run.
  1937. #
  1938. # fetch is an exception, as it uses the files it fetches as `cookies',
  1939. # and it's run by checksum, so in essence it's a sub-goal of extract,
  1940. # in normal use.
  1941. #
  1942. # Besides, fetch can't create cookies, as it does not have WRKDIR available
  1943. # in the first place.
  1944. #
  1945. _internal-fetch:
  1946. # See ports/infrastructure/templates/Makefile.template
  1947. @${ECHO_MSG} "===> Checking files for ${FULLPKGNAME}${_MASTER}"
  1948. # What FETCH normally does:
  1949. . if !empty(CHECKSUMFILES)
  1950. @${_MAKE} ${CHECKSUMFILES:S@^@${DISTDIR}/@}
  1951. . endif
  1952. # End of FETCH
  1953. _internal-checksum: _internal-fetch
  1954. @${_warn_checksum}
  1955. @fgrep 2>/dev/null SIZE ${CHECKSUM_FILE} | \
  1956. sed -e '/SIZE (\(.*\)).*/s//\1/'|\
  1957. while read i; do \
  1958. for j in ${MAKESUMFILES}; do \
  1959. missing=true; \
  1960. if test $$i = $$j; then \
  1961. missing=false; \
  1962. break; \
  1963. fi; \
  1964. done; \
  1965. if $$missing; then \
  1966. bad=true; \
  1967. echo 1>&2 "!!! Extra file '$$i' in ${CHECKSUM_FILE}"; \
  1968. echo 1>&2 "!!! Read up on SUPDISTFILES in bsd.port.mk(5)"; \
  1969. exit 1; \
  1970. fi; \
  1971. done
  1972. . if empty(CHECKSUMFILES)
  1973. @${ECHO_MSG} ">> No DISTFILES nor PATCHFILES."
  1974. . else
  1975. . if !defined(NO_CHECKSUM)
  1976. @if [ ! -f ${CHECKSUM_FILE} ]; then \
  1977. ${ECHO_MSG} 1>&2 ">> No ${CHECKSUM_FILE}."; \
  1978. exit 1; \
  1979. fi
  1980. @cd ${DISTDIR}; OK=true; list=''; \
  1981. for file in ${CHECKSUMFILES}; do \
  1982. if set -- $$(grep "^${_CIPHER:U} ($$file)" ${CHECKSUM_FILE}); \
  1983. then \
  1984. echo -n '>> '; \
  1985. if ! echo "$$@" | cksum -c; then \
  1986. list="$$list $$file ${_CIPHER} $$4"; \
  1987. OK=false; \
  1988. fi; \
  1989. else \
  1990. ${ECHO_MSG} ">> No ${_CIPHER} recorded for $$file."; \
  1991. OK=false; \
  1992. fi; \
  1993. done; \
  1994. set --; \
  1995. if ! $$OK; then \
  1996. if ${REFETCH}; then \
  1997. cd ${.CURDIR} && PKGPATH=${PKGPATH} ${MAKE} _refetch _PROBLEMS="$$list"; \
  1998. else \
  1999. echo "Make sure the Makefile and ${CHECKSUM_FILE}"; \
  2000. echo "are up to date. If you want to fetch a good copy of this file"; \
  2001. echo "from the OpenBSD main archive, type"; \
  2002. echo "\tmake REFETCH=true [other args]"; \
  2003. exit 1; \
  2004. fi; \
  2005. fi
  2006. . endif
  2007. . endif
  2008. _refetch:
  2009. . for file cipher value in ${_PROBLEMS}
  2010. @rm ${DISTDIR}/${file}
  2011. @${_MAKE} ${DISTDIR}/${file} \
  2012. MASTER_SITE_OVERRIDE="${MASTER_SITE_OPENBSD:=by_cipher/${cipher}/${value:C/(..).*/\1/}/${value}/} ${MASTER_SITE_OPENBSD:=${cipher}/${value}/}"
  2013. . endfor
  2014. ${_MAKE} _internal-checksum REFETCH=false
  2015. # The cookie's recipe hold the real rule for each of those targets.
  2016. _internal-extract: ${_EXTRACT_COOKIE}
  2017. _internal-patch: ${_DEPBUILD_COOKIES} ${_DEPBUILDLIB_COOKIES} \
  2018. ${_DEPBUILDWANTLIB_COOKIE} ${_PATCH_COOKIE}
  2019. _internal-distpatch: ${_DEPBUILD_COOKIES} ${_DEPBUILDLIB_COOKIES} \
  2020. ${_DEPBUILDWANTLIB_COOKIE} ${_DISTPATCH_COOKIE}
  2021. _internal-configure: ${_DEPBUILD_COOKIES} ${_DEPBUILDLIB_COOKIES} \
  2022. ${_DEPBUILDWANTLIB_COOKIE} ${_CONFIGURE_COOKIE}
  2023. _internal-build _internal-all: ${_DEPBUILD_COOKIES} ${_DEPBUILDLIB_COOKIES} \
  2024. ${_DEPBUILDWANTLIB_COOKIE} ${_BUILD_COOKIE}
  2025. _internal-install: ${_INSTALL_COOKIE${SUBPACKAGE}}
  2026. _internal-install-all: ${_INSTALL_COOKIES}
  2027. _internal-fake: ${_FAKE_COOKIE}
  2028. _internal-subupdate: ${_UPDATE_COOKIE${SUBPACKAGE}}
  2029. _internal-update: ${_UPDATE_COOKIES}
  2030. _internal-update-or-install: ${_FUPDATE_COOKIE${SUBPACKAGE}}
  2031. _internal-update-or-install-all: ${_FUPDATE_COOKIES}
  2032. regress: test
  2033. . if !empty(_IGNORE_TEST)
  2034. _internal-test:
  2035. . if !defined(IGNORE_SILENT)
  2036. @${ECHO_MSG} "===> ${FULLPKGNAME${SUBPACKAGE}}${_MASTER} ${_IGNORE_TEST}."
  2037. . endif
  2038. . else
  2039. _internal-test: ${_BUILD_COOKIE} ${_DEPTEST_COOKIES} ${_TEST_COOKIE}
  2040. . endif
  2041. # packing list utilities. This generates a packing list from a recently
  2042. # installed port. Not perfect, but pretty close. The generated file
  2043. # will have to have some tweaks done by hand.
  2044. # Note: add @comment PACKAGE(arch=${MACHINE_ARCH}, opsys=OpenBSD, vers=${OSREV})
  2045. # when port is installed or package created.
  2046. #
  2047. _extra_info =
  2048. . for _s in ${MULTI_PACKAGES}
  2049. _extra_info += PLIST${_s}='${PLIST${_s}}'
  2050. _extra_info += DEPPATHS${_s}="$$(${SETENV} FLAVOR=${FLAVOR:Q} SUBPACKAGE=${_s} PKGPATH=${PKGPATH} ${MAKE} show-run-depends)"
  2051. . endfor
  2052. _internal-plist _internal-update-plist: _internal-fake ${_FAKESUDO_CHECK_COOKIE}
  2053. @${ECHO_MSG} "===> Updating plist for ${FULLPKGNAME}${_MASTER}"
  2054. @mkdir -p ${PKGDIR}
  2055. @DESTDIR=${WRKINST} \
  2056. PREFIX=${TRUEPREFIX} \
  2057. INSTALL_PRE_COOKIE=${_INSTALL_PRE_COOKIE} \
  2058. MAKE="${MAKE}" \
  2059. PORTSDIR=${PORTSDIR} \
  2060. PORTSDIR_PATH=${PORTSDIR_PATH} \
  2061. FLAVORS='${FLAVORS}' MULTI_PACKAGES='${BUILD_PACKAGES}' \
  2062. OKAY_FILES='${_FAKE_COOKIE} ${_INSTALL_PRE_COOKIE} ${WRKINST}/.saved_libs' \
  2063. OWNER=$$(id -u) \
  2064. GROUP=$$(id -g) \
  2065. ${_FAKESUDO} ${_PERLSCRIPT}/make-plist \
  2066. ${_extra_info} ${_tmpvars}
  2067. update-patches:
  2068. @toedit=`WRKDIST=${WRKDIST} PATCHDIR=${PATCHDIR} \
  2069. PATCH_LIST='${PATCH_LIST}' DIFF_ARGS='${DIFF_ARGS}' \
  2070. DISTORIG=${DISTORIG} PATCHORIG=${PATCHORIG} \
  2071. ${_PERLSCRIPT}/update-patches`; \
  2072. case $$toedit in "");; \
  2073. *) read i?'edit patches: '; \
  2074. cd ${PATCHDIR} && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} $$toedit;; esac
  2075. .endif # IGNORECMD
  2076. # Top-level targets redirect to the real _internal-target, along with locking
  2077. # if locking exists.
  2078. .for _t in extract patch distpatch configure build all install fake \
  2079. subupdate fetch fetch-all checksum test prepare install-depends \
  2080. test-depends clean manpages-check plist update-plist \
  2081. update update-or-install update-or-install-all package install-all
  2082. . if defined(_LOCK)
  2083. ${_t}:
  2084. @${_DO_LOCK}; cd ${.CURDIR} && PKGPATH=${PKGPATH} ${MAKE} _internal-${_t}
  2085. . else
  2086. ${_t}: _internal-${_t}
  2087. . endif
  2088. .endfor
  2089. lock:
  2090. @lock=${_LOCKNAME}; ${_LOCK}
  2091. export _LOCKS_HELD="${_LOCKS_HELD} ${_LOCKNAME}"
  2092. unlock:
  2093. @lock=${_LOCKNAME}; ${_UNLOCK}
  2094. .for _i in ${_LOCKNAME}
  2095. export _LOCKS_HELD="${_LOCKS_HELD:N${_i}}"
  2096. .endfor
  2097. subpackage:
  2098. # XXX both _DO_LOCK and _cache_fragment use trap, so subshell
  2099. @${_DO_LOCK}; (${_cache_fragment}; cd ${.CURDIR} && ${MAKE} _internal-subpackage)
  2100. _internal-package:
  2101. @${_cache_fragment}; cd ${.CURDIR} && ${MAKE} _internal-package-only
  2102. # XXX loop needed for M to work
  2103. .for p in ${PKGPATH}
  2104. . if ${BULK_$p:L} == "yes"
  2105. @${_MAKE} ${_BULK_COOKIE}
  2106. . elif ${BULK_$p:L} == "auto"
  2107. . if !empty(_DEPENDENCY_STACK)
  2108. . if !${_DEPENDENCY_STACK:M$p}
  2109. @${_MAKE} ${_BULK_COOKIE}
  2110. . endif
  2111. . endif
  2112. . endif
  2113. .endfor
  2114. ${_BULK_COOKIE}:
  2115. @${_cache_fragment}; cd ${.CURDIR} && ${MAKE} _internal-package-only
  2116. @mkdir -p ${BULK_COOKIES_DIR}
  2117. .for _i in ${BULK_TARGETS_${PKGPATH}}
  2118. @${ECHO_MSG} "===> Running ${_i}"
  2119. @${_MAKE} ${_i} ${BULK_FLAGS}
  2120. .endfor
  2121. .if !empty(BULK_DO_${PKGPATH})
  2122. @${BULK_DO_${PKGPATH}}
  2123. .endif
  2124. @${_SUDOMAKE} _internal-clean
  2125. @${_MAKE_COOKIE} $@
  2126. # The real targets. Note that some parts always get run, some parts can be
  2127. # disabled, and there are hooks to override behavior.
  2128. ${WRKDIR}/.test-sudo:
  2129. @if [ x`SUDO_PORT_V1=ah ${SUDO} /bin/sh -c 'eval echo $${SUDO_PORT_V1}'` \
  2130. != xah ]; then \
  2131. echo >&2 "Error: sudo does not let env variables through"; \
  2132. exit 1; \
  2133. fi
  2134. @${_MAKE_COOKIE} $@
  2135. ${_WRKDIR_COOKIE}:
  2136. @rm -rf ${WRKDIR}
  2137. .if ${PORTS_BUILD_XENOCARA_TOO:L} != "yes"
  2138. @appdefaults=${LOCALBASE}/lib/X11/app-defaults; \
  2139. if ! test -d $$appdefaults -a -h $$appdefaults; then \
  2140. echo 1>&2 "Fatal: $$appdefaults should exist and be a symlink"; \
  2141. exit 1; \
  2142. fi
  2143. .endif
  2144. @install -d ${WRKOBJDIR_MODE} `dirname ${WRKDIR}`
  2145. @mkdir -p ${WRKDIR} ${WRKDIR}/bin
  2146. .if ${FAKE_AS_ROOT:L} != "yes"
  2147. @install -m ${BINMODE} ${_INSTALL_WRAPPER} ${WRKDIR}/bin/install
  2148. .endif
  2149. .if !empty(WRKDIR_LINKNAME)
  2150. @ln -sf ${WRKDIR} ${.CURDIR}/${WRKDIR_LINKNAME}
  2151. .endif
  2152. # poison some common gettext-tools binaries
  2153. .if !defined(BUILD_DEPENDS) || !${BUILD_DEPENDS:Mdevel/gettext-tools} && \
  2154. !${BUILD_DEPENDS:M*textproc/intltool}
  2155. @printf '#!/bin/sh\n\
  2156. echo "*** $$0 was called without gettext-tools dependency ***" >&2\n\
  2157. exit 1\n' > ${WRKDIR}/bin/msgfmt
  2158. @chmod 555 ${WRKDIR}/bin/msgfmt
  2159. . for name in msgcat msginit
  2160. @ln -sf msgfmt ${WRKDIR}/bin/${name}
  2161. . endfor
  2162. .endif
  2163. @${_MAKE_COOKIE} $@
  2164. ${_EXTRACT_COOKIE}: ${_WRKDIR_COOKIE}
  2165. @${_MAKE} _internal-checksum _internal-prepare
  2166. @${ECHO_MSG} "===> Extracting for ${FULLPKGNAME}${_MASTER}"
  2167. .if target(pre-extract)
  2168. @${_MAKESYS} pre-extract
  2169. .endif
  2170. @${_MAKESYS} do-extract
  2171. .if target(post-extract)
  2172. @${_MAKESYS} post-extract
  2173. .endif
  2174. .for _m in ${MODULES:T:U}
  2175. . if defined(MOD${_m}_post-extract)
  2176. @${MOD${_m}_post-extract}
  2177. . endif
  2178. .endfor
  2179. @${_MAKE_COOKIE} $@
  2180. .if !target(do-extract)
  2181. do-extract:
  2182. # What EXTRACT normally does:
  2183. @PATH=${PORTPATH}; set -e; cd ${WRKDIR}; \
  2184. for archive in ${EXTRACT_ONLY}; do \
  2185. case $$archive in \
  2186. ${EXTRACT_CASES} \
  2187. esac; \
  2188. done
  2189. # End of EXTRACT
  2190. .endif
  2191. # Both distpatch and patch invoke pre-patch, if it's defined.
  2192. # Hence it needs special treatment (a specific cookie).
  2193. .if target(pre-patch)
  2194. ${_PREPATCH_COOKIE}:
  2195. @${_MAKESYS} pre-patch
  2196. . if ${PATCH_CHECK_ONLY:L} != "yes"
  2197. @${_MAKE_COOKIE} $@
  2198. . endif
  2199. .endif
  2200. # The real distpatch
  2201. ${_DISTPATCH_COOKIE}: ${_EXTRACT_COOKIE}
  2202. .if target(pre-patch)
  2203. @${_MAKE} ${_PREPATCH_COOKIE}
  2204. .endif
  2205. @${_MAKESYS} do-distpatch
  2206. .if target(post-distpatch)
  2207. @${_MAKESYS} post-distpatch
  2208. .endif
  2209. .if ${PATCH_CHECK_ONLY:L} != "yes"
  2210. @${_MAKE_COOKIE} $@
  2211. .endif
  2212. .if !target(do-distpatch)
  2213. do-distpatch:
  2214. # What DISTPATCH normally does
  2215. . if !empty(_LIST_PATCHFILES)
  2216. @${ECHO_MSG} "===> Applying distribution patches for ${FULLPKGNAME}${_MASTER}"
  2217. @cd ${FULLDISTDIR}; \
  2218. for patchfile in ${_LIST_PATCHFILES}; do \
  2219. case "${PATCH_DEBUG:L}" in \
  2220. no) ;; \
  2221. *) ${ECHO_MSG} "===> Applying distribution patch $$patchfile" ;; \
  2222. esac; \
  2223. case $$patchfile in \
  2224. ${PATCH_CASES} \
  2225. esac; \
  2226. done
  2227. . endif
  2228. # End of DISTPATCH.
  2229. .endif
  2230. # The real patch
  2231. ${_PATCH_COOKIE}: ${_EXTRACT_COOKIE}
  2232. @${ECHO_MSG} "===> Patching for ${FULLPKGNAME}${_MASTER}"
  2233. .if target(pre-patch)
  2234. @${_MAKE} ${_PREPATCH_COOKIE}
  2235. .endif
  2236. .if target(do-patch)
  2237. @${_MAKESYS} do-patch
  2238. .else
  2239. # What PATCH normally does:
  2240. # XXX test for efficiency, don't bother with distpatch if it's not needed
  2241. . if target(do-distpatch) || target(post-distpatch) || !empty(PATCHFILES)
  2242. @${_MAKE} _internal-distpatch
  2243. . endif
  2244. @if cd ${PATCHDIR} 2>/dev/null || [ x"${PATCH_LIST:M/*}" != x"" ]; then \
  2245. error=false; \
  2246. for i in ${PATCH_LIST}; do \
  2247. case $$i in \
  2248. *.orig|*.rej|*~) \
  2249. ${ECHO_MSG} "===> Ignoring patchfile $$i" ; \
  2250. ;; \
  2251. *) \
  2252. if [ -e $$i ]; then \
  2253. case "${PATCH_DEBUG:L}" in \
  2254. no) ;; \
  2255. *) ${ECHO_MSG} "===> Applying OpenBSD patch $$i" ;; \
  2256. esac; \
  2257. if [ -s $$i ]; then \
  2258. ${PATCH} ${PATCH_ARGS} < $$i || \
  2259. { echo "***> $$i did not apply cleanly"; \
  2260. error=true; }; \
  2261. else \
  2262. ${ECHO_MSG} "===> Ignoring empty patchfile $$i"; \
  2263. fi; \
  2264. else \
  2265. if [ $$i != "patch-*" ]; then \
  2266. echo "===> Can't find patch matching $$i"; \
  2267. error=true; \
  2268. fi; \
  2269. fi; \
  2270. ;; \
  2271. esac; \
  2272. done;\
  2273. if $$error; then exit 1; fi; \
  2274. fi
  2275. # End of PATCH.
  2276. .endif
  2277. .if ${USE_WXNEEDED:L} == "yes"
  2278. @printf '#!/bin/sh\nexec /usr/bin/ld -z wxneeded "$$@"\n' > ${WRKDIR}/bin/ld
  2279. @chmod 555 ${WRKDIR}/bin/ld
  2280. .endif
  2281. .for _wrap _comp in ${COMPILER_LINKS}
  2282. @echo '===> Compiler link: ${_wrap} -> ${COMPILER_WRAPPER:= }${_comp}'
  2283. @printf '#!/bin/sh\nexec ${COMPILER_WRAPPER} ${_comp} -B ${WRKDIR}/bin "$$@"\n' > ${WRKDIR}/bin/${_wrap}
  2284. @chmod 555 ${WRKDIR}/bin/${_wrap}
  2285. .endfor
  2286. .if target(post-patch)
  2287. @${_MAKESYS} post-patch
  2288. .endif
  2289. .for _m in ${MODULES:T:U}
  2290. . if defined(MOD${_m}_post-patch)
  2291. @${MOD${_m}_post-patch}
  2292. . endif
  2293. .endfor
  2294. .if !empty(REORDER_DEPENDENCIES)
  2295. @sed -e '/^#/d' ${REORDER_DEPENDENCIES} | \
  2296. tsort -r|while read f; do \
  2297. cd ${WRKSRC}; \
  2298. case $$f in \
  2299. /*) \
  2300. find . -name $${f#/} -print| while read i; \
  2301. do ${ECHO_REORDER} "Touching $$i"; touch $$i; done \
  2302. ;; \
  2303. *) \
  2304. if test -e $$f ; then \
  2305. ${ECHO_REORDER} "Touching $$f"; touch $$f; \
  2306. fi \
  2307. ;; \
  2308. esac; done
  2309. .endif
  2310. .if ${PATCH_CHECK_ONLY:L} != "yes"
  2311. @${_MAKE_COOKIE} $@
  2312. .endif
  2313. # The real configure
  2314. ${_CONFIGURE_COOKIE}: ${_PATCH_COOKIE}
  2315. @${ECHO_MSG} "===> Configuring for ${FULLPKGNAME}${_MASTER}"
  2316. .if defined(_CONFIG_SITE)
  2317. @cd ${PORTSDIR}/infrastructure/db && cat ${CONFIG_SITE_LIST} >${_CONFIG_SITE}
  2318. @echo "Using ${_CONFIG_SITE} (generated)"
  2319. .endif
  2320. @mkdir -p ${WRKBUILD}
  2321. .if target(pre-configure)
  2322. @${_MAKESYS} pre-configure
  2323. .endif
  2324. .for _m in ${MODULES:T:U}
  2325. . if defined(MOD${_m}_pre-configure)
  2326. @${MOD${_m}_pre-configure}
  2327. . endif
  2328. .endfor
  2329. .if target(do-configure)
  2330. @${_MAKESYS} do-configure
  2331. .else
  2332. # What CONFIGURE normally does
  2333. . for _c in ${CONFIGURE_STYLE:U}
  2334. . if defined(MOD${_c}_configure)
  2335. @${MOD${_c}_configure}
  2336. . endif
  2337. . endfor
  2338. # End of CONFIGURE.
  2339. .endif
  2340. .if target(post-configure)
  2341. @${_MAKESYS} post-configure
  2342. .endif
  2343. @${_MAKE_COOKIE} $@
  2344. # The real build
  2345. ${_BUILD_COOKIE}: ${_CONFIGURE_COOKIE}
  2346. .if ${NO_BUILD:L} == "no"
  2347. @${ECHO_MSG} "===> Building for ${FULLPKGNAME}${_MASTER}"
  2348. . if target(pre-build)
  2349. @${_MAKESYS} pre-build
  2350. . endif
  2351. . if target(do-build)
  2352. @${_MAKESYS} do-build
  2353. . else
  2354. # What BUILD normally does:
  2355. @cd ${WRKBUILD} && exec ${SETENV} ${MAKE_ENV} \
  2356. ${MAKE_PROGRAM} ${MAKE_FLAGS} -f ${MAKE_FILE} ${ALL_TARGET}
  2357. # End of BUILD
  2358. . endif
  2359. . if target(post-build)
  2360. @${_MAKESYS} post-build
  2361. . endif
  2362. .endif
  2363. @${_MAKE_COOKIE} $@
  2364. ${_TEST_COOKIE}: ${_BUILD_COOKIE}
  2365. .if ${NO_TEST:L} == "no"
  2366. @${ECHO_MSG} "===> Regression tests for ${FULLPKGNAME}${_MASTER}"
  2367. # When interactive tests need X11
  2368. . if ${TEST_IS_INTERACTIVE:L} == "x11"
  2369. . if !defined(DISPLAY) || !exists(${XAUTHORITY})
  2370. @echo 1>&2 "The regression tests require a running instance of X."
  2371. @echo 1>&2 "You will also need to set the environment variable DISPLAY"
  2372. @echo 1>&2 "to point to an active X11 display and XAUTHORITY to point"
  2373. @echo 1>&2 "to the appropriate .Xauthority file."
  2374. @exit 1
  2375. . endif
  2376. . endif
  2377. . if target(pre-test)
  2378. @${_MAKE} pre-test
  2379. . endif
  2380. . if target(do-test)
  2381. @cd ${.CURDIR} && exec 3>&1 && exit `exec 4>&1 1>&3; \
  2382. (exec; set +e; PKGPATH=${PKGPATH} ${MAKE} do-test; \
  2383. echo $$? >&4) 2>&1 ${TEST_LOG}`
  2384. . else
  2385. # What TEST normally does:
  2386. @cd ${WRKBUILD} && exec 3>&1 && exit `exec 4>&1 1>&3; \
  2387. (exec; set +e; ${SETENV} ${ALL_TEST_ENV} ${MAKE_PROGRAM} \
  2388. ${ALL_TEST_FLAGS} -f ${MAKE_FILE} ${TEST_TARGET}; \
  2389. echo $$? >&4) 2>&1 ${TEST_LOG}`
  2390. # End of TEST
  2391. . endif
  2392. . if target(post-test)
  2393. @${_MAKE} post-test
  2394. . endif
  2395. .else
  2396. @echo 1>&2 "No regression tests for ${FULLPKGNAME}"
  2397. .endif
  2398. @${_MAKE_COOKIE} $@
  2399. # XXX we don't care about the order
  2400. .for _m in ${MODULES:T:U}
  2401. . if defined(MOD${_m}_post-install)
  2402. _hook-post-install::
  2403. @${MOD${_m}_post-install}
  2404. . endif
  2405. .endfor
  2406. ${_FAKE_COOKIE}: ${_BUILD_COOKIE} ${_FAKESUDO_CHECK_COOKIE}
  2407. @${ECHO_MSG} "===> Faking installation for ${FULLPKGNAME}${_MASTER}"
  2408. @if [ x`umask 022;${_FAKESUDO} /bin/sh -c umask` != x022 ]; then \
  2409. echo >&2 "Error: your umask is \"`${_FAKESUDO} /bin/sh -c umask`"\".; \
  2410. exit 1; \
  2411. fi
  2412. .if ${FAKE_AS_ROOT:L} == "yes"
  2413. @${_FAKESUDO} install -d -m 755 ${_BINOWNGRP} ${WRKINST}
  2414. .else
  2415. install -d -m 755 ${WRKINST}
  2416. .endif
  2417. @cat ${MTREE_FILE}| \
  2418. ${_FAKESUDO} /usr/sbin/mtree -U -e -d -p ${WRKINST} >/dev/null
  2419. .if ${FAKE_AS_ROOT:L} != "yes"
  2420. @ln -sf /bin/echo ${WRKDIR}/bin/chown
  2421. @ln -sf /bin/echo ${WRKDIR}/bin/chgrp
  2422. @install -m ${BINMODE} ${_INSTALL_WRAPPER} ${WRKDIR}/bin/install
  2423. .endif
  2424. .for _m in ${MODULES:T:U}
  2425. . if defined(MOD${_m}_pre-fake)
  2426. @${MOD${_m}_pre-fake}
  2427. . endif
  2428. .endfor
  2429. .if target(pre-fake)
  2430. @${_SUDOMAKESYS} pre-fake ${FAKE_SETUP}
  2431. .endif
  2432. @${_FAKESUDO} ${_MAKE_COOKIE} ${_INSTALL_PRE_COOKIE}
  2433. .if target(pre-install)
  2434. @${_SUDOMAKESYS} pre-install ${FAKE_SETUP}
  2435. .endif
  2436. .if target(do-install)
  2437. @${_SUDOMAKESYS} do-install ${FAKE_SETUP}
  2438. .else
  2439. # What FAKE normally does:
  2440. @cd ${WRKBUILD} && umask 022 && exec ${_FAKESUDO} \
  2441. ${SETENV} ${MAKE_ENV} ${FAKE_SETUP} \
  2442. ${MAKE_PROGRAM} ${ALL_FAKE_FLAGS} -f ${MAKE_FILE} ${FAKE_TARGET}
  2443. # End of FAKE.
  2444. .endif
  2445. .if target(post-install)
  2446. @${_SUDOMAKESYS} post-install ${FAKE_SETUP}
  2447. .endif
  2448. .if target(_hook-post-install)
  2449. @${_SUDOMAKESYS} _hook-post-install ${FAKE_SETUP}
  2450. .endif
  2451. .if ${MULTI_PACKAGES} == "-"
  2452. @if test -e ${PKGDIR}/README; then \
  2453. r=${WRKINST}${_README_DIR}/${FULLPKGNAME}; \
  2454. echo "Installing ${PKGDIR}/README as $$r"; \
  2455. ${_FAKESUDO} ${SUBST_CMD} ${_SHAREOWNGRP} -m ${SHAREMODE} -c ${PKGDIR}/README $$r; \
  2456. fi
  2457. .else
  2458. . for _s in ${MULTI_PACKAGES}
  2459. @if test -e ${PKGDIR}/README${_s}; then \
  2460. r=${WRKINST}${_README_DIR}/${FULLPKGNAME${_s}}; \
  2461. echo "Installing ${PKGDIR}/README${_s} as $$r"; \
  2462. ${_FAKESUDO} ${SUBST_CMD${_s}} ${_SHAREOWNGRP} -m ${SHAREMODE} -c ${PKGDIR}/README${_s} $$r; \
  2463. fi
  2464. . endfor
  2465. .endif
  2466. @mkdir -p ${PKGDIR}
  2467. @cd ${PKGDIR} && for i in *.rc; do \
  2468. if test X"$$i" != "X*.rc"; then \
  2469. r=${WRKINST}${RCDIR}/$${i%.rc}; \
  2470. echo "Installing ${PKGDIR}/$$i as $$r"; \
  2471. ${_FAKESUDO} ${SUBST_CMD} ${_BINOWNGRP} -m ${BINMODE} -c $$i $$r; \
  2472. fi; \
  2473. done
  2474. @${_FAKESUDO} ${_MAKE_COOKIE} $@
  2475. print-plist:
  2476. @${_PKG_CREATE} -n -q ${PKG_ARGS${SUBPACKAGE}} ${_PACKAGE_COOKIE${SUBPACKAGE}}
  2477. print-plist-with-depends:
  2478. @if a=`SUBPACKAGE=${SUBPACKAGE} PKGPATH=${PKGPATH} ${MAKE} print-package-args`; \
  2479. then \
  2480. ${_PKG_CREATE} -n -q $$a ${PKG_ARGS${SUBPACKAGE}} ${_PACKAGE_COOKIE${SUBPACKAGE}}; \
  2481. else \
  2482. exit 1; \
  2483. fi
  2484. print-plist-libs-with-depends:
  2485. @if a=`SUBPACKAGE=${SUBPACKAGE} PKGPATH=${PKGPATH} ${MAKE} print-package-args`; \
  2486. then \
  2487. ${_PKG_CREATE} -DLIBS_ONLY -n -q $$a ${PKG_ARGS${SUBPACKAGE}} ${_PACKAGE_COOKIE${SUBPACKAGE}}; \
  2488. else \
  2489. exit 1; \
  2490. fi
  2491. print-plist-all:
  2492. .for _S in ${BUILD_PACKAGES}
  2493. @${ECHO_MSG} "===> ${FULLPKGNAME${_S}}"
  2494. . if ${STATIC_PLIST${_s}:L} == "yes"
  2495. @${_PKG_CREATE} -n -q ${PKG_ARGS${_S}} ${_PACKAGE_COOKIE${_S}}
  2496. . else
  2497. @${_PKG_CREATE} -n -q ${PKG_ARGS${_S}:S@^-f$@-D@g} -f/dev/null ${_PACKAGE_COOKIE${_S}}
  2498. . endif
  2499. .endfor
  2500. print-plist-all-with-depends:
  2501. .for _S in ${BUILD_PACKAGES}
  2502. @${ECHO_MSG} "===> ${FULLPKGNAME${_S}}"
  2503. @if a=`SUBPACKAGE=${_S} PKGPATH=${PKGPATH} ${MAKE} print-package-args`; \
  2504. then \
  2505. ${_PKG_CREATE} -n -q $$a ${PKG_ARGS${_S}} ${_PACKAGE_COOKIE${_S}}; \
  2506. else \
  2507. exit 1; \
  2508. fi
  2509. .endfor
  2510. print-plist-contents:
  2511. @${_PKG_CREATE} -n -Q ${PKG_ARGS${SUBPACKAGE}} ${_PACKAGE_COOKIE${SUBPACKAGE}}
  2512. print-plist-libs:
  2513. @${_PKG_CREATE} -DLIBS_ONLY -n -Q ${PKG_ARGS${SUBPACKAGE}} ${_PACKAGE_COOKIE${SUBPACKAGE}}|${_grab_libs_from_plist}
  2514. _internal-package-only: ${_PACKAGE_COOKIES}
  2515. _internal-subpackage: ${_PACKAGE_COOKIES${SUBPACKAGE}}
  2516. # Separate target for each file fetch-all will retrieve
  2517. .for p f m u in ${_FULL_FETCH_LIST}
  2518. ${DISTDIR}/$p:
  2519. . if ${FETCH_MANUALLY:L} != "no"
  2520. . if !empty(MISSING_FILES)
  2521. @echo "*** You're missing files: ${MISSING_FILES}"
  2522. . endif
  2523. . for _M in ${FETCH_MANUALLY}
  2524. @echo "*** ${_M}"
  2525. . endfor
  2526. @exit 1
  2527. . else
  2528. @lock=${@:T}.dist; ${_SIMPLE_LOCK}; install -d ${DISTDIR_MODE} ${@:H}; \
  2529. cd ${@:H}; \
  2530. test -f ${@:T} && exit 0; \
  2531. f=$f; \
  2532. if ! ${_MAKESUM} && test ! -f ${CHECKSUM_FILE}; then \
  2533. ${ECHO_MSG} ">> Checksum file does not exist"; \
  2534. exit 1; \
  2535. fi; \
  2536. for site in ${$m}; do \
  2537. file=$@.part; \
  2538. ${ECHO_MSG} ">> Fetch $${site}$u"; \
  2539. if ${FETCH_CMD} -o $$file $${site}$u; then \
  2540. if ${_MAKESUM}; then \
  2541. mv $$file $@; \
  2542. exit 0; \
  2543. else \
  2544. ck=`${_size_fragment} $$file $p`; \
  2545. if grep -q "^$$ck\$$" ${CHECKSUM_FILE}; then \
  2546. mv $$file $@; \
  2547. exit 0; \
  2548. else \
  2549. if grep -q "SIZE ($p)" ${CHECKSUM_FILE}; then \
  2550. ${ECHO_MSG} ">> Size does not match for $p"; \
  2551. rm -f $$file; \
  2552. else \
  2553. ${ECHO_MSG} ">> No size recorded for $p"; \
  2554. rm -f $$file; \
  2555. exit 1; \
  2556. fi; \
  2557. fi; \
  2558. fi; \
  2559. fi; \
  2560. done; exit 1
  2561. . endif
  2562. .endfor
  2563. .for _l _o in ${_PACKAGE_LINKS}
  2564. ${PACKAGE_REPOSITORY}/${_l}: ${PACKAGE_REPOSITORY}/${_o}
  2565. @echo "Link to $@"
  2566. @install -d ${PACKAGE_REPOSITORY_MODE} ${@D}
  2567. @rm -f $@
  2568. @ln $? $@ 2>/dev/null || \
  2569. cp -p $? $@
  2570. .endfor
  2571. # Cleaning up
  2572. _internal-clean:
  2573. .if ${_clean:Mdepends} && ${_CLEANDEPENDS:L} == "yes"
  2574. @PKGPATH=${PKGPATH} ${MAKE} all-dir-depends|${_sort_dependencies}|while read subdir; do \
  2575. ${_flavor_fragment}; \
  2576. eval $$toset ${MAKE} _CLEANDEPENDS=No clean; \
  2577. done
  2578. .endif
  2579. @${ECHO_MSG} "===> Cleaning for ${FULLPKGNAME${SUBPACKAGE}}"
  2580. .if ${_clean:Mfake}
  2581. @if cd ${WRKINST} 2>/dev/null; then ${_FAKESUDO} rm -rf ${WRKINST}; fi
  2582. .endif
  2583. .if ${_clean:Mwork} || (${_clean:Mbuild} && ${SEPARATE_BUILD:L} == "no")
  2584. . if ${_clean:Mflavors}
  2585. @for i in ${.CURDIR}/w-*; do \
  2586. if [ -L $$i ]; then ${SUDO} rm -rf `readlink $$i`; fi; \
  2587. ${SUDO} rm -rf $$i; \
  2588. done
  2589. . endif
  2590. . for l in ${_WRKDIRS}
  2591. . if "$l" != ""
  2592. @if [ -L $l ]; then rm -rf `readlink $l`; fi
  2593. @if [ -e $l ]; then rm -rf $l; fi
  2594. . endif
  2595. . endfor
  2596. . if !empty(WRKDIR_LINKNAME)
  2597. @if [ -L ${WRKDIR_LINKNAME} ]; then rm -f ${.CURDIR}/${WRKDIR_LINKNAME}; fi
  2598. . endif
  2599. .elif ${_clean:Mbuild} && ${SEPARATE_BUILD:L} != "no"
  2600. @rm -rf ${WRKBUILD} ${_CONFIGURE_COOKIE} ${_BUILD_COOKIE}
  2601. .endif
  2602. .if ${_clean:Mdist}
  2603. @${ECHO_MSG} "===> Dist cleaning for ${FULLPKGNAME${SUBPACKAGE}}"
  2604. @if cd ${DISTDIR} 2>/dev/null; then \
  2605. rm -f ${MAKESUMFILES}; \
  2606. fi
  2607. . if !empty(DIST_SUBDIR)
  2608. -@rmdir ${FULLDISTDIR}
  2609. . endif
  2610. .endif
  2611. .if ${_clean:Minstall}
  2612. . if ${_clean:Msub}
  2613. -${SUDO} ${_PKG_DELETE} ${PKGNAMES}
  2614. . else
  2615. -${SUDO} ${_PKG_DELETE} ${FULLPKGNAME${SUBPACKAGE}}
  2616. . endif
  2617. .endif
  2618. .if ${_clean:Mpackages} || ${_clean:Mpackage} && ${_clean:Msub}
  2619. rm -f ${_PACKAGE_COOKIES} ${_UPDATE_COOKIES} ${_CACHE_PACKAGE_COOKIES}
  2620. .elif ${_clean:Mpackage}
  2621. rm -f ${_PACKAGE_COOKIES${SUBPACKAGE}} ${_UPDATE_COOKIE${SUBPACKAGE}}
  2622. .endif
  2623. .if ${_clean:Mbulk}
  2624. rm -f ${_BULK_COOKIE}
  2625. .endif
  2626. .if ${_clean:Mplist}
  2627. . for _d in ${PLIST_DB:S/:/ /}
  2628. . for _p in ${PKGNAMES}
  2629. rm -f ${_d}/${_p}
  2630. . endfor
  2631. . endfor
  2632. .endif
  2633. # This target generates an index entry suitable for aggregation into
  2634. # a large index. Format is:
  2635. #
  2636. # distribution-name|port-path|installation-prefix|comment| \
  2637. # description-file|maintainer|categories|lib-deps|build-deps|run-deps| \
  2638. # for-arch|package-cdrom|package-ftp|distfiles-ftp
  2639. #
  2640. describe:
  2641. .for _S in ${MULTI_PACKAGES}
  2642. @echo -n "${FULLPKGNAME${_S}}|${FULLPKGPATH${_S}}|"
  2643. . if ${PREFIX${_S}} == ${LOCALBASE}
  2644. @echo -n "|"
  2645. . else
  2646. @echo -n "${PREFIX${_S}}|"
  2647. . endif
  2648. @echo -n ${_COMMENT${_S}:S/^"//:S/"$//:S/^'//:S/'$//:Q}"|"; \
  2649. if [ -f ${DESCR${_S}} ]; then \
  2650. echo -n `PORTSDIR_PATH=${PORTSDIR_PATH} ${_PERLSCRIPT}/getpkgpath ${DESCR${_S}}`'|'; \
  2651. else \
  2652. echo -n "/dev/null|"; \
  2653. fi; \
  2654. echo -n "${MAINTAINER}|${CATEGORIES${_S}}|"
  2655. . for _d in LIB BUILD RUN
  2656. @echo -n '${_${_d}_DEP3${_S}:C/ +/ /g}'| tr '\040' '\012'|sort -u|tr '\012' '\040' | sed -e 's, $$,,'
  2657. @echo -n '|'
  2658. . endfor
  2659. . if defined(ONLY_FOR_ARCHS${_S})
  2660. @echo -n "${ONLY_FOR_ARCHS${_S}}|"
  2661. . elif defined(NOT_FOR_ARCHS${_S})
  2662. @echo -n "!${NOT_FOR_ARCHS${_S}}|"
  2663. . else
  2664. @echo -n "any|"
  2665. . endif
  2666. . if defined(_BAD_LICENSING)
  2667. @echo "?|?|?|?"
  2668. . else
  2669. . if ${PERMIT_PACKAGE_CDROM${_S}:L} == "yes"
  2670. @echo -n "y|"
  2671. . else
  2672. @echo -n "n|"
  2673. . endif
  2674. . if ${PERMIT_PACKAGE_FTP${_S}:L} == "yes"
  2675. @echo -n "y|"
  2676. . else
  2677. @echo -n "n|"
  2678. . endif
  2679. . if ${PERMIT_DISTFILES_FTP:L} == "yes"
  2680. @echo "y"
  2681. . else
  2682. @echo "n"
  2683. . endif
  2684. . endif
  2685. .endfor
  2686. print-build-depends:
  2687. .if !empty(_BUILD_DEP)
  2688. @echo -n 'This port requires package(s) "'
  2689. @PKGPATH=${PKGPATH} ${MAKE} full-build-depends| ${_lines2list}
  2690. @echo '" to build.'
  2691. .endif
  2692. print-run-depends:
  2693. .if !empty(_RUN_DEP)
  2694. @echo -n 'This port requires package(s) "'
  2695. @PKGPATH=${PKGPATH} ${MAKE} full-run-depends| ${_lines2list}
  2696. @echo '" to run.'
  2697. .endif
  2698. # full-build-depends, full-all-depends, full-run-depends full-test-depends
  2699. .for _i in build all run test
  2700. full-${_i}-depends:
  2701. @PKGPATH=${PKGPATH} ${MAKE} ${_i}-dir-depends|${_sort_dependencies}|while read subdir; do \
  2702. ${_flavor_fragment}; \
  2703. eval $$toset ${MAKE} _print-packagename ; \
  2704. done
  2705. .endfor
  2706. license-check:
  2707. .for _S in ${BUILD_PACKAGES}
  2708. . if ${PERMIT_PACKAGE_CDROM${_S}:L} == "yes" || \
  2709. ${PERMIT_PACKAGE_FTP${_S}:L} == "yes"
  2710. @SUBPACKAGE=${_S} PKGPATH=${PKGPATH} ${MAKE} all-dir-depends|${_sort_dependencies}|while read subdir; do \
  2711. ${_flavor_fragment}; \
  2712. _MASTER_PERMIT_CDROM=${PERMIT_PACKAGE_CDROM${_S}:Q}; \
  2713. _MASTER_PERMIT_FTP=${PERMIT_PACKAGE_FTP${_S}:Q}; \
  2714. export _MASTER_PERMIT_CDROM _MASTER_PERMIT_FTP; \
  2715. eval $$toset ${MAKE} _license-check; \
  2716. done
  2717. . endif
  2718. .endfor
  2719. _license-check:
  2720. .for _i in FTP CDROM
  2721. . if defined(_MASTER_PERMIT_${_i}) && ${_MASTER_PERMIT_${_i}:L} == "yes" && \
  2722. ${PERMIT_PACKAGE_${_i}:L} != "yes"
  2723. @echo >&2 "Warning: dependency ${PKGPATH} is not allowed for ${_i}"
  2724. . endif
  2725. .endfor
  2726. # run-depends-list, build-depends-list, lib-depends-list, test-depends-list
  2727. .for _i in RUN BUILD LIB TEST
  2728. ${_i:L}-depends-list:
  2729. . if !empty(_${_i}_DEP3)
  2730. @echo -n "This port requires \""
  2731. @echo -n '${_${_i}_DEP3:C/ +/ /g}'| tr '\040' '\012'|sort -u|tr '\012' '\040' | sed -e 's, $$,,'
  2732. @echo "\" for ${_i:L}."
  2733. . endif
  2734. .endfor
  2735. # recursive depend targets
  2736. print-package-signature print-update-signature:
  2737. @echo -n ${FULLPKGNAME${SUBPACKAGE}}
  2738. .if !empty(_DEPRUNLIBS)
  2739. @${_cache_fragment}; cd ${.CURDIR} && ${MAKE} _print-package-signature-lib _print-package-signature-run| \
  2740. sort -u| \
  2741. while read i; do echo -n ",$$i"; done
  2742. .else
  2743. @cd ${.CURDIR} && PKGPATH=${PKGPATH} ${MAKE} _print-package-signature-run | \
  2744. sort -u| \
  2745. while read i; do echo -n ",$$i"; done
  2746. .endif
  2747. @echo
  2748. print-package-args: run-depends-args
  2749. print-package-args: ${lib_depends_args} ${wantlib_args}
  2750. run-depends-args:
  2751. @${_emit_run_depends} | while ${_read_spec}; do \
  2752. ${_parse_spec}; \
  2753. ${_complete_pkgspec}; \
  2754. echo "-P $$pkgpath:$$pkg:$$default"; \
  2755. done
  2756. # waive checks for WANTLIB when we're running lib-depends-check
  2757. # since we're trying to figure out what's actually needed
  2758. all-lib-depends-args:
  2759. @${_emit_lib_depends} |while ${_read_spec}; do \
  2760. ${_parse_spec}; \
  2761. ${_complete_pkgspec}; \
  2762. echo "-P $$pkgpath:$$pkg:$$default"; \
  2763. done
  2764. # - remove lib-depends-args if we're only scanning for common dirs in
  2765. # update-plist and we're not shared only
  2766. # - zap wantlib-args when we're only solving for @depends in pkg_create(1).
  2767. no-lib-depends-args no-wantlib-args:
  2768. @:
  2769. # those are expensive computations, so don't do them if we don't have to
  2770. .if empty(_DEPRUNLIBS)
  2771. lib-depends-args wantlib-args port-wantlib-args fake-wantlib-args:
  2772. .else
  2773. lib-depends-args:
  2774. @${_cache_fragment}; ${_emit_lib_depends}| while ${_read_spec}; do \
  2775. ${_if_check_needed}; then \
  2776. ${_complete_pkgspec}; \
  2777. echo "-P $$pkgpath:$$pkg:$$default"; \
  2778. else \
  2779. echo "LIB_DEPENDS $$d not needed for ${FULLPKGPATH${SUBPACKAGE}} ?" 1>&2; \
  2780. fi; \
  2781. done
  2782. wantlib-args:
  2783. @${_cache_fragment}; \
  2784. a=$${_DEPENDS_CACHE}/portstree-${FULLPKGNAME${SUBPACKAGE}}; \
  2785. b=$${_DEPENDS_CACHE}/inst-${FULLPKGNAME${SUBPACKAGE}}; \
  2786. if cd ${.CURDIR} && \
  2787. ${MAKE} port-wantlib-args >$$a && \
  2788. ${MAKE} fake-wantlib-args >$$b; then \
  2789. if ! cmp -s $$a $$b; \
  2790. then \
  2791. echo 1>&2 "${_check_msg}: Libraries in packing-lists in the ports tree"; \
  2792. echo 1>&2 " and libraries from installed packages don't match"; \
  2793. diff 1>&2 -u $$a $$b ${_check_error}; \
  2794. fi; \
  2795. cat $$b; \
  2796. rm $$a $$b; \
  2797. else \
  2798. exit 1; \
  2799. fi
  2800. port-wantlib-args:
  2801. @${_cache_fragment}; \
  2802. if found=`${_list_port_libs} | ${_resolve_lib} ${_DEPRUNLIBS:QL}`; \
  2803. then \
  2804. ${_show_found}; \
  2805. else \
  2806. exit 1; \
  2807. fi
  2808. fake-wantlib-args:
  2809. @if found=`{ \
  2810. echo {${WRKINST},}${LOCALBASE}/lib${_lib} /usr/lib${_lib} ${X11BASE}/lib${_lib}; \
  2811. for d in ${_DEPRUNLIBS:QL}; do \
  2812. case "$$d" in \
  2813. /*) echo {${WRKINST},}$${d%/*}${_lib};; \
  2814. */*) echo {${WRKINST},}${LOCALBASE}/$${d%/*}${_lib};; \
  2815. esac; \
  2816. done } | perl -pe 's,\Q${WRKINST}\E,,g' | \
  2817. ${_resolve_lib} ${_DEPRUNLIBS:QL}`; then \
  2818. ${_show_found}; \
  2819. else \
  2820. exit 1; \
  2821. fi
  2822. .endif
  2823. _print-package-signature-run:
  2824. @${_emit_run_depends} |while ${_read_spec}; do \
  2825. ${_parse_spec}; \
  2826. ${_compute_default}; \
  2827. echo "@$$default"; \
  2828. done
  2829. _print-package-signature-lib:
  2830. @${_list_port_libs}| ${_resolve_lib} ${_DEPRUNLIBS:QL}; \
  2831. ${_emit_lib_depends}| while ${_read_spec}; do \
  2832. ${_if_check_needed}; then \
  2833. ${_complete_pkgspec}; \
  2834. echo "@$$default"; \
  2835. fi; \
  2836. done
  2837. # recursively build a list of dirs for package running, ready for tsort
  2838. _recurse-run-dir-depends:
  2839. .for _dir in ${_RUN_DEP}
  2840. @echo "$$self ${_dir}"; \
  2841. if ! fgrep -q -e "r|${_dir}|" -e "a|${_dir}|" $${_DEPENDS_FILE}; then \
  2842. echo "r|${_dir}|" >> $${_DEPENDS_FILE}; \
  2843. subdir=${_dir}; ${_flavor_fragment}; \
  2844. toset="$$toset self=\"${_dir}\""; \
  2845. if ! eval $$toset ${MAKE} _recurse-run-dir-depends; then \
  2846. echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
  2847. exit 1; \
  2848. fi; \
  2849. fi
  2850. .endfor
  2851. run-dir-depends:
  2852. .if !empty(_RUN_DEP)
  2853. @${_depfile_fragment}; \
  2854. if ! fgrep -q -e "r|${_FULLPKGPATH}|" -e "a|${_FULLPKGPATH}" $${_DEPENDS_FILE}; then \
  2855. echo "r|${_FULLPKGPATH}|" >>$${_DEPENDS_FILE}; \
  2856. self=${_FULLPKGPATH} PKGPATH=${PKGPATH} ${MAKE} _recurse-run-dir-depends; \
  2857. fi
  2858. .else
  2859. @echo "${_FULLPKGPATH} ${_FULLPKGPATH}"
  2860. .endif
  2861. # recursively build a list of dirs for package regression tests, ready for tsort
  2862. _recurse-test-dir-depends:
  2863. .for _dir in ${_TEST_DEP}
  2864. @echo "$$self ${_dir}"; \
  2865. if ! fgrep -q -e "R|${_dir}|" $${_DEPENDS_FILE}; then \
  2866. echo "R|${_dir}|" >> $${_DEPENDS_FILE}; \
  2867. subdir=${_dir}; ${_flavor_fragment}; \
  2868. toset="$$toset self=\"${_dir}\""; \
  2869. if ! eval $$toset ${MAKE} _recurse-run-dir-depends; then \
  2870. echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
  2871. exit 1; \
  2872. fi; \
  2873. fi
  2874. .endfor
  2875. test-dir-depends:
  2876. .if !empty(_TEST_DEP)
  2877. @${_depfile_fragment}; \
  2878. if ! fgrep -q -e "R|${_FULLPKGPATH}|" $${_DEPENDS_FILE}; then \
  2879. echo "R|${_FULLPKGPATH}|" >>$${_DEPENDS_FILE}; \
  2880. self=${_FULLPKGPATH} PKGPATH=${PKGPATH} ${MAKE} _recurse-test-dir-depends; \
  2881. fi
  2882. .else
  2883. @echo "${_FULLPKGPATH} ${_FULLPKGPATH}"
  2884. .endif
  2885. # recursively build a list of dirs for package building, ready for tsort
  2886. # second and further stages need _RUN_DEP.
  2887. _recurse-all-dir-depends:
  2888. .for _dir in ${_BUILD_DEP} ${_RUN_DEP}
  2889. @echo "$$self ${_dir}"; \
  2890. if ! fgrep -q "a|${_dir}|" $${_DEPENDS_FILE}; then \
  2891. echo "a|${_dir}|" >> $${_DEPENDS_FILE}; \
  2892. subdir=${_dir}; ${_flavor_fragment}; \
  2893. toset="$$toset self=\"${_dir}\""; \
  2894. if ! eval $$toset ${MAKE} _recurse-all-dir-depends; then \
  2895. echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
  2896. exit 1; \
  2897. fi; \
  2898. fi
  2899. .endfor
  2900. # first stage does not need _RUN_DEP
  2901. _build-dir-depends:
  2902. .for _dir in ${_BUILD_DEP}
  2903. @echo "$$self ${_dir}"; \
  2904. if ! fgrep -q -e "b|${_dir}|" -e "a|${_dir}|" $${_DEPENDS_FILE}; then \
  2905. echo "b|${_dir}|" >> $${_DEPENDS_FILE}; \
  2906. subdir=${_dir}; ${_flavor_fragment}; \
  2907. toset="$$toset self=\"${_dir}\""; \
  2908. if ! eval $$toset ${MAKE} _recurse-all-dir-depends; then \
  2909. echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
  2910. exit 1; \
  2911. fi; \
  2912. fi
  2913. .endfor
  2914. build-dir-depends:
  2915. .if !empty(_BUILD_DEP)
  2916. @${_depfile_fragment}; \
  2917. if ! fgrep -q -e "b|${_FULLPKGPATH}|" -e "a|${_dir}|" $${_DEPENDS_FILE}; then \
  2918. echo "b|${_FULLPKGPATH}|" >>$${_DEPENDS_FILE}; \
  2919. self=${_FULLPKGPATH} PKGPATH=${PKGPATH} ${MAKE} _build-dir-depends; \
  2920. fi
  2921. .else
  2922. @echo "${_FULLPKGPATH} ${_FULLPKGPATH}"
  2923. .endif
  2924. all-dir-depends:
  2925. .if !empty(_BUILD_DEP) || !empty(_RUN_DEP)
  2926. @${_depfile_fragment}; \
  2927. if ! fgrep -q "|${_FULLPKGPATH}|" $${_DEPENDS_FILE}; then \
  2928. echo "|${_FULLPKGPATH}|" >>$${_DEPENDS_FILE}; \
  2929. self=${_FULLPKGPATH} PKGPATH=${PKGPATH} ${MAKE} _recurse-all-dir-depends; \
  2930. fi
  2931. .else
  2932. @echo "${_FULLPKGPATH} ${_FULLPKGPATH}"
  2933. .endif
  2934. # simpler list of package depends, no need to tsort, no duplicates
  2935. _recurse-show-run-depends:
  2936. @for d in ${_RUN_DEP}; do \
  2937. fgrep -q -e "|$$d|" $${_DEPENDS_FILE} && continue; \
  2938. echo "$$d"; \
  2939. echo "|$$d|" >> $${_DEPENDS_FILE}; \
  2940. subdir=$$d; ${_flavor_fragment}; \
  2941. if ! eval $$toset ${MAKE} _recurse-show-run-depends; then \
  2942. echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
  2943. exit 1; \
  2944. fi; \
  2945. done
  2946. show-run-depends:
  2947. .if !empty(_RUN_DEP)
  2948. @${_depfile_fragment}; \
  2949. echo "|${_FULLPKGPATH}|" >>$${_DEPENDS_FILE}; \
  2950. for d in ${_RUN_DEP}; do \
  2951. fgrep -q -e "|$$d|" $${_DEPENDS_FILE} && continue; \
  2952. echo "$$d"; \
  2953. echo "|$$d|" >> $${_DEPENDS_FILE}; \
  2954. subdir=$$d; ${_flavor_fragment}; \
  2955. if ! eval $$toset ${MAKE} _recurse-show-run-depends; then \
  2956. echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
  2957. exit 1; \
  2958. fi; \
  2959. done
  2960. .endif
  2961. #####################################################
  2962. # convenience targets, not really needed
  2963. #####################################################
  2964. checkpatch:
  2965. @${_MAKE} PATCH_CHECK_ONLY=Yes patch
  2966. clean-depends:
  2967. @${_MAKE} clean=depends
  2968. distclean:
  2969. @${_MAKE} clean=dist
  2970. reinstall:
  2971. @${_MAKE} clean='install force'
  2972. @cd ${.CURDIR} && _DEPENDS_TARGET=reinstall PKGPATH=${PKGPATH} exec ${MAKE} install
  2973. repackage:
  2974. @${_MAKE} clean=packages
  2975. @${_MAKE} package
  2976. rebuild:
  2977. @rm -f ${_BUILD_COOKIE}
  2978. @${_MAKE} build
  2979. uninstall deinstall:
  2980. @${ECHO_MSG} "===> Deinstalling for ${FULLPKGNAME${SUBPACKAGE}}"
  2981. @${SUDO} ${_PKG_DELETE} ${FULLPKGNAME${SUBPACKAGE}}
  2982. peek-ftp:
  2983. @echo "DISTFILES=${DISTFILES}"
  2984. @install -d ${DISTDIR_MODE} ${FULLDISTDIR}; \
  2985. cd ${FULLDISTDIR}; echo "cd ${FULLDISTDIR}"; \
  2986. for i in ${MASTER_SITES:Mftp*}; do \
  2987. echo "Connecting to $$i"; ${FETCH_CMD} $$i ; break; \
  2988. done
  2989. show-required-by:
  2990. @cd ${PORTSDIR} && make all-dir-depends | ${_PERLSCRIPT}/extract-dependencies -r ${_ALLPKGPATHS}
  2991. show:
  2992. .for _s in ${show}
  2993. @echo ${${_s}:Q}
  2994. .endfor
  2995. # avoid sudo and avoid modifying dir (if possible):
  2996. # du fails if it can't access everything
  2997. show-size:
  2998. @if du -ks ${WRKDIR} 2>/dev/null >${WRKDIR}/wrkdir-size; then \
  2999. cat ${WRKDIR}/wrkdir-size && rm -f ${WRKDIR}/wrkdir-size; \
  3000. else \
  3001. chmod -R u+rX ${WRKDIR}; \
  3002. du -ks ${WRKDIR}; \
  3003. fi
  3004. show-fake-size:
  3005. @if du -ks ${WRKINST} 2>/dev/null >${WRKINST}/wrkdir-size; then \
  3006. cat ${WRKINST}/wrkdir-size && rm -f ${WRKINST}/wrkdir-size; \
  3007. else \
  3008. chmod -R u+rX ${WRKINST}; \
  3009. du -ks ${WRKINST}; \
  3010. fi
  3011. verbose-show:
  3012. .for _s in ${verbose-show}
  3013. . if defined(${_s})
  3014. @echo ${_s}=${${_s}:Q}
  3015. . endif
  3016. .endfor
  3017. _all_phony = ${_recursive_depends_targets} \
  3018. ${_recursive_targets} ${_dangerous_recursive_targets} \
  3019. _build-dir-depends _hook-post-install \
  3020. _internal-all _internal-build _internal-build-depends \
  3021. _internal-checksum _internal-clean _internal-configure \
  3022. _internal-distpatch _internal-extract _internal-fake _internal-fetch \
  3023. _internal-fetch-all _internal-install-depends \
  3024. _internal-install-all _internal-manpages-check \
  3025. _internal-package _internal-package-only _internal-plist _internal-prepare \
  3026. _internal-test _internal-test-depends \
  3027. _internal-subpackage _internal-subupdate \
  3028. _internal-update _internal-update _internal-update-plist \
  3029. _internal_install _license-check \
  3030. print-package-args _print-package-signature-lib \
  3031. _print-package-signature-run _print-packagename _recurse-all-dir-depends \
  3032. _recurse-test-dir-depends _recurse-run-dir-depends _refetch \
  3033. build-depends-list checkpatch clean clean-depends \
  3034. delete-package distpatch do-build do-configure do-distpatch \
  3035. do-extract do-install do-test fetch-all \
  3036. install-all lib-depends lib-depends-list \
  3037. peek-ftp port-lib-depends-check post-build post-configure \
  3038. post-distpatch post-extract post-install \
  3039. post-patch post-test pre-build pre-configure pre-extract pre-fake \
  3040. pre-install pre-patch pre-test prepare \
  3041. print-build-depends print-run-depends rebuild \
  3042. test-depends test-depends-list run-depends-list \
  3043. show-required-by subpackage uninstall _print-metadata \
  3044. run-depends-args lib-depends-args all-lib-depends-args wantlib-args \
  3045. port-wantlib-args fake-wantlib-args no-wantlib-args no-lib-depends-args \
  3046. _recurse-show-run-depends show-run-depends
  3047. .if defined(_DEBUG_TARGETS)
  3048. . for _t in ${_all_phony}
  3049. . if !target(${_t})
  3050. ERRORS += "Fatal: phony target ${_t} does not exist"
  3051. . endif
  3052. . endfor
  3053. .endif
  3054. .if defined(ERRORS)
  3055. .BEGIN:
  3056. . for _m in ${ERRORS}
  3057. @echo 1>&2 ${_m} "(in ${PKGPATH})"
  3058. . endfor
  3059. . if !empty(ERRORS:M"Fatal\:*") || !empty(ERRORS:M'Fatal\:*')
  3060. @exit 1
  3061. . endif
  3062. .endif
  3063. .PHONY: ${_all_phony}