Makefile 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. SUBDIR += accessibility
  2. SUBDIR += arabic
  3. SUBDIR += archivers
  4. SUBDIR += astro
  5. SUBDIR += audio
  6. SUBDIR += benchmarks
  7. SUBDIR += biology
  8. SUBDIR += cad
  9. SUBDIR += chinese
  10. SUBDIR += comms
  11. SUBDIR += converters
  12. SUBDIR += databases
  13. SUBDIR += deskutils
  14. SUBDIR += devel
  15. SUBDIR += dns
  16. SUBDIR += editors
  17. SUBDIR += emulators
  18. SUBDIR += finance
  19. SUBDIR += french
  20. SUBDIR += ftp
  21. SUBDIR += games
  22. SUBDIR += german
  23. SUBDIR += graphics
  24. SUBDIR += hebrew
  25. SUBDIR += hungarian
  26. SUBDIR += irc
  27. SUBDIR += japanese
  28. SUBDIR += java
  29. SUBDIR += korean
  30. SUBDIR += lang
  31. SUBDIR += mail
  32. SUBDIR += math
  33. SUBDIR += misc
  34. SUBDIR += multimedia
  35. SUBDIR += net
  36. SUBDIR += net-im
  37. SUBDIR += net-mgmt
  38. SUBDIR += net-p2p
  39. SUBDIR += news
  40. SUBDIR += polish
  41. SUBDIR += ports-mgmt
  42. SUBDIR += portuguese
  43. SUBDIR += print
  44. SUBDIR += russian
  45. SUBDIR += science
  46. SUBDIR += security
  47. SUBDIR += shells
  48. SUBDIR += sysutils
  49. SUBDIR += textproc
  50. SUBDIR += ukrainian
  51. SUBDIR += vietnamese
  52. SUBDIR += www
  53. SUBDIR += x11
  54. SUBDIR += x11-clocks
  55. SUBDIR += x11-drivers
  56. SUBDIR += x11-fm
  57. SUBDIR += x11-fonts
  58. SUBDIR += x11-servers
  59. SUBDIR += x11-themes
  60. SUBDIR += x11-toolkits
  61. SUBDIR += x11-wm
  62. PORTSTOP= yes
  63. .include <bsd.port.subdir.mk>
  64. index: ${INDEXDIR}/${INDEXFILE}
  65. INDEX_COMPRESSION_FORMAT?= xz
  66. .if ${INDEX_COMPRESSION_FORMAT} != xz && \
  67. ${INDEX_COMPRESSION_FORMAT} != bz2 && ${INDEX_COMPRESSION_FORMAT} != zst
  68. .error "Invalid compression format: ${INDEX_COMPRESSION_FORMAT}, expecting xz, bz2 or zst"
  69. .endif
  70. fetchindex: ${INDEXDIR}/${INDEXFILE}.${INDEX_COMPRESSION_FORMAT}
  71. @if bsdcat < ${INDEXDIR}/${INDEXFILE}.${INDEX_COMPRESSION_FORMAT} > ${INDEXDIR}/${INDEXFILE}.tmp ; then \
  72. chmod a+r ${INDEXDIR}/${INDEXFILE}.tmp; \
  73. ${MV} ${INDEXDIR}/${INDEXFILE}.tmp ${INDEXDIR}/${INDEXFILE}; \
  74. ${RM} ${INDEXDIR}/${INDEXFILE}.${INDEX_COMPRESSION_FORMAT} \
  75. else ; \
  76. ${RM} ${INDEXDIR}/${INDEXFILE}.tmp ; \
  77. fi
  78. ${INDEXDIR}/${INDEXFILE}.${INDEX_COMPRESSION_FORMAT}: .PHONY
  79. ${FETCHINDEX} ${INDEXDIR}/${INDEXFILE}.${INDEX_COMPRESSION_FORMAT} \
  80. ${MASTER_SITE_INDEX}${INDEXFILE}.${INDEX_COMPRESSION_FORMAT}
  81. MASTER_SITE_INDEX?= https://download.FreeBSD.org/ports/index/
  82. SETENV?= /usr/bin/env
  83. FETCHINDEX?= ${SETENV} ${FETCH_ENV} fetch -am -o
  84. .if !defined(INDEX_JOBS)
  85. INDEX_JOBS!= ${SYSCTL} -n kern.smp.cpus
  86. .endif
  87. .if !defined(INDEX_VERBOSE)
  88. INDEX_ECHO_MSG= true
  89. INDEX_ECHO_1ST= echo -n
  90. .else
  91. INDEX_ECHO_MSG= echo 1>&2
  92. INDEX_ECHO_1ST= echo
  93. .endif
  94. # /rescue/sh is statically linked and much faster to execute than the
  95. # dynamically linked /bin/sh. This is significant for targets like
  96. # make index that execute the shell tens of thousands of times.
  97. .if exists(/rescue/sh)
  98. INDEX_SHELL= /rescue/sh
  99. .else
  100. INDEX_SHELL= /bin/sh
  101. .endif
  102. .if !defined(INDEX_PORTS)
  103. INDEX_PORTS=.
  104. .endif
  105. .if exists(/usr/libexec/make_index)
  106. MAKE_INDEX= /usr/libexec/make_index /dev/stdin
  107. .else
  108. MAKE_INDEX= perl ${.CURDIR}/Tools/make_index
  109. .endif
  110. ${INDEXDIR}/${INDEXFILE}: .PHONY
  111. @${INDEX_ECHO_1ST} "Generating ${INDEXFILE} - please wait.."; \
  112. if [ "${INDEX_PRISTINE}" != "" ]; then \
  113. export LOCALBASE=/nonexistentlocal; \
  114. fi; \
  115. tmpdir=`/usr/bin/mktemp -d -t index` || exit 1; \
  116. trap "rm -rf $${tmpdir}; exit 1" 1 2 3 5 10 13 15; \
  117. ( cd ${.CURDIR}; for i in ${INDEX_PORTS}; do (cd $${i} && ${MAKE} -j${INDEX_JOBS} INDEX_TMPDIR=$${tmpdir} BUILDING_INDEX=1 \
  118. __MAKE_SHELL=${INDEX_SHELL} \
  119. ECHO_MSG="${INDEX_ECHO_MSG}" describe); done ) || \
  120. (rm -rf $${tmpdir} ; \
  121. if [ "${INDEX_QUIET}" = "" ]; then \
  122. echo; \
  123. echo "********************************************************************"; \
  124. echo "Before reporting this error, verify that you are running a supported"; \
  125. echo "version of FreeBSD (see https://www.FreeBSD.org/ports/) and that you"; \
  126. echo "have a complete and up-to-date ports collection. (INDEX builds are"; \
  127. echo "not supported with partial or out-of-date ports collections."; \
  128. echo "If that is the case, then"; \
  129. echo "report the failure to ports@FreeBSD.org together with relevant"; \
  130. echo "details of your ports configuration (including FreeBSD version,"; \
  131. echo "your architecture, your environment, and your /etc/make.conf"; \
  132. echo "settings, especially compiler flags and OPTIONS_SET/UNSET settings)."; \
  133. echo; \
  134. echo "Note: the latest pre-generated version of INDEX may be fetched"; \
  135. echo "automatically with \"make fetchindex\"."; \
  136. echo "********************************************************************"; \
  137. echo; \
  138. fi; \
  139. exit 1); \
  140. cat $${tmpdir}/${INDEXFILE}.desc.* | \
  141. sed -e 's|${.CURDIR}|${PORTSDIR}|g' | \
  142. (cd ${.CURDIR} ; ${MAKE_INDEX}) | \
  143. sed -e 's/ */ /g' -e 's/| */|/g' -e 's/ *|/|/g' -e 's./..g' | \
  144. sort -t '|' -k 2,3 | \
  145. sed -Ee 's../.g' -e ':a' -e 's|/[^/]+/\.\.||; ta' \
  146. -e 's|${PORTSDIR}|/usr/ports|g' \
  147. -e 's|${.CURDIR}|/usr/ports|g' > ${INDEXDIR}/${INDEXFILE}.tmp; \
  148. if [ "${INDEX_PRISTINE}" != "" ]; then \
  149. sed -e "s,$${LOCALBASE},/usr/local," ${INDEXDIR}/${INDEXFILE}.tmp > ${INDEXDIR}/${INDEXFILE}; \
  150. else \
  151. mv ${INDEXDIR}/${INDEXFILE}.tmp ${INDEXDIR}/${INDEXFILE}; \
  152. fi; \
  153. rm -rf $${tmpdir}; \
  154. echo " Done."
  155. print-index: ${INDEXDIR}/${INDEXFILE}
  156. @awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\nE-deps:\t%s\nP-deps:\t%s\nF-deps:\t%s\nWWW:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$11, $$12, $$13, $$10); }' < ${INDEXDIR}/${INDEXFILE}
  157. GIT?= git
  158. .if !defined(SVN) || empty(SVN)
  159. . for _P in /usr/bin /usr/local/bin
  160. . for _S in svn svnlite
  161. . if exists(${_P}/${_S})
  162. SVN= ${_P}/${_S}
  163. . endif
  164. . endfor
  165. . endfor
  166. .endif
  167. RSYNC?= rsync
  168. PORTSNAP?= portsnap
  169. PORTSNAP_FLAGS?= -p ${.CURDIR}
  170. .if !target(update)
  171. update:
  172. .if exists(${.CURDIR}/.svn)
  173. @echo "--------------------------------------------------------------"
  174. @echo ">>> Updating ${.CURDIR} using Subversion"
  175. @echo "--------------------------------------------------------------"
  176. cd ${.CURDIR}; ${SVN} update
  177. .elif exists(${.CURDIR}/.git)
  178. . if exists(${.CURDIR}/.git/svn)
  179. @echo "--------------------------------------------------------------"
  180. @echo ">>> Updating ${.CURDIR} from git+svn repository"
  181. @echo "--------------------------------------------------------------"
  182. cd ${.CURDIR}; ${GIT} svn rebase
  183. . else
  184. @echo "--------------------------------------------------------------"
  185. @echo ">>> Updating ${.CURDIR} from git repository"
  186. @echo "--------------------------------------------------------------"
  187. cd ${.CURDIR}; ${GIT} pull --rebase
  188. . endif
  189. .elif defined(RSYNC_UPDATE) && defined(PORTS_RSYNC_SOURCE)
  190. @echo "--------------------------------------------------------------"
  191. @echo ">>> Updating with ${RSYNC} from ${PORTS_RSYNC_SOURCE}"
  192. @echo "--------------------------------------------------------------"
  193. @${RSYNC} ${RSYNC_FLAGS} ${PORTS_RSYNC_SOURCE}/ ${.CURDIR}/
  194. .else
  195. @echo "--------------------------------------------------------------"
  196. @echo ">>> Running ${PORTSNAP}"
  197. @echo "--------------------------------------------------------------"
  198. .if !exists(${PORTSDIR}/.portsnap.INDEX)
  199. @echo "Error: 'make update' uses portsnap(8) by default and"
  200. @echo "needs ${PORTSDIR} to be created by portsnap on its first run."
  201. @echo "Please run 'portsnap fetch extract' first."
  202. .else
  203. @${PORTSNAP} ${PORTSNAP_FLAGS} fetch
  204. @${PORTSNAP} ${PORTSNAP_FLAGS} update
  205. .endif
  206. .endif
  207. .endif