<commit_before>#!/bin/sh

versionfolder='51.1'
version='51_1'
url="http://download.icu-project.org/files/icu4c/$versionfolder/icu4c-$version-src.tgz"
package_filename="icu4c-$version-src.tgz"
arch="x86_64"
sysrootpath="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"

arch_flags=""
for current_arch in $arch ; do
	arch_flags="$arch_flags -arch $current_arch"
done

pushd `dirname $0` > /dev/null
scriptpath=`pwd`
popd > /dev/null
builddir="$scriptpath/../Externals/builds"

#builddir="$HOME/MailCore-Builds/dependencies"
BUILD_TIMESTAMP=`date +'%Y%m%d%H%M%S'`
tempbuilddir="$builddir/workdir/$BUILD_TIMESTAMP"
mkdir -p "$tempbuilddir"
srcdir="$tempbuilddir/src"
logdir="$tempbuilddir/log"
resultdir="$builddir/builds"
tmpdir="$tempbuilddir/tmp"

if test -f "$resultdir/icu4c-$version.zip" ; then
	echo install from cache
	rm -rf ../Externals/icu4c
	mkdir -p ../Externals/tmp
	unzip -q "$resultdir/icu4c-$version.zip" -d ../Externals/tmp
	mv "../Externals/tmp/icu4c-$version/icu4c" ../Externals
	rm -rf ../Externals/tmp
	exit 0
fi

mkdir -p "$resultdir"
mkdir -p "$logdir"
mkdir -p "$tmpdir"
mkdir -p "$srcdir"

pushd . >/dev/null

echo get icu4c
cd "$srcdir"
if test -f "$builddir/downloads/$package_filename" ; then
	cp "$builddir/downloads/$package_filename" .
else
	curl -O "$url"
	if test x$? != x0 ; then
		echo fetch of icu4c failed
		exit 1
	fi
	mkdir -p "$builddir/downloads"
	cp "$package_filename" "$builddir/downloads"
fi

tar xf "$package_filename"

echo building icu4c
cd "$srcdir/icu/source"
for cur_arch in $arch ; do
	cur_arch_flags="-arch $cur_arch"
	echo building icu4c for $cur_arch
	export CFLAGS="$cur_arch_flags -isysroot $sysrootpath -mfix-and-continue -mmacosx-version-min=10.7"
	export CXXFLAGS="$cur_arch_flags -isysroot $sysrootpath -mfix-and-continue -mmacosx-version-min=10.7"
	export LDLAGS="$cur_arch_flags -isysroot $sysrootpath -mfix-and-continue -mmacosx-version-min=10.7"
	mkdir -p "$tmpdir/build/icu4c-$cur_arch"
	cd "$tmpdir/build/icu4c-$cur_arch"
	if test "x$cur_arch" = xx86_64 ; then
		"$srcdir/icu/source/configure" --enable-static --disable-shared --with-data-packaging=archive >> "$logdir/icu4c-build.log"
	else
		"$srcdir/icu/source/configure" --host=$cur_arch-apple-darwin10.6.0 --enable-static --disable-shared --with-data-packaging=archive --with-cross-build=$tmpdir/crossbuild/icu4c-x86_64 >> "$logdir/icu4c-build.log"
	fi
	make >> "$logdir/icu4c-build.log"
	make install "prefix=$tmpdir/bin/icu4c-$cur_arch" >> "$logdir/icu4c-build.log"
	if test "x$cur_arch" = xx86_64 ; then
		make install "prefix=$tmpdir/crossbuild/icu4c-$cur_arch" >> "$logdir/icu4c-build.log"
	fi
	if test x$? != x0 ; then
		echo build of icu4c failed
		exit 1
	fi
	#make distclean
done

mkdir -p "$tmpdir/bin/icu4c"
cp -R "$tmpdir/bin/icu4c-x86_64/include" "$tmpdir/bin/icu4c"
mkdir -p "$tmpdir/bin/icu4c/share/icu"
cp "$tmpdir/bin/icu4c-x86_64/share/icu/$versionfolder/icudt50l.dat" "$tmpdir/bin/icu4c/share/icu"
mkdir -p "$tmpdir/bin/icu4c/lib"
cd "$tmpdir/bin"

icudata_paths="" #
icui18n_paths="" #
icuio_paths=""<commit_msg>Fixed build script for ICU<commit_after>#!/bin/sh

versionfolder='51.1'
version='51_1'
url="http://download.icu-project.org/files/icu4c/$versionfolder/icu4c-$version-src.tgz"
package_filename="icu4c-$version-src.tgz"
arch="x86_64"
sysrootpath="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"

arch_flags=""
for current_arch in $arch ; do
	arch_flags="$arch_flags -arch $current_arch"
done

pushd `dirname $0` > /dev/null
scriptpath=`pwd`
popd > /dev/null
builddir="$scriptpath/../Externals/builds"

#builddir="$HOME/MailCore-Builds/dependencies"
BUILD_TIMESTAMP=`date +'%Y%m%d%H%M%S'`
tempbuilddir="$builddir/workdir/$BUILD_TIMESTAMP"
mkdir -p "$tempbuilddir"
srcdir="$tempbuilddir/src"
logdir="$tempbuilddir/log"
resultdir="$builddir/builds"
tmpdir="$tempbuilddir/tmp"

if test -f "$resultdir/icu4c-$version.zip" ; then
	echo install from cache
	rm -rf ../Externals/icu4c
	mkdir -p ../Externals/tmp
	unzip -q "$resultdir/icu4c-$version.zip" -d ../Externals/tmp
	mv "../Externals/tmp/icu4c-$version/icu4c" ../Externals
	rm -rf ../Externals/tmp
	exit 0
fi

mkdir -p "$resultdir"
mkdir -p "$logdir"
mkdir -p "$tmpdir"
mkdir -p "$srcdir"

pushd . >/dev/null

echo get icu4c
cd "$srcdir"
if test -f "$builddir/downloads/$package_filename" ; then
	cp "$builddir/downloads/$package_filename" .
else
	curl -O "$url"
	if test x$? != x0 ; then
		echo fetch of icu4c failed
		exit 1
	fi
	mkdir -p "$builddir/downloads"
	cp "$package_filename" "$builddir/downloads"
fi

tar xf "$package_filename"

echo building icu4c
cd "$srcdir/icu/source"
for cur_arch in $arch ; do
	cur_arch_flags="-arch $cur_arch"
	echo building icu4c for $cur_arch
	export CFLAGS="$cur_arch_flags -isysroot $sysrootpath -mfix-and-continue -mmacosx-version-min=10.7"
	export CXXFLAGS="$cur_arch_flags -isysroot $sysrootpath -mfix-and-continue -mmacosx-version-min=10.7"
	export LDLAGS="$cur_arch_flags -isysroot $sysrootpath -mfix-and-continue -mmacosx-version-min=10.7"
	mkdir -p "$tmpdir/build/icu4c-$cur_arch"
	cd "$tmpdir/build/icu4c-$cur_arch"
	if test "x$cur_arch" = xx86_64 ; then
		"$srcdir/icu/source/configure" --enable-static --disable-shared --with-data-packaging=archive >> "$logdir/icu4c-build.log"
	else
		"$srcdir/icu/source/configure" --host=$cur_arch-apple-darwin10.6.0 --enable-static --disable-shared --with-data-packaging=archive --with-cross-build=$tmpdir/crossbuild/icu4c-x86_64 >> "$logdir/icu4c-build.log"
	fi
	make >> "$logdir/icu4c-build.log"
	make install "prefix=$tmpdir/bin/icu4c-$cur_arch" >> "$logdir/icu4c-build.log"
	if test "x$cur_arch" = xx86_64 ; then
		make install "prefix=$tmpdir/crossbuild/icu4c-$cur_arch" >> "$logdir/icu4c-build.log"
	fi
	if test x$? != x0 ; then
		echo build of icu4c failed
		exit 1
	fi
	#make distclean
done

mkdir -p "$tmpdir/bin/icu4c"
cp -R "$tmpdir/bin/icu4c-x86_64/include" "$tmpdir/bin/icu4c"
mkdir -p "$tmpdir/bin/icu4c/share/icu"
cp "$tmpdir/bin/icu4c-x86_64/share/icu/$versionfolder/icudt51l.dat" "$tmpdir/bin/icu4c/share/icu"
mkdir -p "$tmpdir/bin/icu4c/lib"
cd "$tmpdir/bin"

icudata_paths="" #
icui18n_paths="" #
icuio_paths=""
{'fraction_non_alphanumeric': 0.16535306417886442, 'fraction_numerical': 0.027666076885957857, 'mean_word_length': 4.72033118675253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6621515', 'n_tokens_mistral': 2700, 'n_tokens_neox': 2584, 'n_words': 463}