From 5667eec624f851e8d0441ba5eb9da96233dd6c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Thu, 5 Mar 2009 12:44:17 +0100 Subject: [PATCH] Use the #-character as prefix and suffix for placeholders in master.pike.in instead of the currency sign, to avoid 8-bit character encoding issues. Rev: bin/install.pike:1.200 Rev: lib/master.pike.in:1.461 Rev: packaging/windows/installer.vbs:1.5 Rev: src/Makefile.in:1.473 --- bin/install.pike | 18 +++++----- lib/master.pike.in | 60 +++++++++++++++------------------ packaging/windows/installer.vbs | 27 +++++++++------ src/Makefile.in | 8 ++--- 4 files changed, 56 insertions(+), 57 deletions(-) diff --git a/bin/install.pike b/bin/install.pike index ba8d6d3ab1..b17e268410 100644 --- a/bin/install.pike +++ b/bin/install.pike @@ -2,7 +2,7 @@ // Pike installer and exporter. // -// $Id: install.pike,v 1.199 2008/12/02 05:45:40 peter Exp $ +// $Id: install.pike,v 1.200 2009/03/05 11:36:24 grubba Exp $ // Windows installer FIXMEs: // @@ -2387,17 +2387,17 @@ void make_master(string dest, string master, string lib_prefix, error("Failed to read master template file %O\n", master); } master_data=replace(master_data, ({ - "�lib_prefix�", - "�include_prefix�", - "�share_prefix�", - "�doc_prefix�", - "�cflags�", - "�ldflags�", + "#lib_prefix#", + "#include_prefix#", + "#share_prefix#", + "#doc_prefix#", + "#cflags#", + "#ldflags#", }), ({ replace(lib_prefix,"\\","\\\\"), replace(include_prefix,"\\","\\\\"), - replace(share_prefix||"�share_prefix�", "\\", "\\\\"), - replace(doc_prefix||"�doc_prefix�", "\\", "\\\\"), + replace(share_prefix||"#share_prefix#", "\\", "\\\\"), + replace(doc_prefix||"#doc_prefix#", "\\", "\\\\"), replace(cflags||"", "\\", "\\\\"), replace(ldflags||"", "\\", "\\\\"), })); diff --git a/lib/master.pike.in b/lib/master.pike.in index 1b8eb7fe90..df06ab5cc5 100644 --- a/lib/master.pike.in +++ b/lib/master.pike.in @@ -6,17 +6,11 @@ // Pike is distributed under GPL, LGPL and MPL. See the file COPYING // for more information. // -// $Id: master.pike.in,v 1.460 2008/10/12 21:55:33 mast Exp $ +// $Id: master.pike.in,v 1.461 2009/03/05 11:44:17 grubba Exp $ #pike __REAL_VERSION__ //#pragma strict_types -// Some programs destroys character pairs beginning with the currency -// symbol when running in chinese locale. -#if "�/" != "\244/" -#error "master.pike.in is corrupted." -#endif - //! @appears predef::MasterObject //! //! Master control program for Pike. @@ -163,8 +157,8 @@ protected class Pike_0_5_master object low_cast_to_object(string oname, string current_file); extern array(string) pike_include_path; string pike_library_path = -#if "�lib_prefix�"[0]!='�' - "�lib_prefix�" +#if "#lib_prefix#"[0]!='#' + "#lib_prefix#" #else __DIR__ #endif @@ -2089,33 +2083,33 @@ protected void create() CO(remove_call_out); CO(call_out_info); -#if "�share_prefix�"[0]!='�' +#if "#share_prefix#"[0]!='#' // add path for architecture-independant files - add_include_path("�share_prefix�/include"); - add_module_path("�share_prefix�/modules"); + add_include_path("#share_prefix#/include"); + add_module_path("#share_prefix#/modules"); #endif -#if "�lib_prefix�"[0]!='�' +#if "#lib_prefix#"[0]!='#' // add path for architecture-dependant files - add_include_path("�lib_prefix�/include"); - add_module_path("�lib_prefix�/modules"); + add_include_path("#lib_prefix#/include"); + add_module_path("#lib_prefix#/modules"); #endif -#if "�cflags� "[0]!='�' - cflags = "�cflags�"; +#if "#cflags# "[0]!='#' + cflags = "#cflags#"; #endif -#if "�ldflags� "[0]!='�' - ldflags = "�ldflags�"; +#if "#ldflags# "[0]!='#' + ldflags = "#ldflags#"; #endif -#if "�include_prefix�"[0]!='�' - include_prefix = "�include_prefix�"; +#if "#include_prefix#"[0]!='#' + include_prefix = "#include_prefix#"; cflags = (cflags || "") + " -I" + dirname(include_prefix); #endif -#if "�doc_prefix�"[0]!='�' - doc_prefix = "�doc_prefix�"; +#if "#doc_prefix#"[0]!='#' + doc_prefix = "#doc_prefix#"; #endif #if constant(__embedded_resource_directory) @@ -5599,10 +5593,10 @@ CompatResolver get_compilation_handler(int major, int minor) array(string) files; array(Version) available=({}); -#if "�share_prefix�"[0]!='�' - if (!(files = master_get_dir("�share_prefix�"))) { +#if "#share_prefix#"[0]!='#' + if (!(files = master_get_dir("#share_prefix#"))) { werror ("Error listing directory %O: %s\n", - "�share_prefix�", strerror (errno())); + "#share_prefix#", strerror (errno())); files = ({}); } foreach(files, string ver) @@ -5616,10 +5610,10 @@ CompatResolver get_compilation_handler(int major, int minor) } #endif -#if "�lib_prefix�"[0]!='�' - if (!(files = master_get_dir("�lib_prefix�"))) { +#if "#lib_prefix#"[0]!='#' + if (!(files = master_get_dir("#lib_prefix#"))) { werror ("Error listing directory %O: %s\n", - "�lib_prefix�", strerror (errno())); + "#lib_prefix#", strerror (errno())); files = ({}); } foreach(files, string ver) @@ -5670,14 +5664,14 @@ CompatResolver get_compilation_handler(int major, int minor) } string base; -#if "�lib_prefix�"[0]!='�' - base=combine_path("�lib_prefix�",sprintf("%s",tmp)); +#if "#lib_prefix#"[0]!='#' + base=combine_path("#lib_prefix#",sprintf("%s",tmp)); compat_handler->add_module_path(combine_path(base,"modules")); compat_handler->add_include_path(combine_path(base,"include")); #endif -#if "�share_prefix�"[0]!='�' - base=combine_path("�share_prefix�",sprintf("%s",tmp)); +#if "#share_prefix#"[0]!='#' + base=combine_path("#share_prefix#",sprintf("%s",tmp)); compat_handler->add_module_path(combine_path(base,"modules")); compat_handler->add_include_path(combine_path(base,"include")); #endif diff --git a/packaging/windows/installer.vbs b/packaging/windows/installer.vbs index 7d2f2f5ccd..8ef7667bbd 100644 --- a/packaging/windows/installer.vbs +++ b/packaging/windows/installer.vbs @@ -1,23 +1,28 @@ ' -' $Id: installer.vbs,v 1.4 2008/06/28 19:26:39 mast Exp $ +' $Id: installer.vbs,v 1.5 2009/03/05 11:36:24 grubba Exp $ ' ' Companion file to bin/install.pike for custom actions. ' ' 2004-12-01 Henrik Grubbstr�m ' +Option Compare Binary + ' At call time the CustomActionData property has been set to [TARGETDIR] Function FinalizePike() - Dim fso, targetdir, targetdir_unix, source, dest, re + Dim fso, targetdir, targetdir_unix, source, source_txt, dest, re targetdir = Session.Property("CustomActionData") Set fso = CreateObject("Scripting.FileSystemObject") + ' Note: Opening the files in ASCII-mode, there doesn't seem to be any + ' binary mode. This means that 8-bit characters might get mangled. Set source = fso.OpenTextFile(targetdir & "lib\master.pike.in", 1, False, 0) + Set dest = fso.CreateTextFile(targetdir & "lib\master.pike", 2, True, 0) - Set dest = fso.CreateTextFile(targetdir & "lib\master.pike", True) + source_txt = source.ReadAll - source = source.ReadAll + source.Close Set re = New RegExp re.Global = True @@ -25,16 +30,16 @@ Function FinalizePike() re.Pattern = "\\" targetdir_unix = re.Replace(targetdir, "/") - re.Pattern = "�lib_prefix�" - source = re.Replace(source, targetdir_unix & "lib") + re.Pattern = "#lib_prefix#" + source_txt = re.Replace(source_txt, targetdir_unix & "lib") - re.Pattern = "�include_prefix�" - source = re.Replace(source, targetdir_unix & "include/pike") + re.Pattern = "#include_prefix#" + source_txt = re.Replace(source_txt, targetdir_unix & "include/pike") - 're.Pattern = "�share_prefix�" - 'source = re.Replace(source, "�share_prefix�") + 're.Pattern = "#share_prefix#" + 'source_txt = re.Replace(source_txt, "#share_prefix#") - dest.Write(source) + dest.Write(source_txt) dest.Close ' Warning: It appears to be very difficult to call pike from here to do diff --git a/src/Makefile.in b/src/Makefile.in index bfbda8a91c..c85db689db 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,5 +1,5 @@ # -# $Id: Makefile.in,v 1.472 2009/01/28 16:28:42 agehall Exp $ +# $Id: Makefile.in,v 1.473 2009/03/05 11:36:25 grubba Exp $ # # This line is needed on some machines. @@ -925,9 +925,9 @@ master.pike: $(LIBDIR_SRC)/master.pike.in Makefile else u='s/^#undef PIKE_MODULE_RELOC/#define PIKE_MODULE_RELOC 1/'; \ fi; \ LC_ALL=C; export LC_ALL; \ - cmd="sed -e 's![^ -~]lib_prefix[^ -~]!`echo '$(TMP_LIBDIR)' | ./posix_to_native.sh`!' \ - -e 's![^ -~]share_prefix[^ -~]!`echo '$(LIBDIR_SRC)' | ./posix_to_native.sh`!' \ - -e 's![^ -~]include_prefix[^ -~]!`echo '$(TMP_BUILDDIR)/bundles/include/pike' | ./posix_to_native.sh`!' \ + cmd="sed -e 's!#lib_prefix#!`echo '$(TMP_LIBDIR)' | ./posix_to_native.sh`!' \ + -e 's!#share_prefix#!`echo '$(LIBDIR_SRC)' | ./posix_to_native.sh`!' \ + -e 's!#include_prefix#!`echo '$(TMP_BUILDDIR)/bundles/include/pike' | ./posix_to_native.sh`!' \ -e '$$u'"; \ echo "$$cmd <$(LIBDIR_SRC)/master.pike.in >master.pike"; \ eval $$cmd <$(LIBDIR_SRC)/master.pike.in >master.pike || { rm "master.pike"; exit 1; } -- GitLab