#!/bin/ksh93 SRCURL='http://download.icu-project.org/files/icu4c/' VERSION=55.1.1 ICU_VERS=55.1 # Als soname Version string nutzen wir (ICU-Major - 48), und # _nicht_ ICU-Major.ICU-Minor, damit wir 'ne Kollision mit denen die bei Solaris # oder anderen Apps mitkommen definitiv ausschließen können. SO_VERS=7 SRC=${SOURCE}/text TMPBUILD=${BUILD}/icu4c-${VERSION} . ${.sh.file%/*}/../../../etc/buildfunctions.sh # IBM people obviously still have not found out, that there is more than # just LD_LIBRARY_PATH! Abbused all over the place! [[ -n ${ARCH_DIR} ]] && LD_LIBRARY_PATH=${LD_LIBRARY_PATH_64} || \ LD_LIBRARY_PATH=${LD_LIBRARY_PATH_32} unset LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 function doPrepare { rm -rf ${BUILD}/icu prepareRoot4build ${TAR} xzf ${SRC}/icu4c-${ICU_VERS//./_}-src.tgz mv icu/* ${TMPBUILD} cd ${TMPBUILD} || exit 1 rmdir ../icu cp ${SCRIPTDIR}/c_origin.* source/common/ for p in ~(N)${SDIR}/patches/*.patch ~(N)${SDIR}/*.patch ; do gpatch -p1 -E -b -z .orig < $p done # http://source.icu-project.org/repos/icu/icu/trunk/readme.html#RecBuild # i.e. use library entry point names without ICU version suffix. We do this, # so that we not need to remember it, when compiling other stuff: ${SED} -i \ -e "s/#define U_DISABLE_RENAMING 0/#define U_DISABLE_RENAMING 1/" \ source/common/unicode/uconfig.h # kansas-city shuffle: # just patching source/common/unicode/uvernum.h does not work, since # several file names are hardcoded to *55*, e.g. source/data/in/icudt55l.dat # and even internal binary data. So we just change the name outside: ${SED} -i -e "/^SO_TARGET_VERSION_MAJOR/ s,=.*,= ${SO_VERS}," \ source/icudefs.mk.in # NOTE that we patched pkgdata as well, because it produces bullshit - # has no notion of SO_TARGET_VERSION_MAJOR. find source -name pkgdataMakefile.in \ -exec ${SED} -r -i -e "/LIB_EXT_ORDER/ s,=[^)]+.,=.${SO_VERS}," {} + # This is the only place, where it works: needs to appear AFTER all *.o # and thus appending it to source/config/mh-solaris:SHLIB.cc would be # useless (icu builds do ${SHLIB.cc} *.o $icudata_stuff ${DEFAULT_LIBS} print 'DEFAULT_LIBS=-norunpath -lstdc++ -lgcc_s -lm -lc -Bstatic -lCrunG3' \ >source/icudefs.local } function doMake { cd ${TMPBUILD}/source || exit 1 OPTS=( '--prefix=/usr' '--enable-shared' '--disable-static' '--disable-rpath' '--enable-extras' '--enable-icuio' '--enable-layoutex' '--disable-renaming' # deprecated, however, we do not wanna have a circular dependency to # harfbuzz - see http://userguide.icu-project.org/layoutengine/paragraph '--enable-layout' '--enable-tools' '--enable-draft' # fixes also CVE-2014-9654.patch '--disable-tests' '--disable-samples' '--with-data-packaging=library' ) # -std=c++03 is needed since icu needs -xustr=ascii_utf16_ushort, which is # not allowed for c++11. Also graphite2 needs at least c++03. CXX+=' -std=c++03' CC+=' -std=c99 -D_XPG6' L_CPPFLAGS+=' -xustr=ascii_utf16_ushort -features=conststrings' CFLAGS="${L_CFLAGS}" CPPFLAGS="${L_CPPFLAGS}" CXXFLAGS="${L_CXXFLAGS}" \ LDFLAGS="${L_LDFLAGS}" \ ./configure "${OPTS[@]}" Log.info "make log goes to ${MAKELOG}" gmake VERBOSE=1 2>&1 1>${MAKELOG} | tee /tmp/stderr.log } function doPackage { cd ${TMPBUILD}/source || exit 1 clean_dst ${PROTO} gmake install VERBOSE=1 DESTDIR=${PROTO} ${SED} -r -i -e '/^GENLIB/ s,-staticlib=[^ ]+ *,,' \ -e "s,-[IL]${ROOT4BUILD}[^ ]+ *,,g" \ ${PROTO}/usr/lib/icu/${ICU_VERS}/pkgdata.inc ${SED} -i -e '/^prefix/ s,=.*,= @CLIENT_BASEDIR@,' \ -e "/^libdir/ s,$,${ARCH_DIR}," \ ${PROTO}/usr/lib/icu/${ICU_VERS}/Makefile.inc ${SED} -i -e '/^#[^ ]/ d' -e '/^CXX/ s,$,-std=c++03,' \ -e '/# Copy/ {g;N;s|\n|# if in doubts, have a look at ../icu/pkgdata.inc|}' \ -e '/^# end of/ s,^.*,,' -e '/^# C/ d' \ -e '/^prefix/ s,=.*,= @CLIENT_BASEDIR@,' \ -e "/^libdir/ s,$,${ARCH_DIR}," \ ${PROTO}/usr/lib/pkgconfig/*.pc ${SED} -r -i -e '/^default_prefix=/ s,=.*,="@CLIENT_BASEDIR@",' \ -e '/^LDLIBRARYPATH_ENVVAR=/ a\[ "x${LD_LIBRARY_PATH_32}" != "x" -o "x${LD_LIBRARY_PATH_64}" != "x" ] && \ LDLIBRARYPATH_ENVVAR="LD_LIBRARY_PATH_64"' \ -e '/^(CC|CPP)=/ { s, *-std=c99,, ; s, *-D_XPG6,, }' \ -e "/^libdir=/ s,\"$,${ARCH_DIR}\"," \ ${PROTO}/usr/bin/icu-config rm -f ${PROTO}/usr/share/icu/55.1/license.html ln -s ../../doc/icu/license.html ${PROTO}/usr/share/icu/55.1/license.html if [[ -n ${ARCH_DIR} ]]; then mkdir ${PROTO}/usr/lib${ARCH_DIR} mv ${PROTO}/usr/lib/{lib,pkg}* ${PROTO}/usr/lib${ARCH_DIR}/ fi pkginfo2arch cat>${TMPBUILD}/prototype.lnf<>${TMPBUILD}/prototype.lnf cat>${TMPBUILD}/docs.txt<>${TMPBUILD}/prototype.lnf call_pkgmk ${TMPBUILD}/prototype.lnf unrelocate4ips pkginfo.lnf:/local/usr unset PDIRS ; typeset -a PDIRS createIPS -p 'library' -c 'System/Internationalization' -s ${SRCURL} \ -C CVE-2013-5907 -C CVE-2014-6585 -C CVE-2015-1270 -C CVE-2015-2632 \ -C CVE-2015-4760 \ -M usr2local.usr PDIRS publishIPS PDIRS } doBuild "$@"