diff --git a/win32libs/gettext/0001-moopp-sed-extended-regexp.patch b/win32libs/gettext/0001-moopp-sed-extended-regexp.patch new file mode 100644 index 00000000..b495770a --- /dev/null +++ b/win32libs/gettext/0001-moopp-sed-extended-regexp.patch @@ -0,0 +1,126 @@ +diff -Nrub -x '*~' -x '*\.rej' -x '*\.orig' -x'*\.o' -x '*\.pyc' gettext-0.19.8.1.orig/build-aux/moopp gettext-0.19.8.1/build-aux/moopp +--- gettext-0.19.8.1.orig/build-aux/moopp 2016-03-20 08:37:53.000000000 +0100 ++++ gettext-0.19.8.1/build-aux/moopp 2018-03-14 17:44:12.000000000 +0100 +@@ -43,6 +43,11 @@ + # - ... + # Someday this should be rewritten to use a proper tokenizer and parser. + ++alias sed='sed --regexp-extended' ++if [ $(uname) == "Darwin" ]; then ++ alias sed='sed -E' ++fi ++ + # func_usage + # outputs to stdout the --help usage message. + func_usage () +@@ -152,7 +157,7 @@ + sed_remove_empty_lines='/^$/d' + + # A sed expression that removes ANSI C and ISO C99 comments. +-sed_remove_comments=" ++sed_remove_comments_RE=" + /[/][/*]/{ + ta + :a +@@ -175,7 +180,7 @@ + }" + # The same thing as an extended regular expression, for use with + # sed --regexp-extended. +-sed_remove_comments_ERE=" ++sed_remove_comments=" + /[/][/*]/{ + ta + :a +@@ -200,7 +205,7 @@ + # Check that 'sed' supports the kind of regular expressions used in + # sed_remove_comments. The use of \| meaning alternation of basic regular + # expressions is a GNU extension. +-sed_test='s,^\(\(a\|X\)*\)//.*,\1,' ++sed_test='s,^((a|X)*)//.*,\1,' + sed_result=`echo 'aaa//bcd' | sed -e "$sed_test"` + test "$sed_result" = 'aaa' \ + || func_fatal_error "The 'sed' program is not GNU sed. Try installing GNU sed." +@@ -230,14 +235,14 @@ + func_fatal_error "$file: class declaration not found" + } + class_line=`sed -e "$sed_remove_comments" < "$file" | sed -n -e "$impl_decl_lineno"'p'` +- sed_extract_classname='s,^struct[ ][ ]*\([A-Za-z_0-9]*\).*,\1,p' ++ sed_extract_classname='s,^struct[ ][ ]*([A-Za-z_0-9]*).*,\1,p' + classname=`echo "$class_line" | sed -n -e "$sed_extract_classname"` + test -n "$classname" || { + func_fatal_error "$0: $file: class name not recognized at line $impl_decl_lineno" + } + superclassname= + if echo "$class_line" | grep ':' > /dev/null; then +- sed_extract_superclassname='s,^.*:[ ]*struct[ ][ ]*\([A-Za-z_0-9]*\).*,\1,p' ++ sed_extract_superclassname='s,^.*:[ ]*struct[ ][ ]*([A-Za-z_0-9]*).*,\1,p' + superclassname=`echo "$class_line" | sed -n -e "$sed_extract_superclassname"` + test -n "$superclassname" || { + func_fatal_error "$file: superclass name not recognized at line $impl_decl_lineno" +@@ -282,14 +287,14 @@ + func_fatal_error "$file: class declaration not found" + } + class_line=`sed -e "$sed_remove_comments" < "$file" | sed -n -e "$class_decl_lineno"'p'` +- sed_extract_classname='s,^struct[ ][ ]*\([A-Za-z_0-9]*\).*,\1,p' ++ sed_extract_classname='s,^struct[ ][ ]*([A-Za-z_0-9]*).*,\1,p' + classname=`echo "$class_line" | sed -n -e "$sed_extract_classname"` + test -n "$classname" || { + func_fatal_error "$0: $file: class name not recognized at line $class_decl_lineno" + } + superclassname= + if echo "$class_line" | grep ':' > /dev/null; then +- sed_extract_superclassname='s,^.*:[ ]*struct[ ][ ]*\([A-Za-z_0-9]*\).*,\1,p' ++ sed_extract_superclassname='s,^.*:[ ]*struct[ ][ ]*([A-Za-z_0-9]*).*,\1,p' + superclassname=`echo "$class_line" | sed -n -e "$sed_extract_superclassname"` + test -n "$superclassname" || { + func_fatal_error "$file: superclass name not recognized at line $class_decl_lineno" +@@ -307,11 +312,11 @@ + class_end_lineno=`expr $methods_lineno + $class_end_lineno` + sed_extract_methods="$class_end_lineno"',$d;1,'"$methods_lineno"'d' + methods=`sed -e "$sed_remove_comments" < "$file" | sed -e "$sed_extract_methods" | tr '\015\n' ' ' | tr ';' '\n' | sed -e 's,[ ]*$,,'` +- sed_remove_valid_arg1_lines='/([ ]*'"$classname"'_t[ ]*[A-Za-z_0-9]*[ ]*[,)]/d' +- sed_extract_method_name='s,^.*[^A-Za-z_0-9]\([A-Za-z_0-9][A-Za-z_0-9]*\)[ ]*(.*$,\1,' ++ sed_remove_valid_arg1_lines='/\([ ]*'"$classname"'_t[ ]*[A-Za-z_0-9]*[ ]*[,\)]/d' ++ sed_extract_method_name='s,^.*[^A-Za-z_0-9]([A-Za-z_0-9][A-Za-z_0-9]*)[ ]*\(.*$,\1,' + methods_with_bad_arg1=`echo "$methods" | sed -e "$sed_remove_empty_lines" -e "$sed_remove_valid_arg1_lines" -e "$sed_extract_method_name"` + if test -n "$methods_with_bad_arg1"; then +- methods_with_bad_arg1=`{ echo "$methods_with_bad_arg1" | sed -e 's/$/, /' | tr -d '\015\n'; echo; } | sed -e 's/\(, \)*$//'` ++ methods_with_bad_arg1=`{ echo "$methods_with_bad_arg1" | sed -e 's/$/, /' | tr -d '\015\n'; echo; } | sed -e 's/(, \)*$//'` + func_fatal_error "$file: some methods don't have a first argument of type ${classname}_t: $methods_with_bad_arg1" + fi + } +@@ -421,7 +426,7 @@ + echo + fi + echo "/* Virtual function table layout of ${main_classname} class. */" +- echo "$main_methods" | sed -e "$sed_remove_empty_lines" -e 's/\([^A-Za-z_0-9]\)\([A-Za-z_0-9][A-Za-z_0-9]*\)[ ]*([^,)]*/\1(*\2) (THIS_ARG/' -e 's,$,;,' ++ echo "$main_methods" | sed -e "$sed_remove_empty_lines" -e 's/([^A-Za-z_0-9])([A-Za-z_0-9][A-Za-z_0-9]*)[ ]*\([^,\)]*/\1\(*\2\) (THIS_ARG/' -e 's,$,;,' + } > "$newfile" + } + +@@ -436,12 +441,12 @@ + main_repclassalias="${main_classname}_representation" + fi + +-sed_extract_method_rettype='s,^\(.*[^A-Za-z_0-9]\)[A-Za-z_0-9][A-Za-z_0-9]*[ ]*(.*$,\1, ++sed_extract_method_rettype='s,^(.*[^A-Za-z_0-9])[A-Za-z_0-9][A-Za-z_0-9]*[ ]*\(.*$,\1, + s,^[ ]*,, + s,[ ]*$,,' +-sed_extract_method_name='s,^.*[^A-Za-z_0-9]\([A-Za-z_0-9][A-Za-z_0-9]*\)[ ]*(.*$,\1,' +-sed_extract_method_arglist='s,^.*[^A-Za-z_0-9][A-Za-z_0-9][A-Za-z_0-9]*[ ]*([^,)]*\(.*\)).*$,'"${main_classname}_t"' first_arg\1,' +-sed_extract_method_args='s,^.*[^A-Za-z_0-9]\([A-Za-z_0-9][A-Za-z_0-9]*\)$,\1,' ++sed_extract_method_name='s,^.*[^A-Za-z_0-9]([A-Za-z_0-9][A-Za-z_0-9]*)[ ]*\(.*$,\1,' ++sed_extract_method_arglist='s,^.*[^A-Za-z_0-9][A-Za-z_0-9][A-Za-z_0-9]*[ ]*\([^,\)]*(.*)\).*$,'"${main_classname}_t"' first_arg\1,' ++sed_extract_method_args='s,^.*[^A-Za-z_0-9]([A-Za-z_0-9][A-Za-z_0-9]*)$,\1,' + + # func_emit_source_h newfile newfile_base + # outputs to $newfile the contents of source.h. +@@ -516,7 +521,7 @@ + echo "#endif" + echo + echo "/* Functions that invoke the methods. */" +- echo "$all_methods" | sed -e "$sed_remove_empty_lines" -e 's/\([^A-Za-z_0-9]\)\([A-Za-z_0-9][A-Za-z_0-9]*\)[ ]*([^,)]*/\1'"${main_classname}_"'\2 ('"${main_classname}_t first_arg"'/' -e 's,^,extern ,' -e 's,$,;,' ++ echo "$all_methods" | sed -e "$sed_remove_empty_lines" -e 's/([^A-Za-z_0-9])([A-Za-z_0-9][A-Za-z_0-9]*)[ ]*\([^,\)]*/\1'"${main_classname}_"'\2 ('"${main_classname}_t first_arg"'/' -e 's,^,extern ,' -e 's,$,;,' + echo + # Now come the implementation details. + echo "/* Type representing an implementation of ${main_classname}_t. */" diff --git a/win32libs/gettext/gettext.py b/win32libs/gettext/gettext.py index 80fa2ffb..f4acf9b2 100644 --- a/win32libs/gettext/gettext.py +++ b/win32libs/gettext/gettext.py @@ -1,69 +1,71 @@ # -*- coding: utf-8 -*- import info from Package.MSBuildPackageBase import * from Package.AutoToolsPackageBase import * class subinfo(info.infoclass): def setTargets(self): for ver in ['0.19.8.1']: self.targets[ver] = 'http://ftp.gnu.org/pub/gnu/gettext/gettext-%s.tar.gz' % ver self.targetInstSrc[ver] = "gettext-%s" % ver self.patchLevel['0.19.8.1'] = 1 self.targetDigests['0.19.8.1'] = (['ff942af0e438ced4a8b0ea4b0b6e0d6d657157c5e2364de57baa279c1c125c43'], CraftHash.HashAlgorithm.SHA256) #patch based on https://github.com/fanc999/gtk-msvc-projects/tree/master/gettext/0.19.8.1 self.patchToApply['0.19.8.1'] = [("gettext-0.19.8.1-gtk-msvc-projects.diff", 1)] self.patchToApply['0.19.8.1'] += [("0001-gettext-tools-gnulib-lib-xalloc.h-Fix-function-signa.patch", 1)] self.patchToApply['0.19.8.1'] += [("0001-gettext-tools-src-Fix-linking.patch", 1)] self.patchToApply['0.19.8.1'] += [("0001-gettext-tools-src-x-lua.c-Fix-on-pre-C99.patch", 1)] self.patchToApply['0.19.8.1'] += [("0001-ostream.h-styled-ostream.h-Fix-linking.patch", 1)] self.patchToApply['0.19.8.1'] += [("0001-printf-parse.c-Fix-build-on-Visual-Studio-2008.patch", 1)] self.patchToApply['0.19.8.1'] += [("0001-tools-Fix-gnulib-lib-uniname-uniname.c-on-pre-C99.patch", 1)] + if OsUtils.isMac(): + self.patchToApply['0.19.8.1'] += [("0001-moopp-sed-extended-regexp.patch", 1)] self.description = "GNU internationalization (i18n)" self.defaultTarget = '0.19.8.1' def setDependencies(self): self.runtimeDependencies["virtual/base"] = "default" self.runtimeDependencies["win32libs/win_iconv"] = "default" if CraftCore.compiler.isGCCLike(): self.buildDependencies["dev-util/msys"] = "default" class PackageMinGW(AutoToolsPackageBase): def __init__(self, **args): AutoToolsPackageBase.__init__(self) self.subinfo.options.configure.args += " --disable-static --enable-shared --disable-java --disable-native-java --enable-nls --enable-c++ --with-included-gettext --with-included-glib --with-included-regex --with-gettext-tools" class PackageMSVC(MSBuildPackageBase): def __init__(self, **args): MSBuildPackageBase.__init__(self) self.gettextBuildDir = os.path.join(self.sourceDir(), "win32", "vs15") self.subinfo.options.configure.args = "/p:UseEnv=true" self.subinfo.options.configure.projectFile = os.path.join(self.gettextBuildDir, "gettext.sln") def make(self): with utils.ScopedEnv({ "LIB" : f"{os.environ['LIB']};{os.path.join(CraftStandardDirs.craftRoot() , 'lib')}", "INCLUDE" : f"{os.environ['INCLUDE']};{os.path.join(CraftStandardDirs.craftRoot() , 'include')}"}): return MSBuildPackageBase.make(self) def install(self): if not MSBuildPackageBase.install(self, installHeaders=False, buildDirs=[self.gettextBuildDir]): return True return (utils.copyFile(os.path.join(self.sourceDir(), "gettext-runtime", "intl", "msvc", "libintl.h"), os.path.join(self.installDir(), "include", "libintl.h")) and utils.copyFile(os.path.join(self.sourceDir(), "gettext-runtime", "libasprintf", "msvc", "autosprintf.h"), os.path.join(self.installDir(), "include", "autosprintf.h"))) if CraftCore.compiler.isGCCLike(): class Package(PackageMinGW): def __init__(self): PackageMinGW.__init__(self) else: class Package(PackageMSVC): def __init__(self): PackageMSVC.__init__(self)