| 106 | | # Install documentation in a MacPorts location |
| 107 | | reinplace "/^HTMLDIR=/ s:=.*$:=\"${prefix}/share/doc/${name}/html\":" ${worksrcpath}/build_gcc |
| 108 | | |
| 109 | | # arch returns i386 even when we want x86_64 |
| 110 | | reinplace "/^BUILD=/ s:arch:echo ${build_arch}:" ${worksrcpath}/build_gcc |
| 111 | | |
| 112 | | # This is set to isysroot/Developer/SDKs/MacOSX10.5.sdk mmacosx-version-min=10.5 |
| 113 | | # which is not always right. Our CFLAGS should take care of this instead |
| 114 | | reinplace "/^MULTILIB_EXTRA_OPTS/d" ${worksrcpath}/gcc/config/rs6000/t-darwin |
| 115 | | |
| 116 | | if {${build_arch} == "ppc"} { |
| 117 | | reinplace "/^PPC_SYSROOT=/ s:=.*$:=/:" ${worksrcpath}/build_gcc |
| 118 | | } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.5.sdk]} { |
| 119 | | reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.5.sdk:" ${worksrcpath}/build_gcc |
| 120 | | } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.4u.sdk]} { |
| 121 | | reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.4u.sdk:" ${worksrcpath}/build_gcc |
| 122 | | } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.3.9.sdk]} { |
| 123 | | reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.3.9.sdk:" ${worksrcpath}/build_gcc |
| 124 | | } |
| 125 | | |
| 126 | | if {${os.major} < 9} { |
| 127 | | reinplace "/vproc.h/d" ${worksrcpath}/gcc/libgcov.c |
| | 106 | # Install documentation in a MacPorts location |
| | 107 | #reinplace "/^HTMLDIR=/ s:=.*$:=\"${prefix}/share/doc/${name}/html\":" ${worksrcpath}/build_gcc |
| | 108 | |
| | 109 | # arch returns i386 even when we want x86_64 |
| | 110 | reinplace "/^BUILD=/ s:arch:echo ${build_arch}:" ${worksrcpath}/build_gcc |
| | 111 | |
| | 112 | # This is set to isysroot/Developer/SDKs/MacOSX10.5.sdk mmacosx-version-min=10.5 |
| | 113 | # which is not always right. Our CFLAGS should take care of this instead |
| | 114 | reinplace "/^MULTILIB_EXTRA_OPTS/d" ${worksrcpath}/gcc/config/rs6000/t-darwin |
| | 115 | |
| | 116 | # Brand our compiler |
| | 117 | reinplace "/VERSUFFIX/s/)\"/) (MacPorts ${name} ${version}_${revision}${portvariants})\"/" \ |
| | 118 | ${worksrcpath}/gcc/version.c |
| | 119 | reinplace "/bug_report_url/s|http:.*>|https://trac.macports.org/newticket>|" \ |
| | 120 | ${worksrcpath}/gcc/version.c |
| | 121 | |
| | 122 | if {${build_arch} == "ppc"} { |
| | 123 | reinplace "/^PPC_SYSROOT=/ s:=.*$:=/:" ${worksrcpath}/build_gcc |
| | 124 | } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.5.sdk]} { |
| | 125 | reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.5.sdk:" ${worksrcpath}/build_gcc |
| | 126 | } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.4u.sdk]} { |
| | 127 | reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.4u.sdk:" ${worksrcpath}/build_gcc |
| | 128 | } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.3.9.sdk]} { |
| | 129 | reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.3.9.sdk:" ${worksrcpath}/build_gcc |
| | 130 | } |
| | 131 | |
| | 132 | if {${os.major} < 9} { |
| | 133 | reinplace "/vproc.h/d" ${worksrcpath}/gcc/libgcov.c |
| | 134 | } |
| | 135 | |
| | 136 | # Disable -Werror for our bootstrap gcc |
| | 137 | if {[string match "*clang*" ${configure.compiler}]} { |
| | 138 | reinplace "s:--enable-werror : :" ${worksrcpath}/build_gcc |
| | 139 | } |
| | 140 | } |
| | 141 | |
| | 142 | compiler.cpath |
| | 143 | |
| | 144 | # TODO: Better use of MacPorts dependencies |
| | 145 | build.env \ |
| | 146 | LANGUAGES="c,c++,objc,obj-c++" \ |
| | 147 | LIBRARY_PATH="/usr/lib" \ |
| | 148 | CPATH="/usr/include" \ |
| | 149 | PATH="/bin:/usr/bin:/sbin:/usr/sbin" \ |
| | 150 | LANGUAGES="c,c++,objc,obj-c++" \ |
| | 151 | AR_FOR_TARGET=${prefix}/bin/ar \ |
| | 152 | AS_FOR_TARGET=${prefix}/bin/as \ |
| | 153 | LD_FOR_TARGET=${prefix}/bin/ld \ |
| | 154 | NM_FOR_TARGET=${prefix}/bin/nm \ |
| | 155 | OBJDUMP_FOR_TARGET=${prefix}/bin/objdump \ |
| | 156 | RANLIB_FOR_TARGET=${prefix}/bin/ranlib \ |
| | 157 | STRIP_FOR_TARGET=${prefix}/bin/strip \ |
| | 158 | OTOOL=${prefix}/bin/otool \ |
| | 159 | OTOOL64=${prefix}/bin/otool |
| | 160 | |
| | 161 | build.args-append \ |
| | 162 | CC="${configure.cc} -std=gnu89" \ |
| | 163 | PREFIX="${prefix}" \ |
| | 164 | SRCROOT="${srcroot}" \ |
| | 165 | OBJROOT="${objroot}" \ |
| | 166 | SYMROOT="${symroot}" \ |
| | 167 | DSTROOT="${destroot}" \ |
| | 168 | RC_NONARCH_CFLAGS="-pipe -std=gnu89" \ |
| | 169 | RC_OS="macos" \ |
| | 170 | RC_ARCHS="[get_canonical_archs]" |
| | 171 | |
| | 172 | # On Tiger, we need apple-gcc42 to build llvm, which is needed for cctools |
| | 173 | variant bootstrap description {Variant to break a dependency cycle on Tiger by first building an apple-gcc42 using host ld and cctools} { |
| | 174 | # depends_lib-delete port:libiconv |
| | 175 | depends_run-delete port:ld64 port:cctools |
| | 176 | |
| | 177 | build.env \ |
| | 178 | LIBRARY_PATH="/usr/lib" \ |
| | 179 | CPATH="/usr/include" \ |
| | 180 | PATH="/bin:/usr/bin:/sbin:/usr/sbin" \ |
| | 181 | LANGUAGES="c,c++,objc,obj-c++" |
| | 182 | |
| | 183 | pre-fetch { |
| | 184 | if {([file exists ${prefix}/bin/ld] && [file exists ${prefix}/bin/as]) || ${os.major} > 8} { |
| | 185 | ui_error "Please install this port without the bootstrap variant." |
| | 186 | error "Please install this port without the bootstrap variant." |
| 129 | | |
| 130 | | # Disable -Werror for our bootstrap gcc |
| 131 | | if {${configure.compiler} == "clang" || |
| 132 | | ${configure.compiler} == "macports-clang"} { |
| 133 | | reinplace "s:--enable-werror : :" ${worksrcpath}/build_gcc |
| 134 | | } |
| 135 | | } |
| 136 | | |
| 137 | | compiler.cpath |
| 138 | | |
| 139 | | # TODO: Use MacPorts dependencies |
| 140 | | build.env \ |
| 141 | | LIBRARY_PATH="/usr/lib" \ |
| 142 | | CPATH="/usr/include" \ |
| 143 | | PATH="/bin:/usr/bin:/sbin:/usr/sbin" \ |
| 144 | | LANGUAGES="c,c++,objc,obj-c++" |
| 145 | | |
| 146 | | # MAKEINFO=${prefix}/bin/makeinfo |
| 147 | | |
| 148 | | build.args-append \ |
| 149 | | CC="${configure.cc} -std=gnu89" \ |
| 150 | | PREFIX="${prefix}" \ |
| 151 | | SRCROOT="${srcroot}" \ |
| 152 | | OBJROOT="${objroot}" \ |
| 153 | | SYMROOT="${symroot}" \ |
| 154 | | DSTROOT="${destroot}" \ |
| 155 | | RC_NONARCH_CFLAGS="-pipe -std=gnu89" \ |
| 156 | | RC_OS="macos" \ |
| 157 | | RC_ARCHS="[get_canonical_archs]" |
| | 188 | } |
| | 189 | } |
| | 190 | |
| | 191 | platform darwin 8 { |
| | 192 | if {![file exists ${prefix}/bin/gcc-apple-4.2] && |
| | 193 | (![file exists ${prefix}/bin/ld] || ![file exists ${prefix}/bin/as])} { |
| | 194 | default_variants +bootstrap |
| | 195 | } |
| | 196 | } |