Makefile 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. # $OpenBSD: Makefile,v 1.48 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 = 4.9.4
  5. REVISION = 5
  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-1.tar.xz
  11. ADASTRAP_LIBC-arm = 88.0
  12. ADASTRAP_LIBM-arm = 9.0
  13. ADASTRAP-arm = adastrap-arm-$V-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-1.tar.xz
  20. ADASTRAP_LIBC-mips64 = 89.2
  21. ADASTRAP_LIBM-mips64 = 10.0
  22. ADASTRAP-mips64 = adastrap-mips64-$V-1.tar.xz
  23. ADASTRAP_LIBC-powerpc = 89.2
  24. ADASTRAP_LIBM-powerpc = 10.0
  25. ADASTRAP-powerpc = adastrap-powerpc-$V-1.tar.xz
  26. ADASTRAP_LIBC-sparc64 = 89.2
  27. ADASTRAP_LIBM-sparc64 = 10.0
  28. ADASTRAP-sparc64 = adastrap-sparc64-$V-1.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->=4.9,<4.10
  37. SHARED_LIBS = estdc++ 17.1 \
  38. gfortran 6.1 \
  39. gcj 4.1 \
  40. gcj-tools 4.0 \
  41. gij 4.1 \
  42. objc 6.1 \
  43. lto_plugin 3.1 \
  44. go 3.0 \
  45. itm 2.1 \
  46. atomic 1.1 \
  47. quadmath 1.1 \
  48. cilkrts 0.1
  49. PSEUDO_FLAVORS = no_java no_ada full
  50. FLAVOR ?=
  51. ONLY_FOR_ARCHS-ada = amd64 hppa i386 mips64 powerpc sparc64
  52. ONLY_FOR_ARCHS-java = amd64 i386 sparc64
  53. MULTI_PACKAGES = -main -libs -f95 -objc -c++ -java -ada
  54. MAINTAINER = Pascal Stumpf <pascal@stumpf.co>
  55. .include <bsd.port.arch.mk>
  56. DISTNAME = gcc-${FULL_VERSION}
  57. DISTFILES = ${DISTNAME}.tar.bz2
  58. # there's no ecj-4.9.jar
  59. ECJ = ecj-4.5.jar
  60. SUPDISTFILES = ${ADASTRAP-amd64}:0 ${ADASTRAP-arm}:0 ${ADASTRAP-hppa}:0 \
  61. ${ADASTRAP-i386}:0 ${ADASTRAP-mips64}:0 ${ADASTRAP-powerpc}:0 \
  62. ${ADASTRAP-sparc64}:0 ${ECJ}:1
  63. EXTRACT_ONLY = ${DISTNAME}.tar.bz2
  64. BUILD_DEPENDS += devel/bison \
  65. devel/libexecinfo
  66. .if ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el"
  67. BUILD_DEPENDS += textproc/gsed
  68. .endif
  69. TEST_DEPENDS = devel/dejagnu \
  70. devel/autogen \
  71. ${BUILD_PKGPATH},-libs>=4.9,<4.10
  72. MASTER_SITES = ${MASTER_SITE_GCC:=releases/gcc-$(FULL_VERSION)/}
  73. MASTER_SITES0 = https://distfiles.stumpf.co/ \
  74. https://spacehopper.org/mirrors/ \
  75. http://distfiles.tmux.org/adastrap/ \
  76. https://distfiles.bsdfrog.org/
  77. MASTER_SITES1 = ftp://sources.redhat.com/pub/java/
  78. LANGS = c,c++,fortran,objc
  79. .if ${BUILD_PACKAGES:M-java}
  80. LANGS := ${LANGS},java
  81. DISTFILES += ${ECJ}:1
  82. BUILD_DEPENDS += archivers/zip>=2.3p0
  83. CONFIGURE_ARGS += --enable-libgcj --without-jar
  84. .endif
  85. .if ${BUILD_PACKAGES:M-ada}
  86. LANGS := ${LANGS},ada
  87. DISTFILES += ${ADASTRAP-${MACHINE_ARCH}}:0
  88. EXTRACT_ONLY += ${ADASTRAP-${MACHINE_ARCH}}
  89. EXTRA_ENV += ADAC=${WRKDIR}/bin/egcc GNATBIND=${WRKDIR}/bin/gnatbind
  90. CC = ${WRKDIR}/bin/egcc
  91. CXX = ${WRKDIR}/bin/eg++
  92. TEST_DEPENDS += ${BUILD_PKGPATH},-ada
  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 -g
  106. CONFIGURE_ARGS += \
  107. --verbose \
  108. --program-transform-name=s,^,e, \
  109. --disable-nls \
  110. --with-system-zlib \
  111. --disable-libmudflap \
  112. --disable-libgomp \
  113. --disable-tls \
  114. --with-gnu-ld \
  115. --with-gnu-as \
  116. --enable-threads=posix \
  117. --enable-wchar_t \
  118. --with-gmp="${LOCALBASE}" \
  119. --enable-languages=${LANGS} \
  120. --disable-libstdcxx-pch
  121. # This is needed, as internal cpp is no longer compatible with the
  122. # visible beast
  123. CONFIGURE_ARGS += --enable-cpp
  124. SEPARATE_BUILD = flavored
  125. USE_GMAKE = yes
  126. .if ${FLAVOR:Mfull}
  127. # you shouldn't skip bootstrap unless you know what you're doing
  128. # use bootstrap-lean if you're pressed for space
  129. ALL_TARGET = bootstrap
  130. .else
  131. # skip the stage2/stage3 bullshit under normal circumstances
  132. ALL_TARGET = bootstrap2
  133. .endif
  134. MAKE_FLAGS += libstdc___la_LDFLAGS='-version-info 31:0:0 -lm'
  135. .for _a in ${ONLY_FOR_ARCHS}
  136. PKG_ARGS += -D${_a}=0
  137. .endfor
  138. PKG_ARGS += -D${MACHINE_ARCH}=1
  139. .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
  140. PKG_ARGS += -DX86=1
  141. .else
  142. PKG_ARGS += -DX86=0
  143. .endif
  144. .if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "arm" || \
  145. ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" || \
  146. ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sh" || \
  147. ${MACHINE_ARCH} == "sparc64"
  148. PKG_ARGS += -DITM=1
  149. .else
  150. PKG_ARGS += -DITM=0
  151. .endif
  152. # depends on __float128
  153. .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
  154. PKG_ARGS += -DQUADMATH=1
  155. .else
  156. PKG_ARGS +=-DQUADMATH=0
  157. .endif
  158. .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
  159. PKG_ARGS += -DCILKRTS=1
  160. .else
  161. PKG_ARGS += -DCILKRTS=0
  162. .endif
  163. RUN_DEPENDS = ${BUILD_PKGPATH},-main
  164. WANTLIB = c gmp m mpc mpfr z
  165. RUN_DEPENDS-main = ${BUILD_PKGPATH},-libs
  166. RUN_DEPENDS-libs =
  167. WANTLIB-java = ${WANTLIB} pthread
  168. WANTLIB-main = ${WANTLIB}
  169. WANTLIB-ada = ${WANTLIB} pthread util
  170. WANTLIB-libs = m pthread
  171. LIB_DEPENDS += devel/gmp>=6.1.1 \
  172. devel/mpfr \
  173. devel/libmpc
  174. LIB_DEPENDS-libs =
  175. .if ${MACHINE_ARCH:Mamd64}
  176. CONFIG = x86_64-unknown-openbsd${OSREV}
  177. .endif
  178. post-extract:
  179. .for f in egcc eg++
  180. echo "#! /bin/sh" >${WRKDIR}/bin/$f
  181. echo 'GNAT_ROOT=${WRKDIR}/bootstrap GCC_ROOT=${WRKDIR}/bootstrap LD_LIBRARY_PATH=${WRKDIR}/bootstrap/system-libs exec ${WRKDIR}/bootstrap/bin/$f "$$@"' >>${WRKDIR}/bin/$f
  182. chmod a+x ${WRKDIR}/bin/$f
  183. .endfor
  184. .for f in gnatbind gnatmake gnatlink
  185. echo "#! /bin/sh" >${WRKDIR}/bin/$f
  186. echo 'GNAT_ROOT=${WRKDIR}/bootstrap GCC_ROOT=${WRKDIR}/bootstrap LD_LIBRARY_PATH=${WRKDIR}/bootstrap/system-libs exec ${WRKDIR}/bootstrap/bin/$f "$$@"' >>${WRKDIR}/bin/$f
  187. chmod a+x ${WRKDIR}/bin/$f
  188. .endfor
  189. rm -rf ${WRKDIR}/bootstrap/lib/gcc/*-unknown-openbsd*/$V/include-fixed
  190. ln -sf /usr/bin/nm ${WRKDIR}/bin/enm
  191. echo "# This file automatically generated" >> ${WRKSRC}/libversions
  192. .for l v in ${SHARED_LIBS}
  193. echo "LIB$l_LTVERSION = -version-info ${v:S/./:/}" >> \
  194. ${WRKSRC}/libversions
  195. .endfor
  196. .if ${BUILD_PACKAGES:M-java}
  197. cp ${FULLDISTDIR}/${ECJ} ${WRKSRC}/ecj.jar
  198. .endif
  199. .if ${BUILD_PACKAGES:M-ada}
  200. perl -pi -e 's,^#define (_GLIBCXX_HAVE_GETS) .*,/* #undef $$1 */,' \
  201. ${WRKDIR}/bootstrap/include/c++/*/*/bits/c++config.h
  202. .endif
  203. post-install:
  204. .if ${BUILD_PACKAGES:M-ada}
  205. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/adainclude
  206. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/adalib
  207. .endif
  208. .if ${BUILD_PACKAGES:M-f95}
  209. ln -sf ${TRUEPREFIX}/bin/egfortran ${PREFIX}/bin/gfortran
  210. ln -sf ${TRUEPREFIX}/bin/${CONFIG}-egfortran ${PREFIX}/bin/${CONFIG}-gfortran
  211. .endif
  212. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/include
  213. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/include-fixed
  214. chown ${BINOWN}:${BINGRP} ${PREFIX}/lib/gcc/${CONFIG}/${V}/libgcc.a
  215. chown ${BINOWN}:${BINGRP} ${PREFIX}/lib/gcc/${CONFIG}/${V}/libgcov.a
  216. .include <bsd.port.mk>
  217. ADA_PACKAGE = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME-ada}.tgz
  218. GCC_PACKAGE = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME-main}.tgz
  219. GXX_PACKAGE = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME-c++}.tgz
  220. adastrap: ${ADA_PACKAGE} ${GCC_PACKAGE} ${GXX_PACKAGE}
  221. .if !defined(ADASTRAP_LIBC-${MACHINE_ARCH}) || \
  222. !defined(ADASTRAP_LIBM-${MACHINE_ARCH})
  223. @echo 1>&2 "Error: you must specify libc and libm to bundle"
  224. @exit 1
  225. .else
  226. mkdir -p ${WRKDIR}/prepare/bootstrap/system-libs
  227. cp /usr/lib/libc.so.${ADASTRAP_LIBC-${MACHINE_ARCH}} \
  228. ${WRKDIR}/prepare/bootstrap/system-libs
  229. cp /usr/lib/libm.so.${ADASTRAP_LIBM-${MACHINE_ARCH}} \
  230. ${WRKDIR}/prepare/bootstrap/system-libs
  231. cd ${WRKDIR}/prepare/bootstrap && tar zxf ${ADA_PACKAGE}
  232. cd ${WRKDIR}/prepare/bootstrap && tar zxf ${GCC_PACKAGE}
  233. cd ${WRKDIR}/prepare/bootstrap && tar zxf ${GXX_PACKAGE}
  234. rm -rf ${WRKDIR}/prepare/bootstrap/{+*,info,man,share}
  235. rm -rf ${WRKDIR}/prepare/bootstrap/lib/gcc/*-unknown-openbsd*/$V/include-fixed
  236. if ! ldd ${WRKDIR}/prepare/bootstrap/bin/egcc | \
  237. fgrep libc.so.${ADASTRAP_LIBC-${MACHINE_ARCH}} >/dev/null; then \
  238. echo 1>&2 "Error: adastrap egcc linked against unbundled libc"; \
  239. exit 1; \
  240. fi
  241. if ! ldd ${WRKDIR}/prepare/bootstrap/bin/egcc | \
  242. fgrep libm.so.${ADASTRAP_LIBM-${MACHINE_ARCH}} >/dev/null; then \
  243. echo 1>&2 "Error: adastrap egcc linked against unbundled libm"; \
  244. exit 1; \
  245. fi
  246. cd ${WRKDIR}/prepare && tar cf - bootstrap | \
  247. xz > ${FULLDISTDIR}/${ADASTRAP-${MACHINE_ARCH}}
  248. .endif