bsd.port.subdir.mk 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. # from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
  2. # The include file <bsd.port.subdir.mk> contains the default targets
  3. # for building ports subdirectories.
  4. #
  5. #
  6. # +++ variables +++
  7. #
  8. # STRIP - The flag passed to the install program to cause the binary
  9. # to be stripped. This is to be used when building your
  10. # own install script so that the entire system can be made
  11. # stripped/not-stripped using a single knob. [-s]
  12. #
  13. # OPSYS - Get the operating system type [`uname -s`]
  14. #
  15. # SUBDIR - A list of subdirectories that should be built as well.
  16. # Each of the targets will execute the same target in the
  17. # subdirectories.
  18. #
  19. #
  20. # +++ targets +++
  21. #
  22. # README.html:
  23. # Creating README.html for package.
  24. #
  25. # afterinstall, all, beforeinstall, build, checksum, clean,
  26. # clean-for-cdrom, clean-restricted,
  27. # clean-for-cdrom-list, clean-restricted-list,
  28. # configure, deinstall,
  29. # depend, depends, describe, extract, fetch, fetch-list,
  30. # ignorelist, ignorelist-verbose,
  31. # install, maintainer, makesum, package, readmes, realinstall, reinstall,
  32. # tags
  33. #
  34. # search:
  35. # Search for ports using either 'make search key=<keyword>'
  36. # or 'make search name=<keyword>'.
  37. PORTSDIR?= /usr/ports
  38. TEMPLATES?= ${PORTSDIR}/Templates
  39. .if defined(PORTSTOP)
  40. README= ${TEMPLATES}/README.top
  41. .else
  42. README= ${TEMPLATES}/README.category
  43. .endif
  44. MOVEDDIR?= ${PORTSDIR}
  45. MOVEDFILE?= MOVED
  46. # Ensure .CURDIR contains an absolute path without a trailing slash. Failed
  47. # builds can occur when PORTSDIR is a symbolic link, or with something like
  48. # make -C /usr/ports/category/port/.
  49. .CURDIR:= ${.CURDIR:tA}
  50. # Ensure .CURDIR doesn't contain a colon, which breaks makefile targets
  51. .if ${.CURDIR:S/:/\:/g} != ${.CURDIR}
  52. .error The current directory path contains ':', this is not supported
  53. .endif
  54. .include "${PORTSDIR}/Mk/bsd.commands.mk"
  55. .MAIN: all
  56. .if !defined(DEBUG_FLAGS)
  57. STRIP?= -s
  58. .endif
  59. # These are variables that are invariant for the lifetime of a recursive port traversal
  60. # (index build, etc), so it is more efficient to precompute them here and pass them in
  61. # to child makes explicitly, instead of recomputing them tens of thousands of times.
  62. .if !defined(NOPRECIOUSMAKEVARS)
  63. . if !defined(ARCH)
  64. ARCH!= ${UNAME} -p
  65. . endif
  66. _EXPORTED_VARS+= ARCH
  67. . if !defined(OSVERSION)
  68. . if exists(/usr/include/sys/param.h)
  69. OSVERSION!= ${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3}' < /usr/include/sys/param.h
  70. . elif exists(${SRC_BASE}/sys/sys/param.h)
  71. OSVERSION!= ${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3}' < ${SRC_BASE}/sys/sys/param.h
  72. . else
  73. OSVERSION!= ${SYSCTL} -n kern.osreldate
  74. . endif
  75. . endif
  76. _EXPORTED_VARS+= OSVERSION
  77. WITH_PKG= yes
  78. WITH_PKGNG= yes
  79. . if !defined(_OSRELEASE)
  80. _OSRELEASE!= ${UNAME} -r
  81. . endif
  82. _EXPORTED_VARS+= _OSRELEASE
  83. . if !defined(OSREL)
  84. OSREL= ${_OSRELEASE:C/[-(].*//}
  85. . endif
  86. _EXPORTED_VARS+= OSREL
  87. . if !defined(OPSYS)
  88. OPSYS!= ${UNAME} -s
  89. . endif
  90. _EXPORTED_VARS+= OPSYS
  91. . if ${ARCH} == "amd64"
  92. . if !defined(HAVE_COMPAT_IA32_KERN)
  93. HAVE_COMPAT_IA32_KERN!= if ${SYSCTL} -n compat.ia32.maxvmem >/dev/null 2>&1; then echo YES; fi; echo
  94. . if empty(HAVE_COMPAT_IA32_KERN)
  95. .undef HAVE_COMPAT_IA32_KERN
  96. . endif
  97. . endif
  98. . endif
  99. _EXPORTED_VARS+= HAVE_COMPAT_IA32_KERN
  100. . if !defined(CONFIGURE_MAX_CMD_LEN)
  101. CONFIGURE_MAX_CMD_LEN!= ${SYSCTL} -n kern.argmax
  102. . endif
  103. _EXPORTED_VARS+= CONFIGURE_MAX_CMD_LEN
  104. . if !defined(_JAVA_VERSION_LIST_REGEXP)
  105. _JAVA_VERSION_LIST_REGEXP!= ${MAKE} -V _JAVA_VERSION_LIST_REGEXP USE_JAVA=1 -f ${PORTSDIR}/Mk/bsd.port.mk
  106. . endif
  107. _EXPORTED_VARS+= _JAVA_VERSION_LIST_REGEXP
  108. . if !defined(_JAVA_VENDOR_LIST_REGEXP)
  109. _JAVA_VENDOR_LIST_REGEXP!= ${MAKE} -V _JAVA_VENDOR_LIST_REGEXP USE_JAVA=1 -f ${PORTSDIR}/Mk/bsd.port.mk
  110. . endif
  111. _EXPORTED_VARS+= _JAVA_VENDOR_LIST_REGEXP
  112. . if !defined(_JAVA_OS_LIST_REGEXP)
  113. _JAVA_OS_LIST_REGEXP!= ${MAKE} -V _JAVA_OS_LIST_REGEXP USE_JAVA=1 -f ${PORTSDIR}/Mk/bsd.port.mk
  114. . endif
  115. _EXPORTED_VARS+= _JAVA_OS_LIST_REGEXP
  116. . if !defined(_JAVA_PORTS_INSTALLED)
  117. _JAVA_PORTS_INSTALLED!= ${MAKE} -V _JAVA_PORTS_INSTALLED USE_JAVA=1 -f ${PORTSDIR}/Mk/bsd.port.mk
  118. . endif
  119. _EXPORTED_VARS+= _JAVA_PORTS_INSTALLED
  120. UID?= ${.MAKE.UID}
  121. _EXPORTED_VARS+= UID
  122. .endif
  123. INDEXDIR?= ${PORTSDIR}
  124. INDEXFILE?= INDEX-${OSVERSION:C/([0-9]*)[0-9]{5}/\1/}
  125. # local customization of the ports tree
  126. .sinclude "${.CURDIR}/Makefile.local"
  127. TARGETS+= all
  128. TARGETS+= build
  129. TARGETS+= checksum
  130. TARGETS+= clean
  131. TARGETS+= clean-for-cdrom
  132. TARGETS+= clean-for-cdrom-list
  133. TARGETS+= clean-restricted
  134. TARGETS+= clean-restricted-list
  135. TARGETS+= configure
  136. TARGETS+= deinstall
  137. TARGETS+= depend
  138. TARGETS+= depends
  139. TARGETS+= distclean
  140. TARGETS+= extract
  141. TARGETS+= fetch
  142. TARGETS+= fetch-list
  143. TARGETS+= ignorelist
  144. TARGETS+= ignorelist-verbose
  145. TARGETS+= makesum
  146. TARGETS+= maintainer
  147. TARGETS+= package
  148. TARGETS+= package-recursive
  149. TARGETS+= realinstall
  150. TARGETS+= reinstall
  151. TARGETS+= tags
  152. .for __target in ${TARGETS}
  153. . if !target(${__target})
  154. . if defined(SUBDIR) && !empty(SUBDIR)
  155. ${__target}: ${SUBDIR:S/^/_/:S/$/.${__target}/}
  156. . else
  157. ${__target}:
  158. . endif
  159. . endif
  160. .endfor
  161. .if defined(SUBDIR) && !empty(SUBDIR)
  162. . for __target in ${TARGETS} checksubdirs describe readmes
  163. ${SUBDIR:S/^/_/:S/$/.${__target}/}: _SUBDIRUSE
  164. . endfor
  165. _SUBDIRUSE: .USE
  166. @OK=""; sub=${.TARGET:S/^_//:R}; \
  167. for dud in $$DUDS; do \
  168. if [ $${dud} = $$sub ]; then \
  169. OK="false"; \
  170. ${ECHO_MSG} "===> ${DIRPRFX}$$sub skipped"; \
  171. fi; \
  172. done; \
  173. if test -d ${.CURDIR}/$${sub}.${MACHINE_ARCH}; then \
  174. edir=$${sub}.${MACHINE_ARCH}; \
  175. elif test -d ${.CURDIR}/$${sub}; then \
  176. edir=$${sub}; \
  177. else \
  178. OK="false"; \
  179. ${ECHO_MSG} "===> ${DIRPRFX}$${sub} non-existent"; \
  180. fi; \
  181. if [ "$$OK" = "" ]; then \
  182. ${ECHO_MSG} "===> ${DIRPRFX}$${edir}"; \
  183. cd ${.CURDIR}/$${edir}; \
  184. ${MAKE} -B ${.TARGET:E:realinstall=install} \
  185. DIRPRFX=${DIRPRFX}$$edir/; \
  186. fi
  187. . for _subdir in ${SUBDIR:S/^/_/}
  188. ${_subdir}:: ${_subdir:S/$/.all/}
  189. . endfor
  190. .endif
  191. .if !target(install)
  192. . if !target(beforeinstall)
  193. beforeinstall:
  194. . endif
  195. . if !target(afterinstall)
  196. afterinstall:
  197. . endif
  198. install: afterinstall
  199. afterinstall: realinstall
  200. realinstall: beforeinstall ${SUBDIR:S/^/_/:S/$/.realinstall/}
  201. .endif
  202. IGNOREDIR= Mk Templates Tools distfiles packages pkg Keywords
  203. .if !target(checksubdirs)
  204. . if defined(PORTSTOP)
  205. checksubdirs: checksubdir ${SUBDIR:S/^/_/:S/$/.checksubdirs/}
  206. . else
  207. checksubdirs: checksubdir
  208. . endif
  209. .endif
  210. .if !target(checksubdir)
  211. checksubdir:
  212. @for d in *; do \
  213. if [ -d "$$d" ]; then \
  214. found=0; \
  215. for s in ${SUBDIR} ${IGNOREDIR}; do \
  216. if [ "x$$s" = "x$$d" ]; then \
  217. found=1; \
  218. break; \
  219. fi; \
  220. done; \
  221. if [ $$found = 0 ]; then \
  222. ${ECHO_MSG} "Warning: directory $$d not in SUBDIR"; \
  223. fi; \
  224. fi; \
  225. done
  226. @for s in ${SUBDIR}; do \
  227. if ! [ -d ${.CURDIR}/$$s ]; then \
  228. ${ECHO_MSG} "Warning: directory $$s in SUBDIR does not exist"; \
  229. fi \
  230. done
  231. .endif
  232. .if !target(describe)
  233. . if defined(PORTSTOP)
  234. # This is a bit convoluted to deal with the fact that make will overlap I/O from child make processes
  235. # if they write more than 2k: this will corrupt the INDEX file. make -P does not do this, but it adds
  236. # extraneous output and redirects stderr, so we lose error reporting from child makes. Instead we have
  237. # to roll our own implementation of make -P and make sure that each child make writes to their own file,
  238. # which we will combine at the end. This gives substantial performance benefits over doing a make -j1
  239. . if defined(BUILDING_INDEX)
  240. describe: ${SUBDIR:S/^/describe./}
  241. . for i in ${SUBDIR}
  242. describe.$i:
  243. @cd ${.CURDIR}; ${MAKE} -B ${i:S/^/_/:S/$/.describe/} > ${INDEX_TMPDIR}/${INDEXFILE}.desc.${i}
  244. . endfor
  245. . else
  246. describe: ${SUBDIR:S/^/_/:S/$/.describe/}
  247. . endif
  248. . else
  249. describe:
  250. @for sub in ${SUBDIR}; do \
  251. if ${TEST} -d ${.CURDIR}/$${sub}; then \
  252. ${ECHO_MSG} "===> ${DIRPRFX}$${sub}"; \
  253. cd ${.CURDIR}/$${sub}; \
  254. ${MAKE} -B describe || \
  255. (${ECHO_CMD} "===> ${DIRPRFX}$${sub} failed" >&2; \
  256. exit 1) ;\
  257. else \
  258. ${ECHO_MSG} "===> ${DIRPRFX}$${sub} non-existent"; \
  259. fi; \
  260. done
  261. . endif
  262. .endif
  263. # Store last subdir name
  264. _LAST_DIR = ${SUBDIR:[-1]}
  265. describe-json:
  266. @${ECHO_MSG} "{"
  267. @for sub in ${SUBDIR}; do \
  268. if ${TEST} -d ${.CURDIR}/$${sub}; then \
  269. cd ${.CURDIR}/$${sub}; \
  270. ${ECHO_MSG} "\"$${sub}\": " ;\
  271. ${MAKE} -B describe-json || \
  272. (${ECHO_CMD} "===> ${DIRPRFX}$${sub} failed" >&2; \
  273. exit 1) ;\
  274. if [ "$${sub}" != "${_LAST_DIR}" ]; then \
  275. (${ECHO_MSG} ",") ; \
  276. fi; \
  277. else \
  278. ${ECHO_MSG} "===> ${DIRPRFX}$${sub} non-existent"; \
  279. fi; \
  280. done
  281. @${ECHO_MSG} "}"
  282. .if !target(readmes)
  283. . if defined(PORTSTOP)
  284. readmes: readme ${SUBDIR:S/^/_/:S/$/.readmes/}
  285. @${ECHO_MSG} "===> Creating README.html for all ports"
  286. @perl ${PORTSDIR}/Tools/make_readmes < ${INDEXDIR}/${INDEXFILE}
  287. . else
  288. readmes: readme
  289. . endif
  290. .endif
  291. .if !target(readme)
  292. readme:
  293. @${RM} README.html
  294. @${MAKE} README.html
  295. .endif
  296. HTMLIFY= ${SED} -e 's/&/\&amp;/g' -e 's/>/\&gt;/g' -e 's/</\&lt;/g'
  297. package-name:
  298. @${ECHO_CMD} ${.CURDIR} | ${SED} -e 's^.*/^^'
  299. README.html:
  300. @${ECHO_CMD} "===> Creating README.html"
  301. @> $@.tmp
  302. .for entry in ${SUBDIR}
  303. . if exists(${entry})
  304. . if defined(PORTSTOP)
  305. @${ECHO_CMD} -n '<a href="'${entry}/README.html'">'"`${ECHO_CMD} ${entry} | ${HTMLIFY}`"'</a>: ' >> $@.tmp
  306. . else
  307. @${ECHO_CMD} -n '<a href="'${entry}/README.html'">'"`cd ${entry}; ${MAKE} package-name | ${HTMLIFY}`</a>: " >> $@.tmp
  308. . endif
  309. @${ECHO_CMD} `cd ${entry}; ${MAKE} -V COMMENT` | ${HTMLIFY} >> $@.tmp
  310. . endif
  311. .endfor
  312. @${SORT} -t '>' +1 -2 $@.tmp > $@.tmp2
  313. .if exists(${DESCR})
  314. @${HTMLIFY} ${DESCR} > $@.tmp3
  315. .else
  316. @> $@.tmp3
  317. .endif
  318. .if defined(COMMENT)
  319. @${ECHO_CMD} "${COMMENT}" | ${HTMLIFY} > $@.tmp4
  320. .else
  321. @> $@.tmp4
  322. .endif
  323. @${CAT} ${README} | \
  324. ${SED} -e 's/%%CATEGORY%%/'"`basename ${.CURDIR}`"'/g' \
  325. -e '/%%COMMENT%%/r$@.tmp4' \
  326. -e '/%%COMMENT%%/d' \
  327. -e '/%%DESCR%%/r$@.tmp3' \
  328. -e '/%%DESCR%%/d' \
  329. -e '/%%SUBDIR%%/r$@.tmp2' \
  330. -e '/%%SUBDIR%%/d' \
  331. > $@
  332. @${RM} $@.tmp $@.tmp2 $@.tmp3 $@.tmp4
  333. # Pass in the cached invariant variables to child makes.
  334. .if !defined(NOPRECIOUSMAKEVARS)
  335. . for var in ${_EXPORTED_VARS}
  336. . if empty(.MAKEFLAGS:M${var}=*) && !empty(${var})
  337. .MAKEFLAGS: ${var}=${${var}:Q}
  338. . endif
  339. . endfor
  340. .endif
  341. PORTSEARCH_DISPLAY_FIELDS?=name,path,info,maint,index,bdeps,rdeps,www
  342. PORTSEARCH_KEYLIM?=0
  343. PORTSEARCH_XKEYLIM?=0
  344. PORTSEARCH_IGNORECASE?=1
  345. PORTSEARCH_MOVED?=1
  346. _PORTSEARCH= \
  347. here=${.CURDIR}; \
  348. if [ ! -r ${INDEXDIR}/${INDEXFILE} ] ; then \
  349. ${ECHO_MSG} "The ${.TARGET} target requires ${INDEXFILE}. Please run make index or make fetchindex."; \
  350. else \
  351. cd ${PORTSDIR}; \
  352. if [ -z "$$key" -a -z "$$xkey" -a \
  353. -z "$$name" -a -z "$$xname" -a \
  354. -z "$$path" -a -z "$$xpath" -a \
  355. -z "$$info" -a -z "$$xinfo" -a \
  356. -z "$$maint" -a -z "$$xmaint" -a \
  357. -z "$$cat" -a -z "$$xcat" -a \
  358. -z "$$bdeps" -a -z "$$xbdeps" -a \
  359. -z "$$rdeps" -a -z "$$xrdeps" -a \
  360. -z "$$www" -a -z "$$xwww" ]; \
  361. then \
  362. ${ECHO_MSG} "The ${.TARGET} target requires a keyword parameter or name parameter,"; \
  363. ${ECHO_MSG} "e.g.: \"make ${.TARGET} key=somekeyword\""; \
  364. ${ECHO_MSG} "or \"make ${.TARGET} name=somekeyword\""; \
  365. exit; \
  366. fi; \
  367. ${AWK} -F\| -v there="$$here/" -v top="$$(pwd -P)" \
  368. -v key="$$key" -v xkey="$$xkey" \
  369. -v name="$$name" -v xname="$$xname" \
  370. -v path="$$path" -v xpath="$$xpath" \
  371. -v info="$$info" -v xinfo="$$xinfo" \
  372. -v maint="$$maint" -v xmaint="$$xmaint" \
  373. -v cat="$$cat" -v xcat="$$xcat" \
  374. -v bdeps="$$bdeps" -v xbdeps="$$xbdeps" \
  375. -v rdeps="$$rdeps" -v xrdeps="$$xrdeps" \
  376. -v www="$$www" -v xwww="$$xwww" \
  377. -v icase="$${icase:-${PORTSEARCH_IGNORECASE}}" \
  378. -v keylim="$${keylim:-${PORTSEARCH_KEYLIM}}" \
  379. -v xkeylim="$${xkeylim:-${PORTSEARCH_XKEYLIM}}" \
  380. -v display="$${display:-${PORTSEARCH_DISPLAY_FIELDS}}" \
  381. -v xdisplay="$$xdisplay" \
  382. 'BEGIN { \
  383. gsub(/\+/,"\\+",name); \
  384. if (substr(there, 1, length(top)) == top) \
  385. there = "${PORTSDIR}" substr(there, 1 + length(top)); \
  386. therelen = length(there); \
  387. keylen = length(key); keylim = keylim && keylen; \
  388. if (!keylim && keylen) \
  389. parms[0] = (icase ? tolower(key) : key); \
  390. xkeylen = length(xkey); xkeylim = xkeylim && xkeylen; \
  391. if (!xkeylim && xkeylen) \
  392. xparms[0] = (icase ? tolower(xkey) : xkey); \
  393. if (icase) { \
  394. if (length(name)) parms[1] = tolower(name); if (length(xname)) xparms[1] = tolower(xname); \
  395. if (length(path)) parms[2] = tolower(path); if (length(xpath)) xparms[2] = tolower(xpath); \
  396. if (length(info)) parms[4] = tolower(info); if (length(xinfo)) xparms[4] = tolower(xinfo); \
  397. if (length(maint)) parms[6] = tolower(maint); if (length(xmaint)) xparms[6] = tolower(xmaint); \
  398. if (length(cat)) parms[7] = tolower(cat); if (length(xcat)) xparms[7] = tolower(xcat); \
  399. if (length(bdeps)) parms[8] = tolower(bdeps); if (length(xbdeps)) xparms[8] = tolower(xbdeps); \
  400. if (length(rdeps)) parms[9] = tolower(rdeps); if (length(xrdeps)) xparms[9] = tolower(xrdeps); \
  401. if (length(www)) parms[10] = tolower(www); if (length(xwww)) xparms[10] = tolower(xwww); \
  402. } else { \
  403. if (length(name)) parms[1] = name; if (length(xname)) xparms[1] = xname; \
  404. if (length(path)) parms[2] = path; if (length(xpath)) xparms[2] = xpath; \
  405. if (length(info)) parms[4] = info; if (length(xinfo)) xparms[4] = xinfo; \
  406. if (length(maint)) parms[6] = maint; if (length(xmaint)) xparms[6] = xmaint; \
  407. if (length(cat)) parms[7] = cat; if (length(xcat)) xparms[7] = xcat; \
  408. if (length(bdeps)) parms[8] = bdeps; if (length(xbdeps)) xparms[8] = xbdeps; \
  409. if (length(rdeps)) parms[9] = rdeps; if (length(xrdeps)) xparms[9] = xrdeps; \
  410. if (length(www)) parms[10] = www; if (length(xwww)) xparms[10] = xwww; \
  411. } \
  412. fields["name"] = 1; names[1] = "Port"; \
  413. fields["path"] = 2; names[2] = "Path"; \
  414. fields["info"] = 4; names[4] = "Info"; \
  415. fields["maint"] = 6; names[6] = "Maint"; \
  416. fields["cat"] = 7; names[7] = "Index"; \
  417. fields["bdeps"] = 8; names[8] = "B-deps"; \
  418. fields["rdeps"] = 9; names[9] = "R-deps"; \
  419. fields["www"] = 10; names[10] = "WWW"; \
  420. split(display, d, /,[ \t]*/); \
  421. split(xdisplay, xd, /,[ \t]*/); \
  422. for (i in d) { \
  423. toprint = 1; \
  424. for (j in xd) { \
  425. if (d[i] == xd[j] ) { \
  426. toprint=0; \
  427. break; \
  428. }\
  429. } \
  430. if (toprint == 1 ) disp[fields[d[i]]] = 1; \
  431. } \
  432. } \
  433. { \
  434. if (match($$2, "^/usr/ports/[^/]*/[^/]*$$") > 0) \
  435. sub("^/usr/ports", "${PORTSDIR}", $$2); \
  436. if (substr($$2, 1, therelen) != there) \
  437. next; \
  438. for (i in parms) \
  439. if ((icase ? tolower($$i) : $$i) !~ parms[i]) \
  440. next; \
  441. for (i in xparms) \
  442. if ((icase ? tolower($$i) : $$i) ~ xparms[i]) \
  443. next; \
  444. found = 0; \
  445. for (i = 1; i < 11; i++) \
  446. if (i in disp) { \
  447. if (xkeylim && (icase ? tolower($$i) : $$i) ~ xkey) \
  448. next; \
  449. if (!found && keylim && (icase ? tolower($$i) : $$i) ~ key) \
  450. found = 1; \
  451. } \
  452. if (keylim && !found) \
  453. next; \
  454. for (i = 1; i < 11; i++) \
  455. if (i in disp) \
  456. printf("%s:\t%s\n", names[i], $$i); \
  457. print(""); \
  458. }' ${INDEXDIR}/${INDEXFILE}; \
  459. if [ "$$name" -o "$$xname" ] && [ ${PORTSEARCH_MOVED} -gt 0 ]; \
  460. then \
  461. ${AWK} -F\| -v name="$$name" -v xname="$$xname" \
  462. -v icase="$${icase:-${PORTSEARCH_IGNORECASE}}" \
  463. 'BEGIN { \
  464. if (icase) { \
  465. if (length(name)) name = tolower(name); if (length(xname)) xname = tolower(xname); \
  466. } \
  467. fields["name"] = 1; names[1] = "Port"; \
  468. fields["destination"] = 2; names[2] = "Moved"; \
  469. fields["date"] = 3; names[3] = "Date"; \
  470. fileds["reason"] = 4; names[4] = "Reason"; \
  471. } \
  472. { \
  473. oldname = $$1; newname = $$2; \
  474. if (oldname ~ /^\#/) next; \
  475. sub(".*\/", "", oldname); newname = sub(".*\/", "", newname); \
  476. if (((icase ? tolower(oldname) : oldname) ~ name) || \
  477. ((icase ? tolower(newname) : newname) ~ name)) { \
  478. for (i = 1; i <= 4; i++) { \
  479. printf("%s:\t%s\n", names[i], $$i); \
  480. } \
  481. print(""); \
  482. } \
  483. }' ${MOVEDDIR}/${MOVEDFILE}; \
  484. fi \
  485. fi
  486. search:
  487. @${_PORTSEARCH}
  488. quicksearch:
  489. @export display="name,path,info" ; \
  490. ${_PORTSEARCH}