📄 update.sh
字号:
#! /bin/shIN="../update-pcre"PCRE=$1if [ "x$PCRE" = x -o "x$PCRE" = x--help -o "x$PCRE" = x-h ]; then cat >&2 << EOF$0 PCRE-DIR Updates the local PCRE copy with a different version of the library, contained in the directory PCRE-DIR. This will delete the content of the local pcre directory, copy the necessary files from PCRE-DIR, and generate other needed files, such as Makefile.amEOF exitfiif [ ! -f gregex.h ]; then echo "This script should be executed from the directory containing gregex.c." 2> /dev/null exit 1fiif [ ! -f $PCRE/Makefile.in -o ! -f $PCRE/pcre_compile.c ]; then echo "'$PCRE' does not contain a valid PCRE version." 2> /dev/null exit 1fiecho "Deleting old PCRE library"mv pcre/.svn tmp-pcre-svnrm -R pcre 2> /dev/nullmkdir pcrecd pcre# pcre_chartables.c is generated by dfatables.# We do not want to compile and execute dfatables.c every time, because# this could be a problem (e.g. when cross-compiling), so now generate# the file and then distribuite it with GRegex.echo "Generating pcre_chartables.c"cp -R $PCRE tmp-buildcd tmp-build./configure --enable-utf8 --enable-unicode-properties --disable-cpp > /dev/nullmake pcre_chartables.c > /dev/nullcat > ../pcre_chartables.c << \EOF/* This file is autogenerated by ../update-pcre/update.sh during * the update of the local copy of PCRE. */EOFcat pcre_chartables.c >> ../pcre_chartables.ccd ..rm -R tmp-build# Compiled C files.echo "Generating makefiles"all_files=`awk '/^OBJ = /, /^\\s*$/ \ { \ sub("^OBJ = ", ""); \ sub(".@OBJEXT@[[:blank:]]*\\\\\\\\", ""); \ sub("\\\\$\\\\(POSIX_OBJ\\\\)", ""); \ print; \ }' \ $PCRE/Makefile.in`# Headers.included_files="pcre.h pcre_internal.h ucp.h ucpinternal.h"# Generate Makefile.am.cat $IN/Makefile.am-1 > Makefile.amfor name in $all_files; do echo " $name.c \\" >> Makefile.am if [ $name != pcre_chartables ]; then # pcre_chartables.c is a generated file. cp $PCRE/$name.c . fidonefor f in $included_files; do echo " $f \\" >> Makefile.am cp $PCRE/$f .donecat $IN/Makefile.am-2 >> Makefile.am# Generate makefile.msccat > makefile.msc << EOFTOP = ..\..\..!INCLUDE ..\..\build\win32\make.mscINCLUDES = \\ -I ..\.. \\ -I .. DEFINES = \\ -DPCRE_STATIC \\ -DHAVE_CONFIG_H \\ -DHAVE_LONG_LONG_FORMAT \\ -DSUPPORT_UCP \\ -DSUPPORT_UTF8 \\ -DNEWLINE=-1 \\ -DMATCH_LIMIT=10000000 \\ -DMATCH_LIMIT_RECURSION=10000000 \\ -DMAX_NAME_SIZE=32 \\ -DMAX_NAME_COUNT=10000 \\ -DMAX_DUPLENGTH=30000 \\ -DLINK_SIZE=2 \\ -DEBCDIC=0 \\ -DPOSIX_MALLOC_THRESHOLD=10OBJECTS = \\`for f in $all_files; do echo " $f.obj \\\\"done`all : pcre.libpcre.lib : \$(OBJECTS) lib -out:pcre.lib \$(OBJECTS)EOFecho "Patching PCRE"# Copy the license.cp $PCRE/COPYING .# Use glib for memory allocation.patch > /dev/null < $IN/memory.patch# Copy the modified version of pcre_valid_utf8.c.cp $IN/pcre_valid_utf8.c .# Copy the modified version of pcre_ucp_searchfuncs.c that uses glib# for Unicode properties.cp $IN/pcre_ucp_searchfuncs.c .patch > /dev/null < $IN/ucp.patch# Remove the digitab array in pcre_compile.c.patch > /dev/null < $IN/digitab.patchsed -i -e 's/(digitab\[\(.*\)\] & ctype_digit)/g_ascii_isdigit(\1)/' pcre_compile.csed -i -e 's/(digitab\[\(.*\)\] & ctype_xdigit)/g_ascii_isxdigit(\1)/' pcre_compile.c# Reduce the number of relocations.python $IN/make_utt.pypatch > /dev/null < $IN/utt.patchpatch > /dev/null < $IN/table-reduction.patch# Copy back the old SVN directory.mv ../tmp-pcre-svn .svncat << EOFUpdate completed. You now should check that everything is working.Remember to update the regex syntax doc with the new features(docs/reference/glib/regex-syntax.sgml) and to run the tests.EOF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -