Makefile 7.4 KB

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