Ticket #43959: patch-icu.diff

File patch-icu.diff, 15.9 KB (added by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), 10 years ago)
  • Portfile

     
    88set my_name     icu4c
    99# Don't forget to increase the revision number of the dependents (e.g. boost)
    1010# whenever the library version number changes. Thanks.
    11 version         51.2
    12 revision        1
     11# port echo depends:icu finds dependencies
     12version         53.1
    1313categories      devel textproc
    1414platforms       darwin freebsd
    1515license         MIT
     
    2828distname        ${my_name}-[join [split ${version} .] _]
    2929extract.suffix  .tgz
    3030distfiles       ${distname}-src${extract.suffix}
    31 patchfiles      patch-configure.diff \
    32                 patch-config-mh-darwin.diff \
    33                 inline.patch
    3431
    3532checksums       ${distname}-src.tgz \
    36                 rmd160  ef1256bb87b3dcec1cf40b32b11c5c3f1bd48af6 \
    37                 sha256  deb027a05f1b3bec03298b96fb93b28c84e9683c22e6f94effa67fdc7bd704cc
     33                rmd160  9bd1b4bdc2010545c76a927dcf46049686beeab9 \
     34                sha256  6fa74fb5aac070c23eaba1711a7178fe582c59867484c5ec07c49002787a9a28
    3835
    3936worksrcdir      ${name}/source
    4037set docdir      ${prefix}/share/doc/${name}
    4138
     39# icu appends -O2 to the cflags and cxxflags
     40configure.optflags-delete -Os
     41
     42# ICU has three mechanisms to aid other projects in building properly
     43#     1) .pc files for pkg-config
     44#     2) shell script icu-config that can output compiler flags
     45#     3) Makefile include files Makefile.inc and pkgdata.inc
     46# For a time, all three assumed other projects would want to be
     47#     built as ICU had been built, regardless of whether it was appropriate.
     48# For the most part, the extraneous flags have been removed.
     49#     1) They have been removed completely from the .pc files.
     50#        pkg-config is the recommended way of building against ICU.
     51#     2) icu-config does not print them out, but they are still contained in the script itself.
     52#     3) They still exist in the Makefile include files.
     53#
     54# for descriptions of the problem, see
     55#     r101578
     56#     #40069
     57#     https://bugs.gentoo.org/show_bug.cgi?id=202059
     58#
     59# for upstream reports and discussion, see
     60#    http://bugs.icu-project.org/trac/ticket/10308
     61#    http://bugs.icu-project.org/trac/ticket/6102
    4262if {[variant_isset universal]} {
    43     patchfiles-append   patch-universal.diff
    44 
    45     # weirdly, icu needs a separate source dir built for the build
    46     # machine in order to cross-compile
    47     pre-configure {
    48         global merger_configure_args
    49         set cross 0
    50         set 32bit 0
    51         set crosspath ${worksrcpath}-cross
    52         if {${os.major} < 9 || [sysctl hw.cpu64bit_capable] == 0} {
    53             set 32bit 1
    54         }
    55         foreach a $universal_archs_to_use {
    56             if {($32bit && ($a eq "x86_64" || $a eq "ppc64"))
    57                 || (${os.arch} eq "powerpc" && ($a eq "x86_64" || $a eq "i386"))
    58                 || (${os.arch} eq "i386" && ($a eq "ppc" || $a eq "ppc64"))} {
    59                 set cross 1
    60                 set merger_configure_args($a) --with-cross-build=${crosspath}
     63    merger-post-destroot {
     64        set rebuilton ""
     65        foreach arch ${universal_archs_to_use} {
     66            set dir ${destroot}-${arch}
     67           
     68            # SIZEOF_VOID_P is no longer used in icu-config, so remove it to facilitate merging of the shell script
     69            reinplace {s| -DSIZEOF_VOID_P=[48]||g} ${dir}${prefix}/bin/icu-config
     70           
     71            # icu-config contains the exact time it was built, which makes merging difficult
     72            # ensure that all versions of icu-config have the same build timestamp
     73            if { ${rebuilton} eq "" } {
     74                set rebuilton [exec /usr/bin/tail -n 1 ${dir}${prefix}/bin/icu-config]
     75            } else {
     76                reinplace "s|^# Rebuilt on .*|${rebuilton}|" ${dir}${prefix}/bin/icu-config
    6177            }
     78           
     79            # Removing architecture specific information from the Makefile include files is necessary to merge them correctly.
     80            # It is concivable that this could cause problems for certain projects.
     81            # The developers of ICU suggest using pkg-config over both icu-config and the Makefile includes.
     82            reinplace {s| -DSIZEOF_VOID_P=[48]||g} ${dir}${prefix}/lib/icu/${version}/Makefile.inc
     83            reinplace -E {s:-arch +[^ ]+::g} ${dir}${prefix}/lib/icu/${version}/pkgdata.inc
    6284        }
    63         if {$cross} {
    64             copy ${worksrcpath} ${crosspath}
    65             set configure_dir_save  ${configure.dir}
    66             configure.dir ${crosspath}
    67             portconfigure::configure_main
    68             configure.dir $configure_dir_save
    69             system -W ${crosspath} "${build.cmd}[portbuild::build_getjobsarg]"
    70         }
    7185    }
     86} else {
     87    post-destroot {
     88        # stay consistent with the universal build (see comments above)
     89        reinplace {s| -DSIZEOF_VOID_P=[48]||g} ${destroot}${prefix}/bin/icu-config
     90        reinplace {s| -DSIZEOF_VOID_P=[48]||g} ${destroot}${prefix}/lib/icu/${version}/Makefile.inc
     91        reinplace -E {s:-arch +[^ ]+::g} ${destroot}${prefix}/lib/icu/${version}/pkgdata.inc
     92    }
    7293}
    7394
    74 post-patch {
    75     reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/config/mh-darwin
     95post-destroot {
     96    # The ICU build mechanism passes rpath to the linker, but this should not be necessary if the shared libraries were built correctly.
     97    reinplace {s|^default_ENABLE_RPATH="YES"$|default_ENABLE_RPATH="NO"|g} ${destroot}${prefix}/bin/icu-config
     98    reinplace -E {s| -Wl,-rpath,.+/lib||g} ${destroot}${prefix}/lib/icu/${version}/pkgdata.inc
    7699}
    77100
    78101set platform [switch ${os.platform} {darwin {format MacOSX} freebsd {format FreeBSD}}]
    79102configure.cmd   ./runConfigureICU ${platform}
    80103
     104# enable-rpath forces ICU to build the shared library correctly (with directory name in -install_name)
    81105configure.args  --enable-static \
    82                 --disable-samples
     106                --disable-samples \
     107                --enable-rpath
    83108
    84109configure.universal_args-delete --disable-dependency-tracking
     110if {[variant_isset universal]} {
     111    # ICU detects cross compiling by trying to run binaries.
     112    # r73849 and #29904 indicate that cross compiling is a problem.
     113    # Of the solutions tried (r79660, r73865, and r73849), simply disallowing cross compiling is by far the simplest.
     114    # Note that #29904 should not show up again because universal now better recognizes 32/64-bit cross compiling (r79658)
     115    set merger_must_run_binaries "yes"
     116}
    85117
    86118# Fix bug #11981 that prevents ICU from building when upgrading.
    87119# The default configure flags causes utilisation of outdated ICU
     
    89121configure.cppflags
    90122configure.ldflags
    91123
    92 post-configure {
    93     if {[variant_isset universal]} {
    94         # Ticket #23773
    95         foreach a ${universal_archs_to_use} {
    96             reinplace "s|__ARCH__|${a}|g" ${worksrcpath}-${a}/Makefile
    97         }
    98     }
    99 }
    100 
    101124build.type      gnu
    102125
    103126use_parallel_build  yes
    104127
    105 post-build {
    106     if {[variant_isset universal]} {
    107         set dirs {}
    108         foreach arch ${universal_archs_to_use} {
    109             lappend dirs ${worksrcpath}-${arch}
    110         }
    111     } else {
    112         set dirs ${worksrcpath}
    113     }
    114     foreach dir ${dirs} {
    115         foreach f {Makefile.inc icu-config icu-i18n.pc icu-io.pc icu-le.pc icu-lx.pc icu-uc.pc icu.pc pkgdata.inc} {
    116             reinplace -E {s|-arch [a-z0-9_]+||g} ${dir}/config/${f}
    117         }
    118     }
    119 }
    120 
    121128test.run        yes
    122129test.target     check
    123130
    124131post-destroot {
    125132    xinstall -d ${destroot}${docdir}
    126133    eval xinstall -m 0644 [glob ${worksrcpath}/../*.{css,html,txt}] ${destroot}${docdir}
    127 
    128     if {[variant_isset universal]} {
    129         # Ticket #23773
    130         foreach a ${universal_archs_to_use} {
    131             reinplace "s|/Makefile.inc|/Makefile-${a}.inc|g" ${destroot}${prefix}/bin/icu-config-${a}
    132         }
    133         ln -s current/Makefile.inc ${destroot}${prefix}/lib/icu/Makefile.inc
    134     }
    135134}
    136135
    137 post-activate {
    138     if {[variant_isset universal]} {
    139         # Ticket #23773
    140         set a ${configure.build_arch}
    141         if {$a == "ppc64"} {
    142             if {![file exists ${prefix}/bin/icu-config-${a}]} {
    143                 set a "ppc"
    144             }
    145         } elseif {$a == "x86_64"} {
    146             if {![file exists ${prefix}/bin/icu-config-${a}]} {
    147                 set a "i386"
    148                 if {![file exists ${prefix}/bin/icu-config-${a}]} {
    149                     set a "ppc"
    150                 }
    151             }
    152         } elseif {$a == "i386"} {
    153             if {![file exists ${prefix}/bin/icu-config-${a}]} {
    154                 set a "ppc"
    155             }
    156         }
    157         foreach {p q} [list "${prefix}/bin/icu-config-${a}" "${prefix}/bin/icu-config" \
    158                             "${prefix}/lib/icu/${version}/Makefile-${a}.inc" "${prefix}/lib/icu/${version}/Makefile.inc" \
    159                             "${prefix}/lib/pkgconfig/icu-i18n-${a}.pc" "${prefix}/lib/pkgconfig/icu-i18n.pc" \
    160                             "${prefix}/lib/pkgconfig/icu-io-${a}.pc" "${prefix}/lib/pkgconfig/icu-io.pc" \
    161                             "${prefix}/lib/pkgconfig/icu-le-${a}.pc" "${prefix}/lib/pkgconfig/icu-le.pc" \
    162                             "${prefix}/lib/pkgconfig/icu-lx-${a}.pc" "${prefix}/lib/pkgconfig/icu-lx.pc" \
    163                             "${prefix}/lib/pkgconfig/icu-uc-${a}.pc" "${prefix}/lib/pkgconfig/icu-uc.pc"] {
    164             if {[file exists ${p}]} {
    165                 ln -s ${p} ${q}
    166             }
    167         }
    168     }
    169 }
    170 
    171136# icu @51.2_0 and earlier also installed the following files directly, bypassing destroot:
    172137#   ${prefix}/lib/icu/${version}/pkgdata.inc
    173138# These files can be removed from the below deactivation block after August 2014.
     
    192157    extract.only        ${distname}-src${extract.suffix}
    193158    distfiles-append    ${distname}-docs.zip
    194159    checksums-append    ${distname}-docs.zip \
    195                         rmd160  87f332c1c2e4c5322cd110f93e8ccb288d0303a9 \
    196                         sha256  c488b3ddbb99a4a368cfc74e725d6a9e491ae6ac0169caba2197c15ffb85b7c5
     160                        rmd160  60ce19f8633c18d670ad2f0b8d7920cd6ed0a314 \
     161                        sha256  2c700534d52b98615b4baffcf0502f37540604e67817625f05d6e2fbf98d0c0b
    197162
    198163    post-extract {
    199164        xinstall -m 0755 -d ${worksrcpath}/doc
  • files/inline.patch

     
    1 --- common/umutex.h.orig        2012-06-01 07:52:44.000000000 -0700
    2 +++ common/umutex.h     2013-01-18 23:34:55.000000000 -0800
    3 @@ -29,7 +29,7 @@
    4  #if U_PLATFORM_IS_DARWIN_BASED
    5  #if defined(__STRICT_ANSI__)
    6  #define UPRV_REMAP_INLINE
    7 -#define inline
    8 +#define inline __inline__
    9  #endif
    10  #include <libkern/OSAtomic.h>
    11  #define USE_MAC_OS_ATOMIC_INCREMENT 1
  • files/patch-config-mh-darwin.diff

     
    1 --- config/mh-darwin.orig       2011-10-14 04:38:41.000000000 -0700
    2 +++ config/mh-darwin    2011-10-14 05:32:55.000000000 -0700
    3 @@ -28,7 +28,7 @@
    4  ifeq ($(ENABLE_RPATH),YES)
    5  LD_SONAME = -Wl,-compatibility_version -Wl,$(SO_TARGET_VERSION_MAJOR) -Wl,-current_version -Wl,$(SO_TARGET_VERSION) -install_name $(libdir)/$(notdir $(MIDDLE_SO_TARGET))
    6  else
    7 -LD_SONAME = -Wl,-compatibility_version -Wl,$(SO_TARGET_VERSION_MAJOR) -Wl,-current_version -Wl,$(SO_TARGET_VERSION) -install_name $(notdir $(MIDDLE_SO_TARGET))
    8 +LD_SONAME = -Wl,-compatibility_version -Wl,$(SO_TARGET_VERSION_MAJOR) -Wl,-current_version -Wl,$(SO_TARGET_VERSION) -install_name __PREFIX__/lib/$(notdir $(MIDDLE_SO_TARGET))
    9  endif
    10  
    11  ## Compiler switch to embed a runtime search path
  • files/patch-configure.diff

     
    1 --- configure.org       2013-05-30 14:16:18.000000000 +0200
    2 +++ configure   2013-05-30 14:17:11.000000000 +0200
    3 @@ -4066,7 +4066,7 @@
    4          then
    5              # Do not use -ansi. It limits us to C90, and it breaks some platforms.
    6              # We use -std=c99 to disable the gnu99 defaults and its associated warnings
    7 -            CFLAGS="$CFLAGS -Wall -std=c99 -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"
    8 +            CFLAGS="$CFLAGS -std=c99 -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"
    9          else
    10              case "${host}" in
    11              *-*-cygwin)
    12 @@ -4078,7 +4078,7 @@
    13          fi
    14          if test "$GXX" = yes
    15          then
    16 -            CXXFLAGS="$CXXFLAGS -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long"
    17 +            CXXFLAGS="$CXXFLAGS -W -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long"
    18          else
    19              case "${host}" in
    20              *-*-cygwin)
    21 @@ -6006,40 +6006,6 @@
    22    $as_echo_n "(cached) " >&6
    23  else
    24    ac_cv_c_bigendian=unknown
    25 -    # See if we're dealing with a universal compiler.
    26 -    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    27 -/* end confdefs.h.  */
    28 -#ifndef __APPLE_CC__
    29 -              not a universal capable compiler
    30 -            #endif
    31 -            typedef int dummy;
    32 -
    33 -_ACEOF
    34 -if ac_fn_c_try_compile "$LINENO"; then :
    35 -
    36 -       # Check for potential -arch flags.  It is not universal unless
    37 -       # there are at least two -arch flags with different values.
    38 -       ac_arch=
    39 -       ac_prev=
    40 -       for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
    41 -        if test -n "$ac_prev"; then
    42 -          case $ac_word in
    43 -            i?86 | x86_64 | ppc | ppc64)
    44 -              if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
    45 -                ac_arch=$ac_word
    46 -              else
    47 -                ac_cv_c_bigendian=universal
    48 -                break
    49 -              fi
    50 -              ;;
    51 -          esac
    52 -          ac_prev=
    53 -        elif test "x$ac_word" = "x-arch"; then
    54 -          ac_prev=arch
    55 -        fi
    56 -       done
    57 -fi
    58 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    59      if test $ac_cv_c_bigendian = unknown; then
    60        # See if sys/param.h defines the BYTE_ORDER macro.
    61        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    62 @@ -6214,11 +6180,6 @@
    63  ;; #(
    64     no)
    65        ;; #(
    66 -   universal)
    67 -
    68 -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
    69 -
    70 -     ;; #(
    71     *)
    72       as_fn_error $? "unknown endianness
    73   presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
  • files/patch-universal.diff

     
    1 --- Makefile.in.orig    2013-05-23 15:06:32.000000000 -0500
    2 +++ Makefile.in 2013-08-15 01:22:22.000000000 -0500
    3 @@ -169,15 +169,18 @@
    4         $(INSTALL_SCRIPT) $(top_srcdir)/install-sh $(DESTDIR)$(pkgdatadir)/install-sh
    5         @$(MKINSTALLDIRS) $(DESTDIR)$(libdir)/pkgconfig
    6         $(INSTALL_DATA) $(ALL_PKGCONFIG_FILES) $(DESTDIR)$(libdir)/pkgconfig/
    7 +       @for f in $(ALL_PKGCONFIG_SUFFIX); do \
    8 +         mv "$(DESTDIR)$(libdir)/pkgconfig/icu-$${f}.pc" "$(DESTDIR)$(libdir)/pkgconfig/icu-$${f}-__ARCH__.pc"; \
    9 +       done;
    10         $(INSTALL_DATA) $(top_srcdir)/../license.html $(DESTDIR)$(pkgdatadir)/license.html
    11 -       $(INSTALL_SCRIPT) $(top_builddir)/config/icu-config $(DESTDIR)$(bindir)/icu-config
    12 -       $(INSTALL_DATA) $(top_builddir)/config/Makefile.inc $(DESTDIR)$(pkglibdir)/Makefile.inc
    13 +       $(INSTALL_SCRIPT) $(top_builddir)/config/icu-config $(DESTDIR)$(bindir)/icu-config-__ARCH__
    14 +       $(INSTALL_DATA) $(top_builddir)/config/Makefile.inc $(DESTDIR)$(pkglibdir)/Makefile-__ARCH__.inc
    15         $(INSTALL_DATA) $(top_builddir)/config/pkgdata.inc $(DESTDIR)$(pkglibdir)/pkgdata.inc
    16  #      @echo icuinfo.xml is built after make check.
    17  #      -$(INSTALL_DATA) $(top_builddir)/config/icuinfo.xml $(DESTDIR)$(pkglibdir)/icuinfo.xml
    18         cd $(DESTDIR)$(pkglibdir)/..; \
    19             $(RM) current && ln -s $(VERSION) current; \
    20 -           $(RM) Makefile.inc && ln -s current/Makefile.inc Makefile.inc; \
    21 +#          $(RM) Makefile.inc && ln -s current/Makefile.inc Makefile.inc; \
    22             $(RM) pkgdata.inc && ln -s current/pkgdata.inc pkgdata.inc
    23  
    24  ifeq ($(DOXYGEN),)