summaryrefslogtreecommitdiff
path: root/mk/plist
diff options
context:
space:
mode:
authorobache <obache@pkgsrc.org>2013-02-10 12:03:00 +0000
committerobache <obache@pkgsrc.org>2013-02-10 12:03:00 +0000
commitd920f7bbed4b70b8fe418230566cc8750c01e0d5 (patch)
tree529491020359a0910b86c29308870950f0b7b80d /mk/plist
parent1e5baddfc9be470cbe2c4d9834927a23ef18e1a9 (diff)
downloadpkgsrc-d920f7bbed4b70b8fe418230566cc8750c01e0d5.tar.gz
Improve PLIST handling for Cygwin (SHLIB_TYPE=PEwin)
* also expand `dlname' in libtool archive * executable binary files may have .exe extension * rename shlib extension .so with .dll
Diffstat (limited to 'mk/plist')
-rwxr-xr-xmk/plist/libtool-expand17
-rw-r--r--mk/plist/plist-cygwin.awk23
-rw-r--r--mk/plist/plist.mk9
-rw-r--r--mk/plist/shlib-pe.awk20
4 files changed, 67 insertions, 2 deletions
diff --git a/mk/plist/libtool-expand b/mk/plist/libtool-expand
index 582db57e9e0..4392e11884e 100755
--- a/mk/plist/libtool-expand
+++ b/mk/plist/libtool-expand
@@ -1,6 +1,6 @@
#! /bin/sh
#
-# $NetBSD: libtool-expand,v 1.4 2006/04/24 01:31:04 rillig Exp $
+# $NetBSD: libtool-expand,v 1.5 2013/02/10 12:03:00 obache Exp $
#
# Copyright (c) 2004 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -41,6 +41,10 @@
: ${GREP=grep}
: ${SORT=sort}
: ${TEST=test}
+: ${PWD_CMD="pwd -P"}
+: ${BASENAME=basename}
+: ${DIRNAME=dirname}
+: ${SHLIB_TYPE=none}
self="${0##*/}"
@@ -82,6 +86,17 @@ do
${ECHO} 1>&2 "$self: \`$lapath' was not properly installed"
exit 1
fi
+ if ${TEST} ${SHLIB_TYPE} = "PEwin"; then
+ cwd=`${PWD_CMD}`
+ libpath="$dir$dlname"
+ libpath=`${DIRNAME} "$libpath"`
+ libpath=`cd "$libpath" && ${PWD_CMD}`
+ libpath="${libpath#${cwd}/}"/`${BASENAME} "${dlname}"`
+ if ${TEST} ! -f "$libpath"; then
+ ${ECHO} 1>&2 "$self: \`$libpath' was not found"
+ fi
+ ${ECHO} "$libpath"
+ fi
for lib in $library_names $old_library; do
libpath="$dir$lib"
if ${TEST} ! -f "$libpath"; then
diff --git a/mk/plist/plist-cygwin.awk b/mk/plist/plist-cygwin.awk
new file mode 100644
index 00000000000..455b8d8c7c0
--- /dev/null
+++ b/mk/plist/plist-cygwin.awk
@@ -0,0 +1,23 @@
+# $NetBSD: plist-cygwin.awk,v 1.1 2013/02/10 12:03:00 obache Exp $
+#
+### Executable binary files on Cygwin:
+### Executable binary files have .exe suffix.
+### Cygwin's /bin/install automatically adds .exe when necessary.
+### "test -f foo" succeeds when foo.exe exists.
+### So it is supposed that if foo.exe and foo have same device and inode
+### number, then only foo.exe exists.
+### It may be result in false detect if foo is hard link of foo.exe,
+### but it is hard to create such hard link, and if foo.exe exists,
+### foo will not be requred.
+
+BEGIN {
+ PREFIX = ENVIRON["PREFIX"] ? ENVIRON["PREFIX"] : "/usr/pkg"
+ TEST = ENVIRON["TEST"] ? ENVIRON["TEST"] : "test"
+}
+
+!/^@/ {
+ cmd = TEST " " PREFIX "/" $0 " -ef " PREFIX "/" $0 ".exe"
+ if (system(cmd) == 0) {
+ $0 = $0 ".exe"
+ }
+}
diff --git a/mk/plist/plist.mk b/mk/plist/plist.mk
index ad2a9c2c5f6..632d3163a4c 100644
--- a/mk/plist/plist.mk
+++ b/mk/plist/plist.mk
@@ -1,4 +1,4 @@
-# $NetBSD: plist.mk,v 1.44 2012/12/06 11:36:31 jperkin Exp $
+# $NetBSD: plist.mk,v 1.45 2013/02/10 12:03:00 obache Exp $
#
# This Makefile fragment handles the creation of PLISTs for use by
# pkg_create(8).
@@ -111,6 +111,9 @@ _PLIST_MANINSTALL= ${MANINSTALL}
_LIBTOOL_EXPAND= \
${PKGSRC_SETENV} ECHO=${TOOLS_ECHO:Q} GREP=${TOOLS_GREP:Q} \
SORT=${TOOLS_SORT:Q} TEST=${TOOLS_TEST:Q} \
+ BASENAME=${BASENAME:Q} DIRNAME=${DIRNAME:Q} \
+ PWD_CMD=${PWD_CMD:Q} \
+ SHLIB_TYPE=${SHLIB_TYPE:Q} \
${SH} ${.CURDIR}/../../mk/plist/libtool-expand
.if !defined(_IGNORE_INFO_PATH)
@@ -193,6 +196,9 @@ _PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-gnu.awk
_PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-info.awk
_PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-man.awk
_PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-libtool.awk
+.if ${OPSYS} == "Cygwin"
+_PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-cygwin.awk
+.endif
_PLIST_AWK+= ${PLIST_AWK}
_PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-default.awk
@@ -205,6 +211,7 @@ _SHLIB_AWKFILE.ELF= ${.CURDIR}/../../mk/plist/shlib-elf.awk
_SHLIB_AWKFILE.SOM= ${.CURDIR}/../../mk/plist/shlib-som.awk
_SHLIB_AWKFILE.aixlib= ${.CURDIR}/../../mk/plist/shlib-elf.awk
_SHLIB_AWKFILE.a.out= ${.CURDIR}/../../mk/plist/shlib-aout.awk
+_SHLIB_AWKFILE.PEwin= ${.CURDIR}/../../mk/plist/shlib-pe.awk
_SHLIB_AWKFILE.dylib= ${.CURDIR}/../../mk/plist/shlib-dylib.awk
_SHLIB_AWKFILE.none= ${.CURDIR}/../../mk/plist/shlib-none.awk
diff --git a/mk/plist/shlib-pe.awk b/mk/plist/shlib-pe.awk
new file mode 100644
index 00000000000..0f6f152b0a5
--- /dev/null
+++ b/mk/plist/shlib-pe.awk
@@ -0,0 +1,20 @@
+# $NetBSD: shlib-pe.awk,v 1.1 2013/02/10 12:03:00 obache Exp $
+#
+###
+### PLIST shlib filter for Portable Executable format, PE on Cygwin.
+###
+
+# Libtoolized packages don't need any special attention, but for others we need
+# to manually deal with the .dll library suffix.
+
+# Match shared libs
+/.*\/lib[^\/]+\.so(\.[0-9]+)*$/ {
+ sub("\.so\.", ".dll.");
+}
+# Match dynamically loaded modules
+/.*\.so$/ {
+ sub("\.so$", ".dll");
+}
+{
+ print
+}