Makefile 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. # no RCS ID, please
  2. #ONLY_FOR_ARCHS = alpha amd64 hppa i386 powerpc sparc64
  3. # ignore arches that have a valid 4.8 port
  4. ONLY_FOR_ARCHS = alpha
  5. DPB_PROPERTIES = parallel
  6. V = 4.6.4
  7. FULL_VERSION = $V
  8. FULL_PKGVERSION = $V
  9. ADASTRAP_LIBC-i386 = 73.0
  10. ADASTRAP-i386 = adastrap-i386-$V-4.tar.xz
  11. ADASTRAP_LIBC-amd64 = 73.0
  12. ADASTRAP-amd64 = adastrap-amd64-$V-4.tar.xz
  13. ADASTRAP_LIBC-sparc64 = 73.0
  14. ADASTRAP-sparc64 = adastrap-sparc64-$V-4.tar.xz
  15. ADASTRAP_LIBC-hppa = 74.1
  16. ADASTRAP-hppa = adastrap-hppa-$V-4.tar.xz
  17. ADASTRAP_LIBC-alpha = 74.0
  18. ADASTRAP-alpha = adastrap-alpha-$V-4.tar.xz
  19. PKGNAME-main = gcc-${FULL_PKGVERSION}
  20. PKGNAME-c++ = g++-${FULL_PKGVERSION}
  21. PKGNAME-estdc = libstdc++-${FULL_PKGVERSION}
  22. PKGNAME-f95 = g95-${FULL_PKGVERSION}
  23. PKGNAME-java = gcj-${FULL_PKGVERSION}
  24. PKGNAME-objc = gobjc-${FULL_PKGVERSION}
  25. PKGNAME-ada = gnat-${FULL_PKGVERSION}
  26. PKGNAME-go = gccgo-${FULL_PKGVERSION}
  27. PKGSPEC-main = gcc->=4.6,<4.7
  28. REVISION = 11
  29. SHARED_LIBS = estdc++ 14.0 \
  30. gfortran 3.0 \
  31. gcj 1.0 \
  32. gcj-tools 1.0 \
  33. gij 1.0 \
  34. objc 3.0 \
  35. ssp 1.0 \
  36. lto_plugin 0.0 \
  37. go 0.0
  38. PSEUDO_FLAVORS = no_c++ no_f95 no_objc no_java no_ada no_go full
  39. FLAVOR ?=
  40. ONLY_FOR_ARCHS-ada = i386 amd64 sparc64 hppa alpha
  41. ONLY_FOR_ARCHS-java = amd64 i386 sparc64
  42. NOT_FOR_ARCHS-go = alpha hppa mips64el
  43. MULTI_PACKAGES = -main -f95 -objc -java -c++ -estdc -ada -go
  44. .include "Makefile.inc"
  45. .include <bsd.port.arch.mk>
  46. # kill both C++ subpackages
  47. .if !${BUILD_PACKAGES:M-c++}
  48. BUILD_PACKAGES := ${BUILD_PACKAGES:N-estdc}
  49. .endif
  50. DISTNAME = gcc-${FULL_VERSION}
  51. DISTFILES = ${DISTNAME}.tar.bz2
  52. # there's no ecj-4.6.jar
  53. ECJ = ecj-4.5.jar
  54. SUPDISTFILES = ${ADASTRAP-i386}:0 ${ADASTRAP-amd64}:0 ${ADASTRAP-sparc64}:0 \
  55. ${ADASTRAP-hppa}:0 ${ADASTRAP-alpha}:0 ${ECJ}:1
  56. EXTRACT_ONLY = ${DISTNAME}.tar.bz2
  57. BUILD_DEPENDS += devel/bison \
  58. devel/libexecinfo
  59. TEST_DEPENDS = devel/dejagnu \
  60. devel/autogen
  61. MASTER_SITES = ${MASTER_SITE_GCC:=releases/gcc-$(FULL_VERSION)/}
  62. MASTER_SITES0 = http://spacehopper.org/mirrors/ http://distfiles.tmux.org/adastrap/
  63. MASTER_SITES1 = ftp://sources.redhat.com/pub/java/
  64. LANGS = c
  65. .if ${BUILD_PACKAGES:M-c++}
  66. LANGS := ${LANGS},c++
  67. TEST_DEPENDS += ${BUILD_PKGPATH},-estdc>=4.6,<4.7
  68. .endif
  69. .if ${BUILD_PACKAGES:M-f95}
  70. LANGS := ${LANGS},fortran
  71. .endif
  72. .if ${BUILD_PACKAGES:M-objc}
  73. LANGS := ${LANGS},objc
  74. .endif
  75. .if ${BUILD_PACKAGES:M-java}
  76. LANGS := ${LANGS},java
  77. DISTFILES += ${ECJ}:1
  78. BUILD_DEPENDS += archivers/zip>=2.3p0
  79. CONFIGURE_ARGS += --enable-libgcj --without-jar
  80. .endif
  81. .if ${BUILD_PACKAGES:M-ada}
  82. LANGS := ${LANGS},ada
  83. DISTFILES += ${ADASTRAP-${MACHINE_ARCH}}:0
  84. EXTRACT_ONLY += ${ADASTRAP-${MACHINE_ARCH}}
  85. EXTRA_ENV += ADAC=${WRKDIR}/bin/egcc GNATBIND=${WRKDIR}/bin/gnatbind
  86. . if ${MACHINE_ARCH} == "alpha"
  87. # ICE in combine.c on alpha at -O2
  88. EXTRA_ENV += ADA_CFLAGS="-O1"
  89. . endif
  90. CC = ${WRKDIR}/bin/egcc
  91. TEST_DEPENDS += ${BUILD_PKGPATH},-ada
  92. .endif
  93. .if ${BUILD_PACKAGES:M-go}
  94. LANGS := ${LANGS},go
  95. .endif
  96. CONFIGURE_STYLE = gnu
  97. MODGNU_CONFIG_GUESS_DIRS = ${WRKSRC} ${WRKSRC}/gcc
  98. EXTRA_ENV += am_cv_func_iconv=no JAR=no
  99. EXTRA_ENV += ac_cv_prog_M4=/usr/bin/m4
  100. EXTRA_ENV += ac_cv_header_magic_h=no
  101. EXTRA_ENV += lt_cv_path_SED=/usr/bin/sed
  102. EXTRA_ENV += STRIP=/usr/bin/strip
  103. MAKE_FLAGS += ac_cv_path_mkdir=/bin/mkdir
  104. CONFIGURE_ENV += ${EXTRA_ENV}
  105. MAKE_ENV += ${EXTRA_ENV}
  106. # Note: the configure target passes CFLAGS to the configure script anyways.
  107. CFLAGS = -O2
  108. CONFIGURE_ARGS += \
  109. --verbose \
  110. --program-transform-name=s,^,e, \
  111. --disable-nls \
  112. --disable-checking \
  113. --with-system-zlib \
  114. --disable-libmudflap \
  115. --disable-libgomp \
  116. --disable-tls \
  117. --with-as=/usr/bin/as \
  118. --with-ld=/usr/bin/ld \
  119. --with-gnu-ld \
  120. --with-gnu-as \
  121. --enable-threads=posix \
  122. --enable-wchar_t \
  123. --with-gmp="${LOCALBASE}" \
  124. --disable-libstdcxx-pch \
  125. --enable-languages=${LANGS}
  126. # This is needed, as internal cpp is no longer compatible with the
  127. # visible beast
  128. CONFIGURE_ARGS += --enable-cpp
  129. SEPARATE_BUILD = flavored
  130. USE_GMAKE = yes
  131. MAKE_FLAGS += --print-directory
  132. .if ${FLAVOR:Mfull}
  133. # you shouldn't skip bootstrap unless you know what you're doing
  134. # use bootstrap-lean if you're pressed for space
  135. ALL_TARGET = bootstrap
  136. .else
  137. # skip the stage2/stage3 bullshit under normal circumstances
  138. ALL_TARGET = bootstrap2
  139. .endif
  140. MAKE_FLAGS += libstdc___la_LDFLAGS='-version-info 31:0:0 -lm'
  141. .if ${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "amd64"
  142. PIC = 1
  143. PKG_ARGS += -DPIC=1
  144. .else
  145. PIC = 0
  146. PKG_ARGS += -DPIC=0
  147. .endif
  148. .if ${MACHINE_ARCH} == "powerpc"
  149. PKG_ARGS += -DPPC=1
  150. .else
  151. PKG_ARGS += -DPPC=0
  152. .endif
  153. .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
  154. PKG_ARGS += -DI386=1
  155. .else
  156. PKG_ARGS += -DI386=0
  157. .endif
  158. RUN_DEPENDS = ${BUILD_PKGPATH},-main
  159. WANTLIB = c gmp m mpc mpfr z
  160. RUN_DEPENDS-main =
  161. RUN_DEPENDS-estdc =
  162. RUN_DEPENDS-c++ = ${RUN_DEPENDS} \
  163. ${BUILD_PKGPATH},-estdc>=4.6,<4.7
  164. RUN_DEPENDS-ada = ${FULLPKGNAME-main}:${BUILD_PKGPATH}
  165. WANTLIB-estdc = m
  166. WANTLIB-f95 = ${WANTLIB}
  167. WANTLIB-java = ${WANTLIB} pthread
  168. WANTLIB-go = ${WANTLIB} pthread
  169. LIB_DEPENDS += devel/gmp>=4.2 \
  170. devel/mpfr \
  171. devel/libmpc
  172. LIB_DEPENDS-estdc =
  173. .if ${MACHINE_ARCH:Mamd64}
  174. CONFIG = x86_64-unknown-openbsd${OSREV}
  175. .endif
  176. post-extract:
  177. .for f in egcc gnatbind gnatmake gnatlink
  178. echo "#! /bin/sh" >${WRKDIR}/bin/$f
  179. echo 'GNAT_ROOT=${WRKDIR}/bootstrap GCC_ROOT=${WRKDIR}/bootstrap LD_LIBRARY_PATH=${WRKDIR}/bootstrap/system-libs exec ${WRKDIR}/bootstrap/bin/$f "$$@"' >>${WRKDIR}/bin/$f
  180. chmod a+x ${WRKDIR}/bin/$f
  181. .endfor
  182. rm -rf ${WRKDIR}/bootstrap/lib/gcc/*-unknown-openbsd*/$V/include-fixed
  183. ln -sf /usr/bin/nm ${WRKDIR}/bin/enm
  184. echo "# This file automatically generated" >> ${WRKSRC}/libversions
  185. .for l v in ${SHARED_LIBS}
  186. echo "LIB$l_LTVERSION = -version-info ${v:S/./:/}" >> \
  187. ${WRKSRC}/libversions
  188. .endfor
  189. .if ${BUILD_PACKAGES:M-java}
  190. cp ${FULLDISTDIR}/${ECJ} ${WRKSRC}/ecj.jar
  191. .endif
  192. post-install:
  193. .if ${BUILD_PACKAGES:M-ada}
  194. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/adainclude
  195. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/adalib
  196. .endif
  197. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/include
  198. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/include-fixed
  199. chown ${BINOWN}:${BINGRP} ${PREFIX}/lib/gcc/${CONFIG}/${V}/libgcc.a
  200. chown ${BINOWN}:${BINGRP} ${PREFIX}/lib/gcc/${CONFIG}/${V}/libgcov.a
  201. .if ${PIC} == "1"
  202. chown ${BINOWN}:${BINGRP} ${PREFIX}/lib/gcc/${CONFIG}/${V}/fpic/libgcc.a
  203. chown ${BINOWN}:${BINGRP} \
  204. ${PREFIX}/lib/gcc/${CONFIG}/${V}/fpic/libgcov.a
  205. .endif
  206. .include <bsd.port.mk>
  207. ADA_PACKAGE = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME-ada}.tgz
  208. GCC_PACKAGE = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME-main}.tgz
  209. adastrap: ${ADA_PACKAGE} ${GCC_PACKAGE}
  210. .if !defined(ADASTRAP_LIBC-${MACHINE_ARCH})
  211. @echo 1>&2 "Error: you must specify a libc to bundle"
  212. @exit 1
  213. .else
  214. mkdir -p ${WRKDIR}/prepare/bootstrap/system-libs
  215. cp /usr/lib/libc.so.${ADASTRAP_LIBC-${MACHINE_ARCH}} \
  216. ${WRKDIR}/prepare/bootstrap/system-libs
  217. cd ${WRKDIR}/prepare/bootstrap && tar zxf ${ADA_PACKAGE}
  218. cd ${WRKDIR}/prepare/bootstrap && tar zxf ${GCC_PACKAGE}
  219. rm -rf ${WRKDIR}/prepare/bootstrap/{+*,info,man}
  220. rm -rf ${WRKDIR}/prepare/bootstrap/lib/gcc/*-unknown-openbsd*/$V/include-fixed
  221. if ! ldd ${WRKDIR}/prepare/bootstrap/bin/egcc | \
  222. fgrep libc.so.${ADASTRAP_LIBC-${MACHINE_ARCH}} >/dev/null; then \
  223. echo 1>&2 "Error: adastrap egcc linked against wrong libc"; \
  224. exit 1; \
  225. fi
  226. cd ${WRKDIR}/prepare && tar cf - bootstrap | \
  227. xz > ${FULLDISTDIR}/${ADASTRAP-${MACHINE_ARCH}}
  228. .endif