pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Add another shlib type "aixlib".



details:   https://anonhg.NetBSD.org/pkgsrc/rev/78c5d19f90da
branches:  trunk
changeset: 464052:78c5d19f90da
user:      erh <erh%pkgsrc.org@localhost>
date:      Wed Dec 03 18:31:06 2003 +0000

description:
Add another shlib type "aixlib".
Handle this in do-shlib-handling: turn *.so into *.a.
Pull out the inline awk scripts into variables to make the actual
target a little bit clearer.

diffstat:

 mk/bsd.pkg.mk |  322 ++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 179 insertions(+), 143 deletions(-)

diffs (truncated from 365 to 300 lines):

diff -r 103fbe5caf16 -r 78c5d19f90da mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Wed Dec 03 18:25:05 2003 +0000
+++ b/mk/bsd.pkg.mk     Wed Dec 03 18:31:06 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1310 2003/12/03 18:25:05 erh Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1311 2003/12/03 18:31:06 erh Exp $
 #
 # This file is in the public domain.
 #
@@ -2687,6 +2687,172 @@
 # XXX This target could need some cleanup after it was ripped out of
 #     real-su-install
 #
+_AOUT_AWK = \
+       BEGIN { linkc = 1 }                     \
+       /^@/ { lines[NR] = $$0; next }          \
+       function libtool_release(lib) {         \
+               if (gsub("-[^-]+\.so\.", "\.so\.", lib)) { \
+                       if (system("${TEST} -h ${PREFIX}/" lib) == 0) { \
+                               rels[NR] = lib; \
+                       }                       \
+               }                               \
+       }                                       \
+       /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+\.[0-9]+$$/ { \
+               libtool_release($$0);           \
+               lines[NR] = $$0;                \
+               sub("\.[0-9]+$$", "");          \
+               links[linkc++] = $$0;           \
+               sub("\.[0-9]+$$", "");          \
+               links[linkc++] = $$0;           \
+               sub("\.[0-9]+$$", "");          \
+               links[linkc++] = $$0;           \
+               if (sub("-[^-]+\.so$$", "\.so")) { \
+                       links[linkc++] = $$0;   \
+               }                               \
+               next                            \
+       }                                       \
+       /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+$$/ { \
+               libtool_release($$0);           \
+               lines[NR] = $$0;                \
+               sub("\.[0-9]+$$", "");          \
+               links[linkc++] = $$0;           \
+               sub("\.[0-9]+$$", "");          \
+               links[linkc++] = $$0;           \
+               if (sub("-[^-]+\.so$$", "\.so")) { \
+                       links[linkc++] = $$0;   \
+               }                               \
+               next                            \
+       }                                       \
+       { lines[NR] = $$0 }                     \
+       END {                                   \
+               for (i = 0 ; i <= linkc ; i++)  \
+                       for (j = 1 ; j < NR ; j++) \
+                               if (lines[j] == links[i]) \
+                                       lines[j] = "@comment " lines[j]; \
+               if (${SHLIB_PLIST_MODE})        \
+                       for (i = 1 ; i <= NR ; i++) { \
+                               print lines[i]; \
+                               if (rels[i] != "") \
+                                       print rels[i]; \
+                       }                       \
+       }
+
+_DYLIB_AWK= \
+       /^@/ { lines[NR] = $$0; next }          \
+               function libtool_release(lib) {         \
+               if (gsub("\.so\.", "\.", lib) || gsub("\.so$$", "", lib)) { \
+                       lib = lib ".dylib"; \
+                       if (system("${TEST} -h ${PREFIX}/" lib) == 0) { \
+                               rels[NR] = lib; \
+                       }                       \
+               }                               \
+       }                                       \
+       /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+\.[0-9]+$$/ { \
+               libtool_release($$0);           \
+               lines[NR] = $$0;                \
+               links[linkc++] = $$0;           \
+               sub("\.[0-9]+$$", "");          \
+               links[linkc++] = $$0;           \
+               sub("\.[0-9]+$$", "");          \
+               links[linkc++] = $$0;           \
+               sub("\.[0-9]+$$", "");          \
+               links[linkc++] = $$0;           \
+               if (sub("-[^-]+\.so$$", "\.so")) { \
+                       links[linkc++] = $$0;   \
+               }                               \
+               next                            \
+       }                                       \
+       /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+$$/ { \
+               libtool_release($$0);           \
+               lines[NR] = $$0;                \
+               links[linkc++] = $$0;           \
+               sub("\.[0-9]+$$", "");          \
+               links[linkc++] = $$0;           \
+               sub("\.[0-9]+$$", "");          \
+               links[linkc++] = $$0;           \
+               if (sub("-[^-]+\.so$$", "\.so")) { \
+                       links[linkc++] = $$0;   \
+               }                               \
+               next                            \
+       }                                       \
+       /.*\/lib[^\/]+\.so\.[0-9]+$$/ {         \
+               libtool_release($$0);           \
+               lines[NR] = $$0;                \
+               links[linkc++] = $$0;           \
+               sub("\.[0-9]+$$", "");          \
+               links[linkc++] = $$0;           \
+               if (sub("-[^-]+\.so$$", "\.so")) { \
+                       links[linkc++] = $$0;   \
+               }                               \
+               next                            \
+       }                                       \
+       /.*\/lib[^\/]+\.so$$/ {                 \
+               lines[NR] = $$0;                \
+               if (system("${TEST} -e ${PREFIX}/" $$0) == 0) { \
+                       next;                   \
+               }                               \
+               libtool_release($$0);           \
+               links[linkc++] = $$0;           \
+               if (sub("-[^-]+\.so$$", "\.so")) { \
+                       links[linkc++] = $$0;   \
+               }                               \
+               next                            \
+       }                                       \
+       { lines[NR] = $$0 }                     \
+       END {                                   \
+               for (i = 0 ; i <= linkc ; i++)  \
+                       for (j = 1 ; j <= NR ; j++) \
+                               if (lines[j] == links[i]) \
+                                       lines[j] = "@comment " lines[j]; \
+               if (${SHLIB_PLIST_MODE})        \
+                       for (i = 1 ; i <= NR ; i++) { \
+                               print lines[i]; \
+                               if (rels[i] != "") { \
+                                       print rels[i]; \
+                                       "${LS} -l ${PREFIX}/" rels[i] | getline tgt; \
+                                       gsub(".* ", "", tgt); \
+                                       if (tgts[tgt] == "") { \
+                                               tgts[tgt] = tgt; \
+                                                                               if (index(tgt, "/") == 1) \
+                                                                                       print tgt; \
+                                                                               else { \
+                                                                                       prefix=""; \
+                                                                                               if (match(rels[i], ".*/") != 0) \
+                                                                                       prefix=substr(rels[i],1,RLENGTH); \
+                                                                               print prefix tgt; \
+                                                                       } \
+                                       }       \
+                               }               \
+                       }                       \
+       }
+
+# Turn lib*.so.*, lib*.so into lib*.a.  Drop duplicates.
+_AIXLIB_AWK= \
+       /^@/ { lines[NR] = $$0; next }          \
+       /.*\/lib[^\/]+\.so(\.[0-9]+)*$$/ {              \
+               sub("(\.[0-9]+)*$$", "");               \
+               sub("\.so$$", "\.a");       \
+               lines[NR] = $$0;     \
+               next                            \
+       }                                       \
+       { lines[NR] = $$0 }                     \
+       END {                                   \
+               nlibs = 0; \
+               for (i = 1; i <= NR; i++) { \
+               for (j = 0; j < nlibs; j++) \
+                       { \
+                               if (libs[j] == lines[i]) \
+                                       break; \
+                       } \
+                       if (j >= nlibs) \
+                               print lines[i]; \
+                       if (match(lines[i], ".*\/lib[^\/]+\.a$$")) { \
+                               libs[nlibs] = lines[i]; \
+                               nlibs++; \
+                       } \
+               } \
+       }
+
 .PHONY: do-shlib-handling
 do-shlib-handling:
 .if ${SHLIB_HANDLING} == "YES"
@@ -2700,56 +2866,7 @@
                case "$$shlib_type" in                                  \
                ELF)    ;;                                              \
                "a.out")                                                \
-                       ${AWK} '                                        \
-                               BEGIN { linkc = 1 }                     \
-                               /^@/ { lines[NR] = $$0; next }          \
-                               function libtool_release(lib) {         \
-                                       if (gsub("-[^-]+\.so\.", "\.so\.", lib)) { \
-                                               if (system("${TEST} -h ${PREFIX}/" lib) == 0) { \
-                                                       rels[NR] = lib; \
-                                               }                       \
-                                       }                               \
-                               }                                       \
-                               /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+\.[0-9]+$$/ { \
-                                       libtool_release($$0);           \
-                                       lines[NR] = $$0;                \
-                                       sub("\.[0-9]+$$", "");          \
-                                       links[linkc++] = $$0;           \
-                                       sub("\.[0-9]+$$", "");          \
-                                       links[linkc++] = $$0;           \
-                                       sub("\.[0-9]+$$", "");          \
-                                       links[linkc++] = $$0;           \
-                                       if (sub("-[^-]+\.so$$", "\.so")) { \
-                                               links[linkc++] = $$0;   \
-                                       }                               \
-                                       next                            \
-                               }                                       \
-                               /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+$$/ { \
-                                       libtool_release($$0);           \
-                                       lines[NR] = $$0;                \
-                                       sub("\.[0-9]+$$", "");          \
-                                       links[linkc++] = $$0;           \
-                                       sub("\.[0-9]+$$", "");          \
-                                       links[linkc++] = $$0;           \
-                                       if (sub("-[^-]+\.so$$", "\.so")) { \
-                                               links[linkc++] = $$0;   \
-                                       }                               \
-                                       next                            \
-                               }                                       \
-                               { lines[NR] = $$0 }                     \
-                               END {                                   \
-                                       for (i = 0 ; i <= linkc ; i++)  \
-                                               for (j = 1 ; j < NR ; j++) \
-                                                       if (lines[j] == links[i]) \
-                                                               lines[j] = "@comment " lines[j]; \
-                                       if (${SHLIB_PLIST_MODE})        \
-                                               for (i = 1 ; i <= NR ; i++) { \
-                                                       print lines[i]; \
-                                                       if (rels[i] != "") \
-                                                               print rels[i]; \
-                                               }                       \
-                               }                                       \
-                       ' <${PLIST} >${PLIST}.tmp ;                     \
+                       ${AWK} '${_AOUT_AWK}' <${PLIST} >${PLIST}.tmp ;                 \
                        if [ "${SHLIB_PLIST_MODE}" = "1" ]; then        \
                                ${MV} ${PLIST}.tmp ${PLIST};            \
                        else                                            \
@@ -2771,101 +2888,17 @@
                        fi                                              \
                        ;;                                              \
                "dylib")                                                \
-                       ${AWK} '                                        \
-                               /^@/ { lines[NR] = $$0; next }          \
-                               function libtool_release(lib) {         \
-                                       if (gsub("\.so\.", "\.", lib) || gsub("\.so$$", "", lib)) { \
-                                               lib = lib ".dylib"; \
-                                               if (system("${TEST} -h ${PREFIX}/" lib) == 0) { \
-                                                       rels[NR] = lib; \
-                                               }                       \
-                                       }                               \
-                               }                                       \
-                               /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+\.[0-9]+$$/ { \
-                                       libtool_release($$0);           \
-                                       lines[NR] = $$0;                \
-                                       links[linkc++] = $$0;           \
-                                       sub("\.[0-9]+$$", "");          \
-                                       links[linkc++] = $$0;           \
-                                       sub("\.[0-9]+$$", "");          \
-                                       links[linkc++] = $$0;           \
-                                       sub("\.[0-9]+$$", "");          \
-                                       links[linkc++] = $$0;           \
-                                       if (sub("-[^-]+\.so$$", "\.so")) { \
-                                               links[linkc++] = $$0;   \
-                                       }                               \
-                                       next                            \
-                               }                                       \
-                               /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+$$/ { \
-                                       libtool_release($$0);           \
-                                       lines[NR] = $$0;                \
-                                       links[linkc++] = $$0;           \
-                                       sub("\.[0-9]+$$", "");          \
-                                       links[linkc++] = $$0;           \
-                                       sub("\.[0-9]+$$", "");          \
-                                       links[linkc++] = $$0;           \
-                                       if (sub("-[^-]+\.so$$", "\.so")) { \
-                                               links[linkc++] = $$0;   \
-                                       }                               \
-                                       next                            \
-                               }                                       \
-                               /.*\/lib[^\/]+\.so\.[0-9]+$$/ {         \
-                                       libtool_release($$0);           \
-                                       lines[NR] = $$0;                \
-                                       links[linkc++] = $$0;           \
-                                       sub("\.[0-9]+$$", "");          \
-                                       links[linkc++] = $$0;           \
-                                       if (sub("-[^-]+\.so$$", "\.so")) { \
-                                               links[linkc++] = $$0;   \
-                                       }                               \
-                                       next                            \
-                               }                                       \
-                               /.*\/lib[^\/]+\.so$$/ {                 \
-                                       lines[NR] = $$0;                \
-                                       if (system("${TEST} -e ${PREFIX}/" $$0) == 0) { \
-                                               next;                   \
-                                       }                               \
-                                       libtool_release($$0);           \
-                                       links[linkc++] = $$0;           \



Home | Main Index | Thread Index | Old Index