On Sunday 03 April 2005 14:06, Ron Blaschke wrote:
> I'd reckon once C<--without-icu> is in place, one should be able to
> run
>
>     $rm -rf icu
>     $perl Configure --without-icu --nomanicheck
>
> So it shouldn't really matter when exactly F<icu/> is removed.
Hmm, okay. Thats indeed true.

I've attached the patch that implements --without-icu.
Comments welcome.

> Just my thoughts,
> Ron
jens
Index: Configure.pl
===================================================================
RCS file: /cvs/public/parrot/Configure.pl,v
retrieving revision 1.150
diff -u -w -r1.150 Configure.pl
--- Configure.pl	17 Jan 2005 14:01:58 -0000	1.150
+++ Configure.pl	3 Apr 2005 13:39:13 -0000
@@ -359,6 +359,7 @@
 
    If you do not have a full ICU installation:
 
+   --without-icu        Build parrot without ICU support
    --icuheaders=(path)  Location of ICU headers without /unicode
    --icushared=(flags)  Full linker command to create shared libraries
    --icudatadir=(path)  Directory to locate ICU's data file(s)
Index: config/gen/config_h.pl
===================================================================
RCS file: /cvs/public/parrot/config/gen/config_h.pl,v
retrieving revision 1.14
diff -u -w -r1.14 config_h.pl
--- config/gen/config_h.pl	8 Mar 2005 22:52:07 -0000	1.14
+++ config/gen/config_h.pl	3 Apr 2005 13:39:13 -0000
@@ -30,7 +30,8 @@
 
   genfile('config/gen/config_h/config_h.in', 'include/parrot/config.h',
     commentType => '/*',
-    ignorePattern => 'PARROT_CONFIG_DATE');
+    ignorePattern => 'PARROT_CONFIG_DATE',
+    conditioned_lines => 1);
 
   genfile('config/gen/config_h/feature_h.in', 'include/parrot/feature.h',
     commentType => '/*',
Index: config/gen/icu.pl
===================================================================
RCS file: /cvs/public/parrot/config/gen/icu.pl,v
retrieving revision 1.25
diff -u -w -r1.25 icu.pl
--- config/gen/icu.pl	8 Mar 2005 22:52:07 -0000	1.25
+++ config/gen/icu.pl	3 Apr 2005 13:39:13 -0000
@@ -20,11 +20,11 @@
 $description="Configuring ICU if requested...";
 
 @args=qw(buildicu verbose icudatadir icuplatform icuconfigureargs
-         icushared icuheaders icu-config);
+         icushared icuheaders icu-config without-icu);
 
 sub runstep {
   my ($buildicu, $verbose, $icudatadir, $icuplatform, $icuconfigureargs,
-           $icushared, $icuheaders, $icuconfig) = @_;
+           $icushared, $icuheaders, $icuconfig, $without) = @_;
   my $icu_configure_command;
   my @icu_headers = qw(ucnv.h utypes.h uchar.h);
   my $autodetect = !defined($icudatadir)
@@ -33,6 +33,14 @@
 	        && !defined($icuheaders);
 
   print "\n" if $verbose;
+  Configure::Data->set(
+    has_icu => ($without ? 0 : 1),
+    TEMP_icu_make => ""
+  );
+  if ($without) {
+    print "not using icu.\n" if $verbose;
+    return 0;
+  }
 
   if (!$autodetect) {
     print "specified a icu config parameter,\nICU autodetection disabled.\n"
Index: config/gen/makefiles.pl
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles.pl,v
retrieving revision 1.43
diff -u -w -r1.43 makefiles.pl
--- config/gen/makefiles.pl	16 Mar 2005 22:09:04 -0000	1.43
+++ config/gen/makefiles.pl	3 Apr 2005 13:39:14 -0000
@@ -81,7 +81,7 @@
   genfile('config/gen/makefiles/dynclasses.in',   'dynclasses/Makefile',
           commentType => '#', replace_slashes => 1, conditioned_lines => 1);
   genfile('config/gen/makefiles/dynclasses_pl.in',   'dynclasses/build.pl',
-          commentType => '#', replace_slashes => 0);
+          commentType => '#', replace_slashes => 0, conditioned_lines => 1);
   genfile('config/gen/makefiles/dynoplibs.in',   'dynoplibs/Makefile',
           commentType => '#', replace_slashes => 1);
   genfile('config/gen/makefiles/parrot_compiler.in', 'languages/parrot_compiler/Makefile',
Index: config/gen/config_h/config_h.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/config_h/config_h.in,v
retrieving revision 1.27
diff -u -w -r1.27 config_h.in
--- config/gen/config_h/config_h.in	23 Mar 2005 21:28:06 -0000	1.27
+++ config/gen/config_h/config_h.in	3 Apr 2005 13:39:14 -0000
@@ -134,7 +134,8 @@
 #define PARROT_CORE_CG_OPLIB_INIT Parrot_DynOp_core_cg_${MAJOR}_${MINOR}_${PATCH}
 #define PARROT_CORE_CGP_OPLIB_INIT Parrot_DynOp_core_cgp_${MAJOR}_${MINOR}_${PATCH}
 
-#define DEFAULT_ICU_DATA_DIR "${icudatadir}"
+#define PARROT_HAS_ICU ${has_icu}
+#CONDITIONED_LINE(has_icu):#define DEFAULT_ICU_DATA_DIR "${icudatadir}"
 
 #define INTVAL_FMT "${intvalfmt}"
 #define FLOATVAL_FMT "${floatvalfmt}"
Index: config/gen/makefiles/dynclasses_pl.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/dynclasses_pl.in,v
retrieving revision 1.12
diff -u -w -r1.12 dynclasses_pl.in
--- config/gen/makefiles/dynclasses_pl.in	21 Feb 2005 10:54:39 -0000	1.12
+++ config/gen/makefiles/dynclasses_pl.in	3 Apr 2005 13:39:14 -0000
@@ -40,8 +40,9 @@
     $PATHQUOTE = '"';
     
     # Also need various libraries in the link line.
-    my $extraLibs = '${blib_lib_libparrot_a} ${blib_lib_libsicuuc_a} ' . 
-                     '${blib_lib_libsicudata_a} ${libs}';
+    my $extraLibs = '${blib_lib_libparrot_a} '.
+#CONDITIONED_LINE(has_icu):                    '${blib_lib_libsicuuc_a} ${blib_lib_libsicudata_a} ' . 
+		    '${libs}';
     $extraLibs =~ s/blib/..\\blib/g;
     $extraLibs =~ s/\Q$(A)\E/.lib/g;
     $LD_LOAD_FLAGS =~ s/(-def:)/$extraLibs $1..\\/;
Index: config/gen/makefiles/root.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v
retrieving revision 1.288
diff -u -w -r1.288 root.in
--- config/gen/makefiles/root.in	31 Mar 2005 11:23:04 -0000	1.288
+++ config/gen/makefiles/root.in	3 Apr 2005 13:39:15 -0000
@@ -318,7 +318,7 @@
 
 # generated list of header files
 GENERAL_H_FILES   = $(NONGEN_HEADERS) $(GEN_HEADERS) ${TEMP_cg_h}
-ICU_H_FILES       = ${icu_headers}
+#CONDITIONED_LINE(has_icu):ICU_H_FILES       = ${icu_headers}
 ALL_H_FILES       = $(GENERAL_H_FILES)
 
 CHARSET_O_FILES   = ${TEMP_charset_o}
@@ -439,9 +439,10 @@
 
 # libs
 LIBPARROT       = ${blib_lib_libparrot_a}
-LIBICUCORE      = ${blib_lib_libsicuuc_a}
-LIBICUDATA      = ${blib_lib_libsicudata_a}
-ALL_PARROT_LIBS = $(LIBPARROT) $(LIBICUCORE) $(LIBICUDATA) $(C_LIBS)
+#CONDITIONED_LINE(has_icu):LIBICUCORE      = ${blib_lib_libsicuuc_a}
+#CONDITIONED_LINE(has_icu):LIBICUDATA      = ${blib_lib_libsicudata_a}
+#CONDITIONED_LINE(has_icu):ALL_PARROT_LIBS = $(LIBPARROT) $(LIBICUCORE) $(LIBICUDATA) $(C_LIBS)
+#INVERSE_CONDITIONED_LINE(has_icu):ALL_PARROT_LIBS = $(LIBPARROT) $(C_LIBS)
 
 # dynamic extensions
 DYNEXT_DIR      = runtime/parrot/dynext
Index: src/string.c
===================================================================
RCS file: /cvs/public/parrot/src/string.c,v
retrieving revision 1.244
diff -u -w -r1.244 string.c
--- src/string.c	2 Mar 2005 17:00:51 -0000	1.244
+++ src/string.c	3 Apr 2005 13:39:20 -0000
@@ -286,7 +286,7 @@
          */
         Parrot_charsets_encodings_init(interpreter);
 
-
+#if PARROT_HAS_ICU
         /* DEFAULT_ICU_DATA_DIR is configured at build time, or it may be
            set through the $PARROT_ICU_DATA_DIR environment variable. Need
            a way to specify this via the command line as well. */
@@ -316,6 +316,7 @@
 no_set:
         if (free_data_dir)
             mem_sys_free((void*)data_dir); /* cast away the constness */
+#endif
     }
 
     /*
Index: src/string_primitives.c
===================================================================
RCS file: /cvs/public/parrot/src/string_primitives.c,v
retrieving revision 1.12
diff -u -w -r1.12 string_primitives.c
--- src/string_primitives.c	2 Mar 2005 15:32:59 -0000	1.12
+++ src/string_primitives.c	3 Apr 2005 13:39:20 -0000
@@ -20,10 +20,14 @@
 */
 
 #include "parrot/parrot.h"
+#if PARROT_HAS_ICU
 #include <unicode/ucnv.h>
 #include <unicode/utypes.h>
 #include <unicode/uchar.h>
 #include <unicode/ustring.h>
+#else
+#include <ctype.h>
+#endif
 #include <assert.h>
 
 /*
@@ -41,6 +45,7 @@
 void
 string_set_data_directory(const char *dir)
 {
+#if PARROT_HAS_ICU
     u_setDataDirectory(dir);
 
     /* Since u_setDataDirectory doesn't have a result code, we'll spot
@@ -54,6 +59,10 @@
                 "string_set_data_directory: ICU data files not found"
                 "(apparently) for directory [%s]", dir);
     }
+#else
+    internal_exception(ICU_ERROR,
+        "string_set_data_directory: parrot compiled without ICU support" );
+#endif
 }
 
 /*
@@ -73,6 +82,7 @@
 string_fill_from_buffer(Interp *interpreter, const void *buffer,
             UINTVAL len, const char *encoding_name, STRING *s)
 {
+#if PARROT_HAS_ICU
     UErrorCode icuError = U_ZERO_ERROR;
     UConverter *conv = NULL;
     UChar *target = NULL;
@@ -140,6 +150,10 @@
     /* temporary; need to promote to rep 4 if has non-BMP characters*/
     s->bufused = (char *)target - (char *)s->strstart;
     string_compute_strlen(interpreter, s);
+#else
+    internal_exception(ICU_ERROR,
+        "string_fill_from_buffer: parrot compiled without ICU support" );
+#endif
 }
 
 
@@ -360,7 +374,13 @@
 UINTVAL
 Parrot_char_digit_value(Interp *interpreter, UINTVAL character)
 {
+#if PARROT_HAS_ICU
     return u_charDigitValue(character);
+#else
+    if ((character >= 0x30) || (character <= 0x39))
+        return character - 0x30;
+    return -1;
+#endif
 }
 
 /*
@@ -377,7 +397,11 @@
 INTVAL
 Parrot_char_is_alnum(Interp *interpreter, UINTVAL character)
 {
+#if PARROT_HAS_ICU
     return u_isalnum(character);
+#else
+    return isalnum(character);
+#endif
 }
 
 /*
@@ -394,7 +418,11 @@
 INTVAL
 Parrot_char_is_alpha(Interp *interpreter, UINTVAL character)
 {
+#if PARROT_HAS_ICU
     return u_isalpha(character);
+#else
+    return isalpha(character);
+#endif
 }
 
 /*
@@ -429,7 +457,11 @@
 INTVAL
 Parrot_char_is_blank(Interp *interpreter, UINTVAL character)
 {
+#if PARROT_HAS_ICU
     return u_isblank(character);
+#else
+    return isblank(character);
+#endif
 }
 
 /*
@@ -446,7 +478,11 @@
 INTVAL
 Parrot_char_is_cntrl(Interp *interpreter, UINTVAL character)
 {
+#if PARROT_HAS_ICU
     return u_iscntrl(character);
+#else
+    return iscntrl(character);
+#endif
 }
 
 /*
@@ -463,7 +499,11 @@
 INTVAL
 Parrot_char_is_digit(Interp *interpreter, UINTVAL character)
 {
+#if PARROT_HAS_ICU
     return u_isdigit(character);
+#else
+    return isdigit(character);
+#endif
 }
 
 /*
@@ -481,7 +521,11 @@
 INTVAL
 Parrot_char_is_graph(Interp *interpreter, UINTVAL character)
 {
+#if PARROT_HAS_ICU
 	return u_isgraph(character);
+#else
+    return isgraph(character);
+#endif
 }
 
 /*
@@ -498,7 +542,11 @@
 INTVAL
 Parrot_char_is_lower(Interp *interpreter, UINTVAL character)
 {
+#if PARROT_HAS_ICU
     return u_islower(character);
+#else
+    return islower(character);
+#endif
 }
 
 /*
@@ -515,7 +563,11 @@
 INTVAL
 Parrot_char_is_print(Interp *interpreter, UINTVAL character)
 {
+#if PARROT_HAS_ICU
 	return u_isprint(character);
+#else
+    return isprint(character);
+#endif
 }
 
 /*
@@ -532,7 +584,11 @@
 INTVAL
 Parrot_char_is_punct(Interp *interpreter, UINTVAL character)
 {
+#if PARROT_HAS_ICU
     return u_ispunct(character);
+#else
+    return ispunct(character);
+#endif
 }
 
 /*
@@ -549,7 +605,11 @@
 INTVAL
 Parrot_char_is_space(Interp *interpreter, UINTVAL character)
 {
+#if PARROT_HAS_ICU
     return u_isspace(character);
+#else
+    return isspace(character);
+#endif
 }
 
 /*
@@ -566,7 +626,11 @@
 INTVAL
 Parrot_char_is_upper(Interp *interpreter, UINTVAL character)
 {
+#if PARROT_HAS_ICU
     return u_isupper(character);
+#else
+    return isupper(character);
+#endif
 }
 
 /*
@@ -583,7 +647,11 @@
 INTVAL
 Parrot_char_is_xdigit(Interp *interpreter, UINTVAL character)
 {
+#if PARROT_HAS_ICU
     return u_isxdigit(character);
+#else
+    return isxdigit(character);
+#endif
 }
 
 /*

Reply via email to