Makefile 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. # $OpenBSD: Makefile,v 1.7 2017/06/07 23:34:02 brynet Exp $
  2. ONLY_FOR_ARCHS = amd64 arm hppa i386 mips64 mips64el powerpc sparc64
  3. DPB_PROPERTIES = parallel
  4. V = 6.3.0
  5. REVISION = 0
  6. FULL_VERSION = $V
  7. FULL_PKGVERSION = $V
  8. ADASTRAP_LIBC-amd64 = 89.2
  9. ADASTRAP_LIBM-amd64 = 10.0
  10. ADASTRAP-amd64 = adastrap-amd64-$V-0.tar.xz
  11. ADASTRAP_LIBC-arm = 88.0
  12. ADASTRAP_LIBM-arm = 9.0
  13. ADASTRAP-arm = adastrap-arm-4.9.4-0.tar.xz
  14. ADASTRAP_LIBC-hppa = 89.2
  15. ADASTRAP_LIBM-hppa = 10.0
  16. ADASTRAP-hppa = adastrap-hppa-$V-0.tar.xz
  17. ADASTRAP_LIBC-i386 = 89.2
  18. ADASTRAP_LIBM-i386 = 10.0
  19. ADASTRAP-i386 = adastrap-i386-$V-0.tar.xz
  20. ADASTRAP_LIBC-mips64 = 89.2
  21. ADASTRAP_LIBM-mips64 = 10.0
  22. ADASTRAP-mips64 = adastrap-mips64-$V-0.tar.xz
  23. ADASTRAP_LIBC-powerpc = 89.2
  24. ADASTRAP_LIBM-powerpc = 10.0
  25. ADASTRAP-powerpc = adastrap-powerpc-$V-0.tar.xz
  26. ADASTRAP_LIBC-sparc64 = 89.2
  27. ADASTRAP_LIBM-sparc64 = 10.0
  28. ADASTRAP-sparc64 = adastrap-sparc64-$V-0.tar.xz
  29. PKGNAME-main = gcc-${FULL_PKGVERSION}
  30. PKGNAME-libs = gcc-libs-${FULL_PKGVERSION}
  31. PKGNAME-c++ = g++-${FULL_PKGVERSION}
  32. PKGNAME-f95 = g95-${FULL_PKGVERSION}
  33. PKGNAME-java = gcj-${FULL_PKGVERSION}
  34. PKGNAME-objc = gobjc-${FULL_PKGVERSION}
  35. PKGNAME-ada = gnat-${FULL_PKGVERSION}
  36. PKGSPEC-main = gcc->=6,<7
  37. SHARED_LIBS = estdc++ 18.0 \
  38. gfortran 7.0 \
  39. gcj 5.0 \
  40. gcj-tools 5.0 \
  41. gij 5.0 \
  42. objc 7.0 \
  43. lto_plugin 4.0 \
  44. go 4.0 \
  45. itm 3.0 \
  46. atomic 2.0 \
  47. quadmath 2.0 \
  48. cilkrts 1.0 \
  49. cc1 0.0 \
  50. cc1plugin 0.0
  51. PSEUDO_FLAVORS = no_java no_ada full
  52. FLAVOR ?=
  53. ONLY_FOR_ARCHS-ada = amd64 hppa i386 mips64 powerpc sparc64
  54. ONLY_FOR_ARCHS-java = amd64 i386 sparc64
  55. MULTI_PACKAGES = -main -libs -f95 -objc -c++ -java -ada
  56. MAINTAINER = Pascal Stumpf <pascal@stumpf.co>
  57. .include <bsd.port.arch.mk>
  58. DISTNAME = gcc-${FULL_VERSION}
  59. DISTFILES = ${DISTNAME}.tar.bz2
  60. # there's no ecj-4.9.jar
  61. ECJ = ecj-4.5.jar
  62. SUPDISTFILES = ${ADASTRAP-amd64}:0 ${ADASTRAP-arm}:0 ${ADASTRAP-hppa}:0 \
  63. ${ADASTRAP-i386}:0 ${ADASTRAP-mips64}:0 ${ADASTRAP-powerpc}:0 \
  64. ${ADASTRAP-sparc64}:0 ${ECJ}:1
  65. EXTRACT_ONLY = ${DISTNAME}.tar.bz2
  66. BUILD_DEPENDS += devel/bison \
  67. devel/libexecinfo
  68. .if ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el"
  69. BUILD_DEPENDS += textproc/gsed
  70. .endif
  71. TEST_DEPENDS = devel/dejagnu \
  72. devel/autogen \
  73. ${BUILD_PKGPATH},-libs>=6,<7
  74. MASTER_SITES = ${MASTER_SITE_GCC:=releases/gcc-$(FULL_VERSION)/}
  75. MASTER_SITES0 = https://distfiles.stumpf.co/ \
  76. https://spacehopper.org/mirrors/ \
  77. http://distfiles.tmux.org/adastrap/ \
  78. https://distfiles.bsdfrog.org/
  79. MASTER_SITES1 = ftp://sources.redhat.com/pub/java/
  80. LANGS = c,c++,fortran,objc
  81. .if ${BUILD_PACKAGES:M-java}
  82. LANGS := ${LANGS},java
  83. DISTFILES += ${ECJ}:1
  84. BUILD_DEPENDS += archivers/zip>=2.3p0
  85. CONFIGURE_ARGS += --enable-libgcj --without-jar
  86. .endif
  87. .if ${BUILD_PACKAGES:M-ada}
  88. LANGS := ${LANGS},ada
  89. DISTFILES += ${ADASTRAP-${MACHINE_ARCH}}:0
  90. EXTRACT_ONLY += ${ADASTRAP-${MACHINE_ARCH}}
  91. EXTRA_ENV += ADAC=${WRKDIR}/bin/egcc GNATBIND=${WRKDIR}/bin/gnatbind
  92. CC = ${WRKDIR}/bin/egcc
  93. CXX = ${WRKDIR}/bin/eg++
  94. # make sure we link the right libestdc++.a in stage1 when using a bootstrap
  95. CONFIGURE_ARGS += --with-stage1-ldflags="-L${WRKDIR}/bootstrap/lib"
  96. TEST_DEPENDS += ${BUILD_PKGPATH},-ada
  97. .endif
  98. CONFIGURE_STYLE = gnu
  99. MODGNU_CONFIG_GUESS_DIRS = ${WRKSRC} ${WRKSRC}/gcc
  100. EXTRA_ENV += am_cv_func_iconv=no JAR=no
  101. EXTRA_ENV += ac_cv_prog_M4=/usr/bin/m4
  102. EXTRA_ENV += ac_cv_header_magic_h=no
  103. EXTRA_ENV += lt_cv_path_SED=/usr/bin/sed
  104. EXTRA_ENV += STRIP=/usr/bin/strip
  105. MAKE_FLAGS += ac_cv_path_mkdir=/bin/mkdir
  106. CONFIGURE_ENV += ${EXTRA_ENV}
  107. MAKE_ENV += ${EXTRA_ENV}
  108. # Note: the configure target passes CFLAGS to the configure script anyways.
  109. CFLAGS = -O2 -g
  110. CONFIGURE_ARGS += \
  111. --verbose \
  112. --program-transform-name=s,^,e, \
  113. --disable-nls \
  114. --with-system-zlib \
  115. --disable-libmudflap \
  116. --disable-libgomp \
  117. --disable-tls \
  118. --with-gnu-ld \
  119. --with-gnu-as \
  120. --enable-threads=posix \
  121. --enable-wchar_t \
  122. --with-gmp="${LOCALBASE}" \
  123. --enable-languages=${LANGS} \
  124. --disable-libstdcxx-pch \
  125. --enable-default-ssp \
  126. --enable-default-pie
  127. # This is needed, as internal cpp is no longer compatible with the
  128. # visible beast
  129. CONFIGURE_ARGS += --enable-cpp
  130. SEPARATE_BUILD = flavored
  131. USE_GMAKE = yes
  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. .for _a in ${ONLY_FOR_ARCHS}
  142. PKG_ARGS += -D${_a}=0
  143. .endfor
  144. PKG_ARGS += -D${MACHINE_ARCH}=1
  145. .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
  146. PKG_ARGS += -DX86=1
  147. .else
  148. PKG_ARGS += -DX86=0
  149. .endif
  150. .if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "arm" || \
  151. ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" || \
  152. ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sh" || \
  153. ${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64"
  154. PKG_ARGS += -DITM=1
  155. .else
  156. PKG_ARGS += -DITM=0
  157. .endif
  158. # depends on __float128
  159. .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
  160. PKG_ARGS += -DQUADMATH=1
  161. .else
  162. PKG_ARGS +=-DQUADMATH=0
  163. .endif
  164. .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
  165. PKG_ARGS += -DCILKRTS=1
  166. .else
  167. PKG_ARGS += -DCILKRTS=0
  168. .endif
  169. RUN_DEPENDS = ${BUILD_PKGPATH},-main
  170. WANTLIB = c gmp m mpc mpfr z
  171. RUN_DEPENDS-main = ${BUILD_PKGPATH},-libs
  172. RUN_DEPENDS-libs =
  173. WANTLIB-java = ${WANTLIB} pthread
  174. WANTLIB-main = ${WANTLIB}
  175. WANTLIB-ada = ${WANTLIB} pthread util
  176. WANTLIB-libs = m pthread
  177. LIB_DEPENDS += devel/gmp>=4.2 \
  178. devel/mpfr \
  179. devel/libmpc
  180. LIB_DEPENDS-libs =
  181. .if ${MACHINE_ARCH:Mamd64}
  182. CONFIG = x86_64-unknown-openbsd${OSREV}
  183. .endif
  184. post-extract:
  185. .for f in egcc eg++
  186. echo "#! /bin/sh" >${WRKDIR}/bin/$f
  187. echo 'GNAT_ROOT=${WRKDIR}/bootstrap GCC_ROOT=${WRKDIR}/bootstrap LD_LIBRARY_PATH=${WRKDIR}/bootstrap/system-libs exec ${WRKDIR}/bootstrap/bin/$f "$$@"' >>${WRKDIR}/bin/$f
  188. chmod a+x ${WRKDIR}/bin/$f
  189. .endfor
  190. .for f in gnatbind gnatmake gnatlink
  191. echo "#! /bin/sh" >${WRKDIR}/bin/$f
  192. echo 'GNAT_ROOT=${WRKDIR}/bootstrap GCC_ROOT=${WRKDIR}/bootstrap LD_LIBRARY_PATH=${WRKDIR}/bootstrap/system-libs exec ${WRKDIR}/bootstrap/bin/$f "$$@"' >>${WRKDIR}/bin/$f
  193. chmod a+x ${WRKDIR}/bin/$f
  194. .endfor
  195. rm -rf ${WRKDIR}/bootstrap/lib/gcc/*-unknown-openbsd*/$V/include-fixed
  196. ln -sf /usr/bin/nm ${WRKDIR}/bin/enm
  197. echo "# This file automatically generated" >> ${WRKSRC}/libversions
  198. .for l v in ${SHARED_LIBS}
  199. echo "LIB$l_LTVERSION = -version-info ${v:S/./:/}" >> \
  200. ${WRKSRC}/libversions
  201. .endfor
  202. .if ${BUILD_PACKAGES:M-java}
  203. cp ${FULLDISTDIR}/${ECJ} ${WRKSRC}/ecj.jar
  204. .endif
  205. .if ${BUILD_PACKAGES:M-ada}
  206. perl -pi -e 's,^#define (_GLIBCXX_HAVE_GETS) .*,/* #undef $$1 */,' \
  207. ${WRKDIR}/bootstrap/include/c++/*/*/bits/c++config.h
  208. .endif
  209. post-install:
  210. .if ${BUILD_PACKAGES:M-ada}
  211. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/adainclude
  212. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/adalib
  213. .endif
  214. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/include
  215. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/include-fixed
  216. chown ${BINOWN}:${BINGRP} ${PREFIX}/lib/gcc/${CONFIG}/${V}/libgcc.a
  217. chown ${BINOWN}:${BINGRP} ${PREFIX}/lib/gcc/${CONFIG}/${V}/libgcov.a
  218. .include <bsd.port.mk>
  219. ADA_PACKAGE = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME-ada}.tgz
  220. GCC_PACKAGE = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME-main}.tgz
  221. GXX_PACKAGE = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME-c++}.tgz
  222. adastrap: ${ADA_PACKAGE} ${GCC_PACKAGE} ${GXX_PACKAGE}
  223. .if !defined(ADASTRAP_LIBC-${MACHINE_ARCH}) || \
  224. !defined(ADASTRAP_LIBM-${MACHINE_ARCH})
  225. @echo 1>&2 "Error: you must specify libc and libm to bundle"
  226. @exit 1
  227. .else
  228. mkdir -p ${WRKDIR}/prepare/bootstrap/system-libs
  229. cp /usr/lib/libc.so.${ADASTRAP_LIBC-${MACHINE_ARCH}} \
  230. ${WRKDIR}/prepare/bootstrap/system-libs
  231. cp /usr/lib/libm.so.${ADASTRAP_LIBM-${MACHINE_ARCH}} \
  232. ${WRKDIR}/prepare/bootstrap/system-libs
  233. cd ${WRKDIR}/prepare/bootstrap && tar zxf ${ADA_PACKAGE}
  234. cd ${WRKDIR}/prepare/bootstrap && tar zxf ${GCC_PACKAGE}
  235. cd ${WRKDIR}/prepare/bootstrap && tar zxf ${GXX_PACKAGE}
  236. rm -rf ${WRKDIR}/prepare/bootstrap/{+*,info,man,share}
  237. rm -rf ${WRKDIR}/prepare/bootstrap/lib/gcc/*-unknown-openbsd*/$V/include-fixed
  238. if ! ldd ${WRKDIR}/prepare/bootstrap/bin/egcc | \
  239. fgrep libc.so.${ADASTRAP_LIBC-${MACHINE_ARCH}} >/dev/null; then \
  240. echo 1>&2 "Error: adastrap egcc linked against unbundled libc"; \
  241. exit 1; \
  242. fi
  243. if ! ldd ${WRKDIR}/prepare/bootstrap/bin/egcc | \
  244. fgrep libm.so.${ADASTRAP_LIBM-${MACHINE_ARCH}} >/dev/null; then \
  245. echo 1>&2 "Error: adastrap egcc linked against unbundled libm"; \
  246. exit 1; \
  247. fi
  248. cd ${WRKDIR}/prepare && tar cf - bootstrap | \
  249. xz > ${FULLDISTDIR}/${ADASTRAP-${MACHINE_ARCH}}
  250. .endif