# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../lua-pcre/compile-fix.patch
# Copyright (C) 2006 The OpenSDE Project
# Copyright (C) 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---

diff -ur lrexlib-1.19/Makefile lrexlib-1.19-t2/Makefile
--- lrexlib-1.19/Makefile	2004-12-19 01:19:00.000000000 +0100
+++ lrexlib-1.19-t2/Makefile	2006-02-09 00:29:24.000000000 +0100
@@ -2,8 +2,8 @@
 
 include ./config
 
-NAM_POSIX= libluarex_posix
-NAM_PCRE=  libluarex_pcre
+NAM_POSIX= rx
+NAM_PCRE=  pcre
 
 INC_POSIX += $(INC_LUA)
 INC_PCRE  += $(INC_LUA)
@@ -36,14 +36,8 @@
 	@echo This Makefile requires its targets to be explicitly specified.
 	@echo Example: make ar_posix so_posix ar_pcre so_pcre
 
-# static POSIX regexp library binding
-ar_posix: $(TRG_POSIX_AR)
-
 # dynamic POSIX regexp library binding
-so_posix: $(TRG_POSIX_SO)
-
-# static PCRE regexp library binding
-ar_pcre: $(TRG_PCRE_AR)
+so_rx: $(TRG_POSIX_SO)
 
 # dynamic PCRE regexp library binding
 so_pcre: $(TRG_PCRE_SO)
@@ -57,12 +51,10 @@
 	$(AR) $@ $<
 
 $(TRG_POSIX_SO): $(OBJ_POSIX_SO)
-	ld -o $@.$V -shared $< $(LIB_POSIX)
-	ln -fs $@.$V $@
+	ld -o $@ -shared $< $(LIB_POSIX)
 
 $(TRG_PCRE_SO): $(OBJ_PCRE_SO)
-	ld -o $@.$V -shared $< $(LIB_PCRE)
-	ln -fs $@.$V $@
+	ld -o $@ -shared $< $(LIB_PCRE)
 
 .INTERMEDIATE: $(SRC_INTERM_ALL)
 
diff -ur lrexlib-1.19/README lrexlib-1.19-t2/README
--- lrexlib-1.19/README	2004-12-19 01:19:00.000000000 +0100
+++ lrexlib-1.19-t2/README	2006-02-09 00:17:16.000000000 +0100
@@ -1,3 +1,19 @@
+This is a modified version of the lrexlib 1.19.
+The changes made mainly concern the function naming.
+The following changes were made (original function -> new function name)
+
+rex.newPOSIX -> rx.new
+rex.flagsPOSIX -> rx.flags
+
+rex.newPCRE -> pcre.new
+rex.flagsPCRE -> pcre.flags
+rex.versionPCRE -> pcre.version
+
+Additionally, the constructor (as stated at the end of the file) were
+added by default.
+
+The original README follows:
+
                        Lua rexlib release 1.19
                        -----------------------
 
diff -ur lrexlib-1.19/config lrexlib-1.19-t2/config
--- lrexlib-1.19/config	2004-12-19 01:19:00.000000000 +0100
+++ lrexlib-1.19-t2/config	2006-02-08 23:36:29.000000000 +0100
@@ -1,12 +1,12 @@
 # lrexlib configuration file.
 
 # These are default values. See the explanations below.
-INC_LUA=
-LIB_LUA=
-INC_POSIX=
-LIB_POSIX=
-INC_PCRE=
-LIB_PCRE= -lpcre
+INC_LUA   = -I$(shell pkg-config --variable includedir lua)
+LIB_LUA   = $(shell pkg-config --libs lua)
+INC_POSIX =
+LIB_POSIX =
+INC_PCRE  =
+LIB_PCRE  = -lpcre
 
 # If the default settings don't work for your system,
 # try to uncomment and edit the settings below.
diff -ur lrexlib-1.19/lrexlib.c lrexlib-1.19-t2/lrexlib.c
--- lrexlib-1.19/lrexlib.c	2004-12-19 01:19:00.000000000 +0100
+++ lrexlib-1.19-t2/lrexlib.c	2006-02-09 00:04:58.000000000 +0100
@@ -625,29 +625,39 @@
 
 static const luaL_reg rexlib[] = {
 #ifdef LREXLIB_POSIX
-  {"newPOSIX",    posix_comp},
-  {"flagsPOSIX",  posix_get_flags},
+  {"new",    posix_comp},
+  {"flags",  posix_get_flags},
 #endif
 #ifdef LREXLIB_PCRE
-  {"newPCRE",     Lpcre_comp},
-  {"flagsPCRE",   Lpcre_get_flags},
-  {"versionPCRE", Lpcre_vers},
+  {"new",     Lpcre_comp},
+  {"flags",   Lpcre_get_flags},
+  {"version", Lpcre_vers},
 #endif
   {NULL, NULL}
 };
 
+#if defined(LREXLIB_POSIX)
+LUALIB_API int luaopen_lrx(lua_State *L)
+#elif defined(LREXLIB_PCRE)
+LUALIB_API int luaopen_lpcre(lua_State *L)
+#else
 LUALIB_API int luaopen_rex(lua_State *L)
+#endif
 {
-#ifdef LREXLIB_POSIX
+#if defined(LREXLIB_POSIX)
   createmeta(L, posix_handle);
   luaL_openlib(L, NULL, posixmeta, 0);
   lua_pop(L, 1);
-#endif
-#ifdef LREXLIB_PCRE
+
+  luaL_openlib(L, "rx", rexlib, 0);
+#elif defined(LREXLIB_PCRE)
   createmeta(L, pcre_handle);
   luaL_openlib(L, NULL, pcremeta, 0);
   lua_pop(L, 1);
-#endif
+
+  luaL_openlib(L, "pcre", rexlib, 0);
+#else
   luaL_openlib(L, "rex", rexlib, 0);
+#endif
   return 1;
 }