build 2.53 KB
Newer Older
gsell's avatar
gsell committed
1
#!/usr/bin/env modbuild
gsell's avatar
gsell committed
2

l_opal's avatar
l_opal committed
3
pbuild::set_download_url "https://ftp.gnu.org/gnu/gcc/$P-$V/$P-$V.tar.gz"
Achim Gsell's avatar
Achim Gsell committed
4

gsell's avatar
gsell committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
pbuild::add_to_group 'Programming'
pbuild::install_docfiles 'COPYING' 'COPYING.LIB' 'COPYING.RUNTIME' 'COPYING3' 'COPYING3.LIB' 'NEWS' 'README'

#pbuild::pre_prep_Darwin() {
#	if (( V_MAJOR == 8 )); then
#		pbuild::add_patch "files/headers-10.14.4-fix.patch"
#	fi
#}

pbuild::post_prep_Darwin() {
	if (( V_MAJOR == 8 )); then
		local -r OS_REL=$(uname -r)
		local -r patch_fname="${BUILDBLOCK_DIR}/8/headers-10.14.4-fix.patch"
		patch -p1 < <(sed "s/darwin18.5/${OS,,}${OS_REL%.*}/" ${patch_fname})
	fi
}

gsell's avatar
gsell committed
22
pbuild::pre_prep() {
gsell's avatar
gsell committed
23 24
	if (( V_MAJOR == 4 && V_MINOR <= 8 )) || \
	   (( V_MAJOR == 4 && V_MINOR == 9 && V_PATCHLVL < 4)); then
gsell's avatar
gsell committed
25 26
		pbuild::add_patch_Darwin "${V_MAJOR}/non-dead-strip.patch"
		pbuild::add_patch_Darwin "${V_MAJOR}/configure-as.patch"
27
	fi
gsell's avatar
gsell committed
28
	if (( V_MAJOR == 5 )) || (( V_MAJOR == 6 )); then
gsell's avatar
gsell committed
29 30
		pbuild::add_patch_Darwin "${V_MAJOR}/PR57438_avoiding_empty_function_bodies_and_trailing_labels.patch"
	fi
l_opal's avatar
l_opal committed
31 32 33
	if (( V_MAJOR == 10 && V_MINOR == 2 )); then
		pbuild::add_patch "files/gcc-10.2.0-cpp-__has_include.patch"
	fi
34 35
}

gsell's avatar
gsell committed
36 37 38 39 40 41 42 43 44 45 46
pbuild::pre_configure() {
	pbuild::add_configure_args "--with-gmp=${GMP_PREFIX}"
	pbuild::add_configure_args "--with-mpfr=${MPFR_PREFIX}"
	pbuild::add_configure_args "--with-mpc=${MPC_PREFIX}"
	pbuild::add_configure_args "--enable-lto"
	pbuild::add_configure_args "--disable-multilib"
	pbuild::add_configure_args "--with-pkgversion='PSI Environment Module'"
	pbuild::add_configure_args "--with-build-config=bootstrap-debug"
}

pbuild::pre_configure_Linux() {
47
	if (( V_MAJOR >= 8 )); then
gsell's avatar
gsell committed
48
		pbuild::add_configure_args "--enable-languages=c,c++,objc,obj-c++,lto,fortran,go"
49
	fi
gsell's avatar
gsell committed
50 51
}

gsell's avatar
gsell committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
pbuild::pre_configure_Darwin() {
	local -r prefix='/usr'
	pbuild::add_configure_args "--enable-languages=c,c++,objc,obj-c++,lto,fortran"
	pbuild::add_configure_args "--with-as=${prefix}/bin/as"
	pbuild::add_configure_args "--with-ld=${prefix}/bin/ld"
	pbuild::add_configure_args "--with-ar=${prefix}/bin/ar"
	pbuild::add_configure_args "AR_FOR_TARGET=${prefix}/bin/ar"
	pbuild::add_configure_args "AS_FOR_TARGET=${prefix}/bin/as"
	pbuild::add_configure_args "LD_FOR_TARGET=${prefix}/bin/ld"
	pbuild::add_configure_args "NM_FOR_TARGET=${prefix}/bin/nm"
	pbuild::add_configure_args "OBJDUMP_FOR_TARGET=${prefix}/bin/objdump"
	pbuild::add_configure_args "RANLIB_FOR_TARGET=${prefix}/bin/ranlib"
	pbuild::add_configure_args "STRIP_FOR_TARGET=${prefix}/bin/strip"
	pbuild::add_configure_args "OTOOL=${prefix}/bin/otool"
	pbuild::add_configure_args "OTOOL64=${prefix}/bin/otool"
}
gsell's avatar
gsell committed
68