Ticket #44891: ghc-ghc-bootstrap-update.diff

File ghc-ghc-bootstrap-update.diff, 15.9 KB (added by neverpanic (Clemens Lang), 10 years ago)

Patchfile against ghc and ghc-bootstrap

  • ghc/Portfile

     
    55PortGroup           active_variants 1.1
    66
    77name                ghc
    8 set canonicalname   ghc
    98# Do not update GHC separate from Haskell Platform.
    109# When updating GHC, make sure to revbump all Haskell ports.
    11 version             7.6.3
    12 revision            4
     10version             7.8.3
    1311categories          lang haskell
    1412maintainers         gmail.com:kitchen.andy cal openmaintainer
    1513license             BSD
     
    2927        GHC comes with a generational garbage collector,    \
    3028        and a space and time profiler.
    3129
    32 homepage        http://haskell.org/${canonicalname}
     30homepage        http://haskell.org/${name}
    3331master_sites    ${homepage}/dist/${version}/
    34 distname        ${canonicalname}-${version}-src
    35 worksrcdir      ${canonicalname}-${version}
     32distname        ${name}-${version}-src
     33worksrcdir      ${name}-${version}
    3634
    3735use_bzip2       yes
    3836
    39 distfiles       ${canonicalname}-${version}-src${extract.suffix} \
    40                 ${canonicalname}-${version}-testsuite${extract.suffix}
     37distfiles       ${name}-${version}-src${extract.suffix} \
     38                ${name}-${version}-testsuite${extract.suffix}
    4139
    42 checksums       ghc-7.6.3-src.tar.bz2 \
    43                 rmd160  82a673ed38b7cf9a59afeb01057625fc761a822b \
    44                 sha256  bd43823d31f6b5d0b2ca7b74151a8f98336ab0800be85f45bb591c9c26aac998 \
    45                 ghc-7.6.3-testsuite.tar.bz2 \
    46                 rmd160  e1d7536b1b0799a6c069eb89be41ceb56692b68d \
    47                 sha256  870d8f50a1b569b0f93d0c7c6b80225280841988f1d779aafe847bcf02d76256
     40checksums       ghc-7.8.3-src.tar.bz2 \
     41                rmd160  464d31d924a8c1e23e94b3cae810c4e41dad4b75 \
     42                sha256  2358826f8424bf571dcc313bd882422fe108a340d6e37db4339ff6d5d6ac3f37 \
     43                ghc-7.8.3-testsuite.tar.bz2 \
     44                rmd160  abc39b71e2f3926b80c681428c447f39599d7d83 \
     45                sha256  9cfef874adf5b895701ae52e507f07049a64246af120ac15200e7bf612521122
    4846
    4947depends_build   port:ghc-bootstrap \
    5048                port:libxslt
    5149
    5250depends_lib     port:gmp           \
    5351                port:ncurses       \
    54                 port:libiconv
    55 
    56 patchfiles      patch-configure-disable-docbook-ps-and-pdf.diff \
    57                 patch-utils__mkdirhier__mkdirhier.sh.diff \
    58                 patch-includes_HsFFI.h.diff
     52                port:libiconv      \
     53                port:llvm-3.5
    5954
     55patchfiles      patch-configure-workaround-bsdsed-incompatibility.diff \
     56                patch-configure-disable-docs.diff
    6057
    6158livecheck.type  none
    6259test.run        yes
    63 use_parallel_build no
    64 
    65 # -- BEGIN gcc variants
    66 
    67 variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 gcc48 gcc49 description {Compile with gcc 4.3} {
    68     configure.compiler      macports-gcc-4.3
    69     configure.args-append   --with-gcc=${configure.cc}
    70     require_active_variants ghc-bootstrap gcc43
    71 }
    72 
    73 variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 gcc48 gcc49 description {Compile with gcc 4.4} {
    74     configure.compiler      macports-gcc-4.4
    75     configure.args-append   --with-gcc=${configure.cc}
    76     require_active_variants ghc-bootstrap gcc44
    77 }
    78 
    79 variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 gcc48 gcc49 description {Compile with gcc 4.5} {
    80     configure.compiler      macports-gcc-4.5
    81     configure.args-append   --with-gcc=${configure.cc}
    82     require_active_variants ghc-bootstrap gcc45
    83 }
    84 
    85 variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 gcc48 gcc49 description {Compile with gcc 4.6} {
    86     configure.compiler      macports-gcc-4.6
    87     configure.args-append   --with-gcc=${configure.cc}
    88     require_active_variants ghc-bootstrap gcc46
    89 }
    90 
    91 variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 gcc48 gcc49 description {Compile with gcc 4.7} {
    92     configure.compiler      macports-gcc-4.7
    93     configure.args-append   --with-gcc=${configure.cc}
    94     require_active_variants ghc-bootstrap gcc47
    95 }
    96 
    97 variant gcc48 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 gcc49 description {Compile with gcc 4.8} {
    98     configure.compiler      macports-gcc-4.8
    99     configure.args-append   --with-gcc=${configure.cc}
    100     require_active_variants ghc-bootstrap gcc48
    101 }
    102 
    103 variant gcc49 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 gcc48 description {Compile with gcc 4.9} {
    104     configure.compiler      macports-gcc-4.9
    105     configure.args-append   --with-gcc=${configure.cc}
    106     require_active_variants ghc-bootstrap gcc49
    107 }
    108 
    109 if {![variant_isset gcc43] && ![variant_isset gcc44] &&
    110     ![variant_isset gcc45] && ![variant_isset gcc46] &&
    111     ![variant_isset gcc47] && ![variant_isset gcc49]} {
    112     default_variants +gcc48
    113 }
    114 
    115 # -- END gcc variants
    11660
    11761set bootstraproot ${prefix}/share/ghc-bootstrap
     62set llvmPrefix  ${prefix}/libexec/llvm-3.5
    11863configure.args  --with-ghc=${bootstraproot}/bin/ghc     \
    11964                --with-iconv-includes=${prefix}/include \
    12065                --with-iconv-libraries=${prefix}/lib    \
    12166                --with-gmp-includes=${prefix}/include   \
    122                 --with-gmp-libraries=${prefix}/lib
     67                --with-gmp-libraries=${prefix}/lib      \
     68                --with-gcc="${configure.cc}"            \
     69                --with-llc=${llvmPrefix}/bin/llc        \
     70                --with-opt=${llvmPrefix}/bin/opt
     71
    12372
    12473# OK so because the bootstrap binary has been prebuilt for libraries
    12574# in /usr/lib we search these before macports stuff to prevent
     
    12877compiler.cpath /usr/include
    12978compiler.library_path /usr/lib
    13079
     80build.args      VERBOSE=1
     81destroot.args   VERBOSE=1
     82
    13183post-destroot {
    13284    set prefixlib ${prefix}/lib/${worksrcdir}
    13385    set destlib   ${destroot}/${prefixlib}
    134     set libver    ${canonicalname}${version}
     86    set libver    ${name}${version}
    13587
    13688    variable libs [ list                               \
    13789                    libHSrts-${libver}.dylib           \
     
    173125    # delete old ${prefix}/lib/ghc-${version} directories
    174126    foreach fullpath [glob -directory ${prefix}/lib ghc-*] {
    175127        if {$fullpath ne $libprefix} {
    176             ui_debug "Cleaning up remnant GHC library directory ${fullpath}"
     128            ui_info "Cleaning up remnant GHC library directory ${fullpath}"
    177129            delete $fullpath
    178130        }
    179131    }
     
    202154    fs-traverse file $packageconfd {
    203155        foreach pattern $deletefiles {
    204156            if {[string match $pattern $file]} {
    205                 ui_debug "Removing remnant package registration file ${file}"
     157                ui_info "Removing remnant package registration file ${file}"
    206158                delete $file
    207159            }
    208160        }
  • ghc/files/patch-configure-workaround-bsdsed-incompatibility.diff

     
     1--- configure.orig      2014-09-17 22:40:16.000000000 +0200
     2+++ configure   2014-09-17 22:40:40.000000000 +0200
     3@@ -4075,7 +4075,7 @@
     4 $as_echo "$as_me: Building in-tree ghc-pwd" >&6;}
     5                 rm -rf utils/ghc-pwd/dist-boot
     6     mkdir  utils/ghc-pwd/dist-boot
     7-                GHC_LDFLAGS=`echo $LDFLAGS | sed 's/\(^\| \)\([^ ]\)/\1-optl\2/g'`
     8+                GHC_LDFLAGS= # this breaks our build with BSD sed, and we don't need the LDFLAGS here
     9         if ! "$WithGhc" $GHC_LDFLAGS -v0 -no-user-$GHC_PACKAGE_DB_FLAG -hidir utils/ghc-pwd/dist-boot -odir utils/ghc-pwd/dist-boot -stubdir utils/ghc-pwd/dist-boot --make utils/ghc-pwd/Main.hs -o utils/ghc-pwd/dist-boot/ghc-pwd
     10     then
     11         as_fn_error $? "Building ghc-pwd failed" "$LINENO" 5
  • ghc-bootstrap/Portfile

     
    55
    66name                ghc-bootstrap
    77set canonicalname   ghc
    8 version             7.0.4
    9 revision            1
     8# Note: 7.6.3 doesn't have a i386 darwin version at http://www.haskell.org/ghc/dist/7.6.3
     9version             7.6.2
    1010categories          lang haskell
    1111maintainers         gmail.com:kitchen.andy cal openmaintainer
    1212license             BSD
     
    2727use_bzip2           yes
    2828
    2929checksums           ${canonicalname}-${version}-i386-apple-darwin${extract.suffix} \
    30                         rmd160  ed4cb136a30455e57ca4526d89b019fe4ce638f3 \
    31                         sha256  c316fcd59166f1075675d7365b06cca973aec6623254a4a7fb28e74c352c4462 \
     30                        rmd160  232b3aa4ed9e2ff09d520f4ae02fa572a671178a \
     31                        sha256  c1da502fa7d99f3d87370c65d705a7e8ee4c900fdb62df6f71696c5432047059 \
    3232                    ${canonicalname}-${version}-x86_64-apple-darwin${extract.suffix} \
    33                         rmd160  14f4c6a044eaa3d04f1645324f9255eebff9a49d \
    34                         sha256  74580b919b5205007901d15da88635e4b2dcc887086fb16d238eeb7011a255d4
     33                        rmd160  b0870a4a292fae7248f9b0be485affa4a5a76a2d \
     34                        sha256  eb0dd19bd5a6eede332d58de219437b9c2b186c72a1fc0c60fa1095b0c2d2789
    3535
    36 # -- BEGIN gcc variants
    37 
    38 variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 gcc48 gcc49 description {Compile with gcc 4.3} {
    39     configure.compiler      macports-gcc-4.3
    40 }
    41 
    42 variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 gcc48 gcc49 description {Compile with gcc 4.4} {
    43     configure.compiler      macports-gcc-4.4
    44 }
    45 
    46 variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 gcc48 gcc49 description {Compile with gcc 4.5} {
    47     configure.compiler      macports-gcc-4.5
    48 }
    49 
    50 variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 gcc48 gcc49 description {Compile with gcc 4.6} {
    51     configure.compiler      macports-gcc-4.6
    52 }
    53 
    54 variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 gcc48 gcc49 description {Compile with gcc 4.7} {
    55     configure.compiler      macports-gcc-4.7
    56 }
    57 
    58 variant gcc48 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 gcc49 description {Compile with gcc 4.8} {
    59     configure.compiler      macports-gcc-4.8
    60 }
    61 
    62 variant gcc49 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 gcc48 description {Compile with gcc 4.9} {
    63     configure.compiler      macports-gcc-4.9
    64 }
    65 
    66 if {![variant_isset gcc43] && ![variant_isset gcc44] &&
    67     ![variant_isset gcc45] && ![variant_isset gcc46] &&
    68     ![variant_isset gcc47] && ![variant_isset gcc49]} {
    69     default_variants +gcc48
     36post-extract {
     37    # Copy clang-wrapper for re-inplace during configure
     38    xinstall -m 644 ${filespath}/clang-wrapper ${workpath}/clang-wrapper
    7039}
    7140
    72 # -- END gcc variants
    73 
    7441configure.pre_args  --prefix=${prefix}/share/ghc-bootstrap
     42configure.args      --with-gcc=${configure.cc}
    7543
    7644pre-configure {
    7745    # OK so because this binary has been prebuilt for libraries
     
    7947    # weird things don't happen
    8048    configure.ldflags  -L/usr/lib
    8149    configure.cppflags -I/usr/include
     50
     51    # patch clang-wrapper and make sure it is used by patching settings.in
     52    reinplace "s#@clang@#${configure.cc}#g" ${workpath}/clang-wrapper
     53    reinplace "s#@SettingsCCompilerCommand@#${prefix}/share/ghc-bootstrap/libexec/clang-wrapper#g" ${worksrcpath}/settings.in
    8254}
    8355
    8456build {}
    8557
    8658post-destroot {
     59    # install clang-wrapper to libexec
     60    xinstall -d -m 755 ${destroot}${prefix}/share/ghc-bootstrap/libexec
     61    xinstall -m 755 ${workpath}/clang-wrapper ${destroot}${prefix}/share/ghc-bootstrap/libexec
     62
    8763    # Delete dylibs; they aren't used by the bootstrap ghc and are incorrectly
    88     # linked against /usr/local, causing rev-upgrade to complain.
    89     # This problem might only be reproducible in i386; the x86_64 version
    90     # apparently doesn't ship any dylibs.
     64    # linked against /usr/local, causing rev-upgrade to complain. This problem
     65    # might only be reproducible in i386; the x86_64 version apparently doesn't
     66    # ship any dylibs.
     67
     68    # We also delete all the .html files, because we really don't need the
     69    # documentation in a bootstrap port.
    9170    fs-traverse f ${destroot}${prefix} {
    9271        if {[file isfile ${f}]} {
    93             if {[file extension ${f}] == ".dylib"} {
     72            set ext [file extension ${f}]
     73            if {${ext} eq ".dylib" || ${ext} eq ".html"} {
    9474                delete ${f}
    9575            }
    9676        }
    9777    }
    9878}
    9979
    100 # TODO don't install documentation
    101 
    10280livecheck.type      none
  • ghc-bootstrap/files/clang-wrapper

     
     1#!/usr/bin/python
     2# vim:ts=4:sts=4:sw=4:et:tw=120
     3# Explicitly using /usr/bin/python, not /usr/bin/env python here.
     4
     5##########
     6# README #
     7##########
     8# This script wraps clang for GHC. GHC won't compile with clang's preprocessor unless the flags
     9#   -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs
     10# are passed (in addition to -E -undef -traditional, which are already passed in by GHC). Furthermore, if a compilation
     11# language is passed and it is C (i.e., -x c), it is replaced with -x assembler-with-cpp.
     12#
     13# There is a popular script fulfilling the same purpose on Github, but the script does not specify a license and can
     14# thus not be re-distributed and used in MacPorts. To avoid the same problem with this script further down the road:
     15#
     16###########
     17# LICENSE #
     18###########
     19#
     20# SPDX-License-Identifier: BSD-2-Clause
     21#
     22# Copyright (c) 2014, Clemens Lang <cal@macports.org>
     23# All rights reserved.
     24#
     25# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
     26# following conditions are met:
     27#
     28# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
     29#    disclaimer.
     30#
     31# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
     32#    disclaimer in the documentation and/or other materials provided with the distribution.
     33#
     34#    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
     35#    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     36#    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     37#    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     38#    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     39#    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
     40#    USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     41
     42import sys
     43import os
     44
     45# To be reinplaced on installation, should hold the absolute path to clang
     46__clang_path = '@clang@'
     47
     48# The set of flags to be added in preprocessor mode
     49__clang_cpp_flags = ['-Wno-invalid-pp-token', '-Wno-unicode', '-Wno-trigraphs']
     50
     51def filterLanguageFlag(args):
     52    lastArgWasLanguage = False
     53    # Start at 1, because index 0 is the program basename, and we don't want to check that for -x
     54    for idx in range(1, len(args)):
     55        if lastArgWasLanguage and args[idx].lower() == 'c':
     56            args[idx] = 'assembler-with-cpp'
     57        lastArgWasLanguage = args[idx] == '-x'
     58    return args
     59
     60# copy argv for modification
     61args = sys.argv[:]
     62
     63# Don't check for -E, -undef, -traditional in sys.argv[0]
     64# But check for the presence of all -E, -undef, and -traditional in the other flags
     65if all(needle in sys.argv[1:] for needle in ['-E', '-undef', '-traditional']):
     66    # We're in preprocessor mode, replace "-x c" with "-x assembler-with-cpp" and append __clang_cpp_flags
     67    args = filterLanguageFlag(args)
     68    args.extend(__clang_cpp_flags)
     69
     70# Replace args[0] with the real path to clang and exec that instead
     71args[0] = __clang_path
     72#print >> sys.stderr, "Executing: %s" % repr(args)
     73os.execv(args[0], args)