Author: joes
Date: Tue Feb 28 07:40:27 2006
New Revision: 381678

URL: http://svn.apache.org/viewcvs?rev=381678&view=rev
Log:
make exports for httpd

Added:
    httpd/apreq/branches/apr-build-system/build/make_exports.awk
    httpd/apreq/branches/apr-build-system/build/make_var_export.awk
Modified:
    httpd/apreq/branches/apr-build-system/Makefile.in

Modified: httpd/apreq/branches/apr-build-system/Makefile.in
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/apr-build-system/Makefile.in?rev=381678&r1=381677&r2=381678&view=diff
==============================================================================
--- httpd/apreq/branches/apr-build-system/Makefile.in (original)
+++ httpd/apreq/branches/apr-build-system/Makefile.in Tue Feb 28 07:40:27 2006
@@ -31,6 +31,9 @@
 @INCLUDE_RULES@
 @INCLUDE_OUTPUTS@
 
+APREQ_MKEXPORT = $(AWK) -f @abs_srcdir@/build/make_exports.awk
+APREQ_MKVAREXPORT = $(AWK) -f @abs_srcdir@/build/make_var_export.awk
+
 LINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(LT_LDFLAGS) $(COMPILE) 
-version-info $(APREQ_LIBTOOL_VERSION) $(ALL_LDFLAGS) -o $@
 
 CLEAN_SUBDIRS = test
@@ -74,10 +77,10 @@
        $(LINK) @lib_target@ $(ALL_LIBS) $(APREQ_LDFLAGS) $(APREQ_LIBS)
 
 exports.c: $(HEADERS)
-       $(APR_MKEXPORT) $(HEADERS) > $@
+       $(APREQ_MKEXPORT) $(HEADERS) > $@
 
 export_vars.c: $(HEADERS)
-       $(APR_MKVAREXPORT) $(HEADERS) > $@
+       $(APREQ_MKVAREXPORT) $(HEADERS) > $@
 
 apreq.exp: exports.c export_vars.c
        @echo "#! [EMAIL PROTECTED]@.so" > $@

Added: httpd/apreq/branches/apr-build-system/build/make_exports.awk
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/apr-build-system/build/make_exports.awk?rev=381678&view=auto
==============================================================================
--- httpd/apreq/branches/apr-build-system/build/make_exports.awk (added)
+++ httpd/apreq/branches/apr-build-system/build/make_exports.awk Tue Feb 28 
07:40:27 2006
@@ -0,0 +1,150 @@
+
+BEGIN {
+    printf("/*\n")
+    printf(" * THIS FILE WAS AUTOGENERATED BY make_exports.awk\n")
+    printf(" *\n")
+    printf(" * This is an ugly hack that needs to be here, so\n")
+    printf(" * that libtool will link all of the APR functions\n")
+    printf(" * into server regardless of whether the base server\n")
+    printf(" * uses them.\n")
+    printf(" */\n")
+    printf("\n")
+    printf("#define CORE_PRIVATE\n")
+    printf("\n")
+    
+    for (i = 1; i < ARGC; i++) {
+        file = ARGV[i]
+        sub("([^/]*[/])*", "", file)
+        printf("#include \"%s\"\n", file)
+    }
+
+    printf("\n")
+    printf("const void *ap_ugly_hack = NULL;\n")
+    printf("\n")
+    
+    TYPE_NORMAL = 0
+    TYPE_HEADER = 1
+
+    stackptr = 0
+}
+
+function push(line) {
+    stack[stackptr] = line
+    stackptr++
+}
+
+function do_output() {
+    printf("/*\n")
+    printf(" * %s\n", FILENAME)
+    printf(" */\n")
+    
+    for (i = 0; i < stackptr; i++) {
+        printf("%s\n", stack[i])
+    }
+    
+    stackptr = 0
+
+    printf("\n");
+}
+
+function enter_scope(type) {
+    scope++
+    scope_type[scope] = type
+    scope_stack[scope] = stackptr
+    delete scope_used[scope]
+}
+
+function leave_scope() {
+    used = scope_used[scope]
+   
+    if (!used)
+        stackptr = scope_stack[scope]
+
+    scope--
+    if (used) {
+        scope_used[scope] = 1
+        
+        if (!scope)
+            do_output()
+    }
+}
+
+function add_symbol(symbol) {
+    if (!index(symbol, "#")) {
+        push("const void *ap_hack_" symbol " = (const void *)" symbol ";")
+        scope_used[scope] = 1
+    }
+}
+
+/^[ \t]*APREQ?_(CORE_)?DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
+    sub("[ \t]*APREQ?_(CORE_)?DECLARE[^(]*[(][^)]*[)][ \t]*", "")
+    sub("[(].*", "")
+    sub("([^ ]* (^([ \t]*[(])))+", "")
+
+    add_symbol($0)
+    next
+}
+
+/^[ \t]*AP_DECLARE_HOOK[^(]*[(][^)]*/ {
+    split($0, args, ",")
+    symbol = args[2]
+    sub("^[ \t]+", "", symbol)
+    sub("[ \t]+$", "", symbol)
+
+    add_symbol("ap_hook_" symbol)
+    add_symbol("ap_hook_get_" symbol)
+    add_symbol("ap_run_" symbol)
+    next
+}
+
+/^[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(][^)]*[)]/ {
+    sub("[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(]", "", $0)
+    sub("[)].*$", "", $0)
+    add_symbol("apr_" $0 "_pool_get")
+    next
+}
+
+/^[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(][^)]*[)]/ {
+    sub("[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(]", "", $0)
+    sub("[)].*$", "", $0)
+    add_symbol("apr_" $0 "_inherit_set")
+    next
+}
+
+/^[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(][^)]*[)]/ {
+    sub("[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(]", "", $0)
+    sub("[)].*$", "", $0)
+    add_symbol("apr_" $0 "_inherit_unset")
+    next
+}
+
+/^#[ \t]*if(ndef| !defined[(])([^_]*_)*H/ {
+    enter_scope(TYPE_HEADER)
+    next
+}
+
+/^#[ \t]*if([n]?def)? / {
+    enter_scope(TYPE_NORMAL)
+    push($0)
+    next
+}
+
+/^#[ \t]*endif/ {
+    if (scope_type[scope] == TYPE_NORMAL)
+        push($0)
+        
+    leave_scope()
+    next
+}
+
+/^#[ \t]*else/ {
+    push($0)
+    next
+}
+
+/^#[ \t]*elif/ {
+    push($0)
+    next
+}
+
+

Added: httpd/apreq/branches/apr-build-system/build/make_var_export.awk
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/apr-build-system/build/make_var_export.awk?rev=381678&view=auto
==============================================================================
--- httpd/apreq/branches/apr-build-system/build/make_var_export.awk (added)
+++ httpd/apreq/branches/apr-build-system/build/make_var_export.awk Tue Feb 28 
07:40:27 2006
@@ -0,0 +1,59 @@
+# Based on apr's make_export.awk, which is
+# based on Ryan Bloom's make_export.pl
+
+/^#[ \t]*if(def)? (APREQ?_|!?defined).*/ {
+       if (old_filename != FILENAME) {
+               if (old_filename != "") printf("%s", line)
+               macro_no = 0
+               found = 0
+               count = 0
+               old_filename = FILENAME
+               line = ""
+       }
+       macro_stack[macro_no++] = macro
+       macro = substr($0, length($1)+2)
+       count++
+       line = line "#ifdef " macro "\n"
+       next
+}
+
+/^#[ \t]*endif/ {
+       if (count > 0) {
+               count--
+               line = line "#endif /* " macro " */\n"
+               macro = macro_stack[--macro_no]
+       }
+       if (count == 0) {
+               if (found != 0) {
+                       printf("%s", line)
+               }
+               line = ""
+       }
+       next
+}
+
+function add_symbol (sym_name) {
+       if (count) {
+               found++
+       }
+       for (i = 0; i < count; i++) {
+               line = line "\t"
+       }
+       line = line sym_name "\n"
+
+       if (count == 0) {
+               printf("%s", line)
+               line = ""
+       }
+}
+
+/^[ \t]*(extern[ \t]+)?APREQ?_DECLARE_DATA .*;$/ {
+       varname = $NF;
+       gsub( /[*;]/, "", varname);
+       gsub( /\[.*\]/, "", varname);
+       add_symbol(varname);
+}
+
+END {
+       printf("%s", line)
+}


Reply via email to