summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu-xetex/tools/genren
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2008-03-04 13:26:36 +0000
committerJonathan Kew <jfkthame@googlemail.com>2008-03-04 13:26:36 +0000
commit53790d2a0c50915d8cec71df3e89cd24d887b2fe (patch)
tree16f6b4df067eb3c2024e0a7735cb7ccea86b3aba /Build/source/libs/icu-xetex/tools/genren
parentf483a5de9331a257f597282e611ecfb63f5ab118 (diff)
update icu-xetex to 3.8.1-based code from xetex repository
git-svn-id: svn://tug.org/texlive/trunk@6842 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/icu-xetex/tools/genren')
-rw-r--r--Build/source/libs/icu-xetex/tools/genren/Makefile79
-rw-r--r--Build/source/libs/icu-xetex/tools/genren/README22
-rwxr-xr-xBuild/source/libs/icu-xetex/tools/genren/genren.pl171
3 files changed, 272 insertions, 0 deletions
diff --git a/Build/source/libs/icu-xetex/tools/genren/Makefile b/Build/source/libs/icu-xetex/tools/genren/Makefile
new file mode 100644
index 00000000000..53e196c538a
--- /dev/null
+++ b/Build/source/libs/icu-xetex/tools/genren/Makefile
@@ -0,0 +1,79 @@
+#******************************************************************************
+#
+# Copyright (C) 2002-2007, International Business Machines
+# Corporation and others. All Rights Reserved.
+#
+#******************************************************************************
+
+ICUDIR=ICUunrenamed
+TOP=../..
+SO=so
+
+COM=$(ICUDIR)/lib/libicuuc.$(SO)
+I18=$(ICUDIR)/lib/libicui18n.$(SO)
+LAY=$(ICUDIR)/lib/libicule.$(SO)
+LEX=$(ICUDIR)/lib/libiculx.$(SO)
+DAT=$(ICUDIR)/stubdata/libicudata.$(SO)
+UIO=$(ICUDIR)/lib/libicuio.$(SO)
+
+LIBS=$(COM) $(I18) $(LAY) $(LEX) $(UIO)
+
+# Extra flags to prevent internal API from being hidden.
+# This is important because ELF (Linux) based platforms that don't hide internal
+# API will allow a duplicate internal name to resolve to an external library.
+# See the gcc manual on the "visibility" attribute for details.
+FLAG_OVERRIDE="LIBCFLAGS= LIBCXXFLAGS="
+
+all:
+ @cat README
+
+clean:
+ -rm -rf $(ICUDIR) urename.* *~
+
+# We use config.status to mean we have a valid out of source tree.
+
+$(ICUDIR)/config.status:
+ -mv $(ICUDIR) $(ICUDIR)old
+ -(rm -rf $(ICUDIR)old &)
+ mkdir $(ICUDIR)
+ ( cd $(ICUDIR) ; CPPFLAGS=-DURENAME_H $(TOP)/../configure --with-data-packaging=archive --enable-tests=no --prefix=`pwd` $(GENREN_CONFIGURE_OPTS) )
+
+# build the libraries
+$(DAT): $(ICUDIR)/config.status Makefile
+ gmake $(FLAG_OVERRIDE) -C $(ICUDIR)/stubdata libicudata.$(SO)
+
+$(COM): $(DAT) $(ICUDIR)/config.status Makefile
+ gmake $(FLAG_OVERRIDE) -C $(ICUDIR)/common libicuuc.$(SO)
+
+$(I18): $(DAT) $(COM) $(ICUDIR)/config.status Makefile
+ gmake $(FLAG_OVERRIDE) -C $(ICUDIR)/i18n libicui18n.$(SO)
+
+$(LAY): $(DAT) $(I18) $(COM) $(ICUDIR)/config.status Makefile
+ gmake $(FLAG_OVERRIDE) -C $(ICUDIR)/layout libicule.$(SO)
+
+$(LEX): $(DAT) $(I18) $(COM) $(ICUDIR)/config.status Makefile
+ gmake $(FLAG_OVERRIDE) -C $(ICUDIR)/layoutex libiculx.$(SO)
+
+$(UIO): $(DAT) $(I18) $(COM) $(ICUDIR)/config.status Makefile
+ gmake $(FLAG_OVERRIDE) -C $(ICUDIR)/io libicuio.$(SO)
+
+# the header itself
+urename.h: $(LIBS) genren.pl
+ -cp urename.h urename.h.old
+ perl ./genren.pl $(LIBS)
+
+sorts: urename.sort urename.old.sort
+ @echo "*** Please check urename.h manually before committing it."
+ @echo "Try 'diff --side-by-side urename.old.sort urename.sort'"
+
+urename.sort: urename.h
+ sort urename.h > $@
+
+urename.old.sort: $(TOP)/common/unicode/urename.h
+ sort $(TOP)/common/unicode/urename.h > $@
+
+install-header: urename.h sorts
+ cp $(TOP)/common/unicode/urename.h $(TOP)/common/unicode/urename.h.old
+ cp urename.h $(TOP)/common/unicode/
+
+
diff --git a/Build/source/libs/icu-xetex/tools/genren/README b/Build/source/libs/icu-xetex/tools/genren/README
new file mode 100644
index 00000000000..a289dbc538c
--- /dev/null
+++ b/Build/source/libs/icu-xetex/tools/genren/README
@@ -0,0 +1,22 @@
+Copyright (c) 2002, International Business Machines Corporation and others. All Rights Reserved.
+The genren.pl script is used to generate source/common/unicode/urename.h header file, which is needed for renaming the ICU exported names.
+
+This script is intended to be used on Linux, although it should work on any platform that has Perl and nm command. Makefile may need to be updated, it's not 100% portable.
+
+The following instructions are for Linux version.
+- urename.h file should be generated after implementation is complete for a release.
+- the version number for a release should be set according to the list in source/common/unicode/uversion.h
+- In this [genren] directory, run
+
+ "make install-header"
+
+- urename.h will be updated in icu/source/common/unicode/urename.h **in your original source directory**
+- Eyeball the new file for errors - you can compare it to icu/source/common/unicode/urename.h.old
+- Another good way to check the file is a side by side diff. After the above 'make install-header':
+
+ diff --side-by-side urename.sort urename.old.sort | more
+
+- Other make targets here
+
+ clean - cleans out intermediate files
+ urename.h -just builds ./urename.h
diff --git a/Build/source/libs/icu-xetex/tools/genren/genren.pl b/Build/source/libs/icu-xetex/tools/genren/genren.pl
new file mode 100755
index 00000000000..181491fa97a
--- /dev/null
+++ b/Build/source/libs/icu-xetex/tools/genren/genren.pl
@@ -0,0 +1,171 @@
+#!/usr/bin/perl
+#*
+#*******************************************************************************
+#* Copyright (C) 2001-2007, International Business Machines
+#* Corporation and others. All Rights Reserved.
+#*******************************************************************************
+#*
+#* file name: genren.pl
+#* encoding: US-ASCII
+#* tab size: 8 (not used)
+#* indentation:4
+#*
+#* Created by: Vladimir Weinstein
+#* 07/19/2001
+#*
+#* Used to generate renaming headers.
+#* Run on UNIX platforms (linux) in order to catch all the exports
+
+$headername = 'urename.h';
+
+$path = substr($0, 0, rindex($0, "/")+1)."../../common/unicode/uversion.h";
+
+(-e $path) || die "Cannot find uversion.h";
+
+open(UVERSION, $path);
+
+while(<UVERSION>) {
+ if(/\#define U_ICU_VERSION_SUFFIX/) {
+ chop;
+ s/\#define U_ICU_VERSION_SUFFIX //;
+ $U_ICU_VERSION_SUFFIX = "$_";
+ last;
+ }
+}
+
+while($ARGV[0] =~ /^-/) { # detects whether there are any arguments
+ $_ = shift @ARGV; # extracts the argument for processing
+ /^-v/ && ($VERBOSE++, next); # verbose
+ /^-h/ && (&printHelpMsgAndExit, next); # help
+ /^-o/ && (($headername = shift (@ARGV)), next); # output file
+ /^-S/ && (($U_ICU_VERSION_SUFFIX = shift(@ARGV)), next); # pick the suffix
+ warn("Invalid option $_\n");
+ &printHelpMsgAndExit;
+}
+
+unless(@ARGV > 0) {
+ warn "No libraries, exiting...\n";
+ &printHelpMsgAndExit;
+}
+
+#$headername = "uren".substr($ARGV[0], 6, index(".", $ARGV[0])-7).".h";
+
+$HEADERDEF = uc($headername); # this is building the constant for #define
+$HEADERDEF =~ s/\./_/;
+
+
+ open HEADER, ">$headername"; # opening a header file
+
+#We will print our copyright here + warnings
+print HEADER <<"EndOfHeaderComment";
+/*
+*******************************************************************************
+* Copyright (C) 2002-2007, International Business Machines
+* Corporation and others. All Rights Reserved.
+*******************************************************************************
+*
+* file name: $headername
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* Created by: Perl script written by Vladimir Weinstein
+*
+* Contains data for renaming ICU exports.
+* Gets included by umachine.h
+*
+* THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT
+* YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN!
+*/
+
+#ifndef $HEADERDEF
+#define $HEADERDEF
+
+/* Uncomment the following line to disable renaming on platforms
+ that do not use Autoconf. */
+/* #define U_DISABLE_RENAMING 1 */
+
+#if !U_DISABLE_RENAMING
+EndOfHeaderComment
+
+for(;@ARGV; shift(@ARGV)) {
+ @NMRESULT = `nm -Cg -f s $ARGV[0]`;
+ if($?) {
+ warn "Couldn't do 'nm' for $ARGV[0], continuing...\n";
+ next; # Couldn't do nm for the file
+ }
+ splice @NMRESULT, 0, 6;
+
+ foreach (@NMRESULT) { # Process every line of result and stuff it in $_
+ ($_, $address, $type) = split(/\|/);
+ &verbose( "type: \"$type\" ");
+ if(!($type =~ /[UAwW?]/)) {
+ if(/@@/) { # These would be imports
+ &verbose( "Import: $_ \"$type\"\n");
+ } elsif (/::/) { # C++ methods, stuff class name in associative array
+ &verbose( "C++ method: $_\n");
+ ## icu_2_0::CharString::~CharString(void) -> CharString
+ @CppName = split(/::/); ## remove scope stuff
+ if(@CppName>1) {
+ ## MessageFormat virtual table -> MessageFormat
+ @CppName = split(/ /, $CppName[1]); ## remove debug stuff
+ }
+ ## ures_getUnicodeStringByIndex(UResourceBundle -> ures_getUnicodeStringByIndex
+ @CppName = split(/\(/, $CppName[0]); ## remove function args
+ $CppClasses{$CppName[0]}++;
+ } elsif ( /\(/) { # These are strange functions
+ print STDERR "$_\n";
+ } elsif ( /icu_/) {
+ print STDERR "Skipped strange mangled function $_\n";
+ } else { # This is regular C function
+ &verbose( "C func: $_\n");
+ @funcname = split(/[\(\s+]/);
+ $CFuncs{$funcname[0]}++;
+ }
+ } else {
+ &verbose( "Skipped: $_ $1\n");
+ }
+ }
+}
+
+print HEADER "\n/* C exports renaming data */\n\n";
+foreach(sort keys(%CFuncs)) {
+ print HEADER "#define $_ $_$U_ICU_VERSION_SUFFIX\n";
+}
+
+print HEADER "/* C++ class names renaming defines */\n\n";
+print HEADER "#ifdef XP_CPLUSPLUS\n";
+print HEADER "#if !U_HAVE_NAMESPACE\n\n";
+foreach(sort keys(%CppClasses)) {
+ print HEADER "#define $_ $_$U_ICU_VERSION_SUFFIX\n";
+}
+print HEADER "\n#endif\n";
+print HEADER "#endif\n";
+print HEADER "\n#endif\n";
+print HEADER "\n#endif\n";
+
+close HEADER;
+
+sub verbose {
+ if($VERBOSE) {
+ print STDERR @_;
+ }
+}
+
+
+sub printHelpMsgAndExit {
+ print STDERR <<"EndHelpText";
+Usage: $0 [OPTIONS] LIBRARY_FILES
+ Options:
+ -v - verbose
+ -h - help
+ -o - output file name (defaults to 'urename.h'
+ -S - suffix (defaults to _MAJOR_MINOR of current ICU version)
+Will produce a renaming .h file
+
+EndHelpText
+
+ exit 0;
+
+}
+