| 1 | # -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|---|
| 2 | # $Id: Portfile 53101 2009-06-29 16:34:30Z krischik@macports.org $ |
|---|
| 3 | # vim: set fileencoding=utf-8 tabstop=8 shiftwidth=4 softtabstop=4 noexpandtab filetype=tcl : |
|---|
| 4 | |
|---|
| 5 | PortSystem 1.0 |
|---|
| 6 | |
|---|
| 7 | name gnat-gcc |
|---|
| 8 | version 4.4.0 |
|---|
| 9 | #revision 4 |
|---|
| 10 | platforms darwin |
|---|
| 11 | categories lang |
|---|
| 12 | maintainers krischik |
|---|
| 13 | description The GNU compiler collection with GNAT |
|---|
| 14 | long_description The GNU compiler collection, including front ends for \ |
|---|
| 15 | C, C++, Ada, Objective-C, Objective-C++, Java and Fortran95. |
|---|
| 16 | |
|---|
| 17 | homepage http://gcc.gnu.org/ |
|---|
| 18 | master_sites ftp://ftp.funet.fi/pub/mirrors/sources.redhat.com/pub/gcc/releases/gcc-${version}/ \ |
|---|
| 19 | ftp://ftp.gwdg.de/pub/linux/gcc/releases/gcc-${version}/ \ |
|---|
| 20 | ftp://gcc.ftp.nluug.nl/mirror/languages/gcc/releases/gcc-${version}/ \ |
|---|
| 21 | ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version}/ \ |
|---|
| 22 | gnu:/gcc/gcc-${version} |
|---|
| 23 | |
|---|
| 24 | set dcore gcc-core-${version}.tar.bz2 |
|---|
| 25 | set dada gcc-ada-${version}.tar.bz2 |
|---|
| 26 | set dfort gcc-fortran-${version}.tar.bz2 |
|---|
| 27 | set dcxx gcc-g++-${version}.tar.bz2 |
|---|
| 28 | set djava gcc-java-${version}.tar.bz2 |
|---|
| 29 | set dobjc gcc-objc-${version}.tar.bz2 |
|---|
| 30 | distfiles ${dcore} ${dada} ${dfort} ${dcxx} ${djava} ${dobjc} |
|---|
| 31 | |
|---|
| 32 | checksums ${dcore} sha1 081c5a1e49157b9c48fe97497633b6ff39032eb5 \ |
|---|
| 33 | ${dada} sha1 07c110a2918f20638524d8ded22581d4cb9204a8 \ |
|---|
| 34 | ${dfort} sha1 5f9e32d9061937e7706d35d2d5458675352b1368 \ |
|---|
| 35 | ${dcxx} sha1 063d5acca79ec00276cf6ebdba414804abf3fcb6 \ |
|---|
| 36 | ${djava} sha1 94c2b5f541db6961c60ae30e0ac8b822fae4f3d3 \ |
|---|
| 37 | ${dobjc} sha1 21cd70e01c211553c59123c62b4f33330ad212c4 |
|---|
| 38 | |
|---|
| 39 | use_bzip2 yes |
|---|
| 40 | |
|---|
| 41 | # gmp and mpfr are not universal |
|---|
| 42 | universal_variant no |
|---|
| 43 | |
|---|
| 44 | depends_lib port:gmp port:mpfr port:libiconv |
|---|
| 45 | |
|---|
| 46 | set major 4.4 |
|---|
| 47 | |
|---|
| 48 | worksrcdir build |
|---|
| 49 | dist_subdir gcc43 |
|---|
| 50 | |
|---|
| 51 | pre-configure { |
|---|
| 52 | file mkdir ${worksrcpath} |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | configure.cmd ../gcc-${version}/configure |
|---|
| 56 | configure.args --enable-languages=c,c++,ada,objc,obj-c++,java,fortran \ |
|---|
| 57 | --libdir=${prefix}/lib/${name} \ |
|---|
| 58 | --includedir=${prefix}/include/${name} \ |
|---|
| 59 | --infodir=${prefix}/share/info \ |
|---|
| 60 | --mandir=${prefix}/share/man \ |
|---|
| 61 | --with-local-prefix=${prefix} \ |
|---|
| 62 | --with-system-zlib \ |
|---|
| 63 | --disable-nls \ |
|---|
| 64 | --program-suffix=-gnat-${major} \ |
|---|
| 65 | --with-gxx-include-dir=${prefix}/include/${name}/c++/ \ |
|---|
| 66 | --with-gmp=${prefix} \ |
|---|
| 67 | --with-mpfr=${prefix} |
|---|
| 68 | # do NOT use MacPorts binutils -- they do not work |
|---|
| 69 | configure.env-append AR_FOR_TARGET=/usr/bin/ar \ |
|---|
| 70 | AS_FOR_TARGET=/usr/bin/as \ |
|---|
| 71 | LD_FOR_TARGET=/usr/bin/ld \ |
|---|
| 72 | NM_FOR_TARGET=/usr/bin/nm \ |
|---|
| 73 | OBJDUMP_FOR_TARGET=/usr/bin/objdump \ |
|---|
| 74 | RANLIB_FOR_TARGET=/usr/bin/ranlib \ |
|---|
| 75 | STRIP_FOR_TARGET=/usr/bin/strip |
|---|
| 76 | # LIPO_FOR_TARGET=/usr/bin/lipo |
|---|
| 77 | |
|---|
| 78 | use_parallel_build yes |
|---|
| 79 | |
|---|
| 80 | destroot.target install install-info-host |
|---|
| 81 | # install-info # errors on objc-info files |
|---|
| 82 | |
|---|
| 83 | post-destroot { |
|---|
| 84 | file delete -force ${destroot}${prefix}/share/man/man7 \ |
|---|
| 85 | ${destroot}${prefix}/share/info |
|---|
| 86 | # install/copy ffitarget.h only if we have it |
|---|
| 87 | if {![catch {set ffitarget.h [glob ${destroot}${prefix}/lib/${name}/gcc/*/${version}/include/ffitarget.h]} result]} { |
|---|
| 88 | file copy ${ffitarget.h} ${destroot}${prefix}/include/${name}/ |
|---|
| 89 | } |
|---|
| 90 | # install select file for gcc_select |
|---|
| 91 | xinstall -m 755 -d ${destroot}${prefix}/etc/select/gcc |
|---|
| 92 | xinstall -m 444 ${filespath}/gnat-gcc ${destroot}${prefix}/etc/select/gcc/ |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | #platform darwin 7 { |
|---|
| 96 | # configure.cflags-append -force_cpusubtype_ALL |
|---|
| 97 | # confgiure.env BOOT_CFLAGS="-g -O2 -force_cpusubtype_ALL" |
|---|
| 98 | # build.args-append XCFLAGS=-force_cpusubtype_ALL |
|---|
| 99 | #} |
|---|
| 100 | |
|---|
| 101 | platform powerpc { |
|---|
| 102 | configure.args-append --disable-multilib |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | # odcctools currently do not compile for x64 - move to variant for the time being |
|---|
| 106 | variant odcctools \ |
|---|
| 107 | description "Use the odcctools instead of the system provided ones - does not work for x64 currently!" { |
|---|
| 108 | depends_lib-append port:odcctools |
|---|
| 109 | patch { |
|---|
| 110 | reinplace "s|/usr/bin/libtool|${prefix}/bin/odlibtool|g" \ |
|---|
| 111 | ${workpath}/gcc-${version}/gcc/config/darwin.h |
|---|
| 112 | } |
|---|
| 113 | configure.args-append --with-as=${prefix}/bin/odas \ |
|---|
| 114 | --with-ld=${prefix}/bin/odld \ |
|---|
| 115 | --with-ar=${prefix}/bin/odar |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | #variant x86_64 \ |
|---|
| 119 | #description "Create an Intel 64 bit compiler." { |
|---|
| 120 | #configure.args-append \ |
|---|
| 121 | #--build=i386-apple-darwin9 \ |
|---|
| 122 | #--host=i386-apple-darwin9 \ |
|---|
| 123 | #--target=x86_64-apple-darwin9 |
|---|
| 124 | ##APXSLDFLAGS='-arch x86_64' \ |
|---|
| 125 | ##--with-apxs=/usr/sbin/apxs |
|---|
| 126 | ##CFLAGS='-arch x86_64' \ |
|---|
| 127 | #} |
|---|
| 128 | |
|---|
| 129 | # |
|---|
| 130 | # Ada is the only language apart from C which is self hosted - meaning: you need |
|---|
| 131 | # an ada compiler to compile ada. hence it is just a variant. |
|---|
| 132 | # |
|---|
| 133 | variant macada \ |
|---|
| 134 | description "Uses MacAda compiler (http://www.macada.org) to bootstrap!" { |
|---|
| 135 | set bootprefix /usr/local/ada-4.3 |
|---|
| 136 | configure.cc ${bootprefix}/bin/gcc |
|---|
| 137 | configure.cpp ${bootprefix}/bin/cpp |
|---|
| 138 | configure.cxx ${bootprefix}/bin/g++ |
|---|
| 139 | configure.objc ${bootprefix}/bin/gcc |
|---|
| 140 | configure.env-append PATH=${bootprefix}/bin:$env(PATH) |
|---|
| 141 | configure.env-append GNATMAKE=${bootprefix}/bin/gnatmake |
|---|
| 142 | configure.env-append GNATBIND=${bootprefix}/bin/gnatbind |
|---|
| 143 | } |
|---|
| 144 | |
|---|
| 145 | variant gnatgpl \ |
|---|
| 146 | description "Uses GNAT/GPL compiler (http://libre.adacore.com) to bootstrap!" { |
|---|
| 147 | set bootprefix /opt/gnat-2009-x86_64-apple-darwin9.6.0-bin |
|---|
| 148 | configure.cc ${bootprefix}/bin/gcc |
|---|
| 149 | configure.cpp ${bootprefix}/bin/cpp |
|---|
| 150 | configure.cxx ${bootprefix}/bin/g++ |
|---|
| 151 | configure.objc ${bootprefix}/bin/gcc |
|---|
| 152 | configure.env-append PATH=${bootprefix}/bin:$env(PATH) |
|---|
| 153 | configure.env-append GNATMAKE=${bootprefix}/bin/gnatmake |
|---|
| 154 | configure.env-append GNATBIND=${bootprefix}/bin/gnatbind |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | variant gnuada \ |
|---|
| 158 | description "Uses the GnuAda (http://gnuada.sourceforge.net/) compiler to bootstrap!" { |
|---|
| 159 | set bootprefix /opt/local |
|---|
| 160 | configure.cc ${bootprefix}/bin/gcc-gnat-4.3 |
|---|
| 161 | configure.cpp ${bootprefix}/bin/cpp-gnat-4.3 |
|---|
| 162 | configure.cxx ${bootprefix}/bin/g++-gnat-4.3 |
|---|
| 163 | configure.objc ${bootprefix}/bin/gcc-gnat-4.3 |
|---|
| 164 | configure.env-append PATH=${bootprefix}/bin:$env(PATH) |
|---|
| 165 | configure.env-append GNATMAKE=${bootprefix}/bin/gnatmake |
|---|
| 166 | configure.env-append GNATBIND=${bootprefix}/bin/gnatbind |
|---|
| 167 | } |
|---|
| 168 | |
|---|
| 169 | variant ada \ |
|---|
| 170 | description "Uses the MacPorts Ada (http://www.macports.org/) compiler to bootstrap!" { |
|---|
| 171 | configure.cc ${prefix}/bin/gcc |
|---|
| 172 | configure.cpp ${prefix}/bin/cpp |
|---|
| 173 | configure.cxx ${prefix}/bin/g++ |
|---|
| 174 | configure.objc ${prefix}/bin/gcc |
|---|
| 175 | configure.env-append PATH=${prefix}/bin:$env(PATH) |
|---|
| 176 | configure.env-append GNATMAKE=${prefix}/bin/gnatmake |
|---|
| 177 | configure.env-append GNATBIND=${prefix}/bin/gnatbind |
|---|
| 178 | } |
|---|
| 179 | |
|---|
| 180 | pre-configure { |
|---|
| 181 | if {![variant_isset macada] && ![variant_isset gnatgpl] && ![variant_isset gnuada] && ![variant_isset ada]} { |
|---|
| 182 | ui_msg "######################################################" |
|---|
| 183 | ui_msg "# You need to install an Ada compiler and then #" |
|---|
| 184 | ui_msg "# choose an appropiate variant. #" |
|---|
| 185 | ui_msg "######################################################" |
|---|
| 186 | } |
|---|
| 187 | } |
|---|
| 188 | |
|---|
| 189 | post-configure { |
|---|
| 190 | file delete \ |
|---|
| 191 | ${workpath}/gcc-${version}/gcc/ada/mlib-tgt-specific.adb |
|---|
| 192 | file copy \ |
|---|
| 193 | ${workpath}/gcc-${version}/gcc/ada/mlib-tgt-specific-darwin.adb \ |
|---|
| 194 | ${workpath}/gcc-${version}/gcc/ada/mlib-tgt-specific.adb |
|---|
| 195 | } |
|---|
| 196 | |
|---|
| 197 | post-activate { |
|---|
| 198 | ui_msg "######################################################" |
|---|
| 199 | ui_msg "# Remember to activate the compiler with: #" |
|---|
| 200 | ui_msg "# #" |
|---|
| 201 | ui_msg "# sudo gcc_select gnat-gcc #" |
|---|
| 202 | ui_msg "######################################################" |
|---|
| 203 | } |
|---|
| 204 | |
|---|
| 205 | |
|---|
| 206 | livecheck.check regex |
|---|
| 207 | livecheck.url http://gcc.gnu.org/gcc-4.4/ |
|---|
| 208 | livecheck.regex GCC (4\\.4\\.\[0-9\]) |
|---|