diff options
author | bradleys <[email protected]> | 2014-10-15 23:32:41 +0000 |
---|---|---|
committer | bradleys <[email protected]> | 2014-10-15 23:32:41 +0000 |
commit | 5996c99f899f8a76289ae30b4b46277a4009179e (patch) | |
tree | 8298a85f55142f9716facda2073b5375a019626c | |
parent | 5e35f6400466af7051aba28a29c4c06738c80b55 (diff) |
contrib: Add libgnurx to provide POSIX regex on Windows.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6445 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/module.defs | 8 | ||||
-rw-r--r-- | make/configure.py | 38 | ||||
-rw-r--r-- | make/include/main.defs | 3 | ||||
-rw-r--r-- | test/module.defs | 2 |
4 files changed, 49 insertions, 2 deletions
diff --git a/libhb/module.defs b/libhb/module.defs index b1920fdbd..f45c7e40b 100644 --- a/libhb/module.defs +++ b/libhb/module.defs @@ -1,6 +1,6 @@ __deps__ := A52DEC BZIP2 LIBVPX FFMPEG FONTCONFIG FREETYPE LAME LIBASS LIBDCA \ LIBDVDREAD LIBDVDNAV LIBICONV LIBOGG LIBSAMPLERATE LIBTHEORA LIBVORBIS LIBXML2 \ - PTHREADW32 X264 X265 ZLIB LIBBLURAY FDKAAC LIBMFX + PTHREADW32 X264 X265 ZLIB LIBBLURAY FDKAAC LIBMFX LIBGNURX $(eval $(call import.MODULE.defs,LIBHB,libhb,$(__deps__))) $(eval $(call import.GCC,LIBHB)) @@ -128,6 +128,12 @@ else LIBHB.GCC.l += iconv endif +ifneq ($(HAS.regex),1) +LIBHB.dll.libs += $(CONTRIB.build/)lib/libregex.a +else + LIBHB.GCC.l += regex +endif + ifeq (1,$(FRIBIDI.enabled)) LIBHB.dll.libs += $(CONTRIB.build/)lib/libfribidi.a else diff --git a/make/configure.py b/make/configure.py index 89a1edec6..334ff07dd 100644 --- a/make/configure.py +++ b/make/configure.py @@ -1580,6 +1580,42 @@ int main () iconv = LDProbe( 'static iconv', '%s -static' % Tools.gcc.pathname, '-liconv', iconv_test ) iconv.run() + regex_test = """ +#include <stdio.h> +#include <regex.h> + +int match(regex_t *x, char *s) +{ + regmatch_t matches[1]; + return regexec(x, s, 1, matches, 0); +} + +int main() +{ + int rv; + regex_t exp; + + rv = regcomp(&exp, "^[0-9]+$";", REG_EXTENDED); + if (rv != 0) { + return 1; + } + + if (match(&exp, "7") != 0) + { + return 1; + } + if (match(&exp, "foo") == 0) + { + return 1; + } + + regfree(&exp); + return 0; +} +""" + regex = LDProbe( 'static regex', '%s -static' % Tools.gcc.pathname, '-lregex', regex_test ) + regex.run() + ## cfg hook before doc prep cfg.doc_ready() @@ -1703,6 +1739,8 @@ int main () doc.add( 'HAS.libz', 1 ) if not iconv.fail: doc.add( 'HAS.iconv', 1 ) + if not regex.fail: + doc.add( 'HAS.regex', 1 ) doc.addMake( '' ) doc.addMake( '## define debug mode and optimize before other includes' ) diff --git a/make/include/main.defs b/make/include/main.defs index 6d27f9669..445796d71 100644 --- a/make/include/main.defs +++ b/make/include/main.defs @@ -84,6 +84,9 @@ endif ifneq ($(HAS.libz),1) MODULES += contrib/zlib endif +ifneq ($(HAS.regex),1) + MODULES += contrib/libgnurx +endif endif ifneq (,$(filter $(BUILD.system),solaris)) diff --git a/test/module.defs b/test/module.defs index 37187ed99..609c96b5d 100644 --- a/test/module.defs +++ b/test/module.defs @@ -60,7 +60,7 @@ endif ifeq (1,$(FEATURE.hwd)) TEST.GCC.D += USE_HWD endif - TEST.GCC.l += pthreadGC2 iconv ws2_32 + TEST.GCC.l += pthreadGC2 iconv ws2_32 regex TEST.GCC.D += PTW32_STATIC_LIB TEST.GCC.args.extra.exe++ += -static endif # (1-mingw,$(BUILD.cross)-$(BUILD.system)) |