@ -107,12 +107,17 @@ override CPPFLAGS += -DSO_MAJOR_VERSION=$(SO_MAJOR_VERSION)
e n d i f
e n d i f
i f e q ( $( PORTNAME ) , a i x )
i f e q ( $( PORTNAME ) , a i x )
LINK.shared = $( COMPILER)
ifdef SO_MAJOR_VERSION
ifdef SO_MAJOR_VERSION
shlib = lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION)
shlib = lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION)
endif
endif
haslibarule = yes
haslibarule = yes
# $(exports_file) is also usable as an import file
# $(exports_file) is also usable as an import file
exports_file = lib$( NAME) .exp
exports_file = lib$( NAME) .exp
BUILD.exports = ( echo '\#! $(shlib)' ; $( AWK) '/^[^\#]/ {printf "%s\n",$$1}' $< ) > $@
ifneq ( ,$( SHLIB_EXPORTS) )
LINK.shared += -Wl,-bE:$( exports_file)
endif
e n d i f
e n d i f
i f e q ( $( PORTNAME ) , d a r w i n )
i f e q ( $( PORTNAME ) , d a r w i n )
@ -259,9 +264,15 @@ $(stlib): $(OBJS) | $(SHLIB_PREREQS)
touch $@
touch $@
e n d i f #haslibarule
e n d i f #haslibarule
# AIX wraps shared libraries inside a static library, can be used both
# for static and shared linking
i f e q ( $( PORTNAME ) , a i x )
$(stlib) : $( shlib )
rm -f $( stlib)
$( AR) $( AROPT) $( stlib) $( shlib)
e n d i f # aix
i f e q ( , $( filter cygwin win 32,$ ( PORTNAME ) ) )
i f e q ( , $( filter cygwin win 32,$ ( PORTNAME ) ) )
i f n e q ( $( PORTNAME ) , a i x )
# Normal case
# Normal case
$(shlib) : $( OBJS ) | $( SHLIB_PREREQS )
$(shlib) : $( OBJS ) | $( SHLIB_PREREQS )
@ -274,9 +285,12 @@ ifneq ($(shlib), $(shlib_major))
e n d i f
e n d i f
# Make sure we have a link to a name without any version numbers
# Make sure we have a link to a name without any version numbers
i f n e q ( $( shlib ) , $( shlib_bare ) )
i f n e q ( $( shlib ) , $( shlib_bare ) )
# except on AIX, where that's not a thing
i f n e q ( $( PORTNAME ) , a i x )
rm -f $( shlib_bare)
rm -f $( shlib_bare)
$( LN_S) $( shlib) $( shlib_bare)
$( LN_S) $( shlib) $( shlib_bare)
e n d i f
e n d i f # aix
e n d i f # shlib_bare
e n d i f # shlib_major
e n d i f # shlib_major
# Where possible, restrict the symbols exported by the library to just the
# Where possible, restrict the symbols exported by the library to just the
@ -285,36 +299,13 @@ endif # shlib_major
# libpgport along with libpq.
# libpgport along with libpq.
i f n e q ( , $( SHLIB_EXPORTS ) )
i f n e q ( , $( SHLIB_EXPORTS ) )
i f d e f B U I L D . e x p o r t s
i f d e f B U I L D . e x p o r t s
$(shlib) : $( SHLIB_EXPORTS :%.txt =%.list )
$(shlib) : $( exports_file )
$(SHLIB_EXPORTS : %.txt =%.list ): %.list : %.txt
$(exports_file) : $( SHLIB_EXPORTS )
$( BUILD.exports)
$( BUILD.exports)
e n d i f
e n d i f
e n d i f
e n d i f
e l s e # PORTNAME == aix
# AIX case
# See notes in src/backend/parser/Makefile about the following two rules
$(stlib) : $( shlib )
touch $@
$(shlib) : $( OBJS ) | $( SHLIB_PREREQS )
rm -f $( stlib)
$( LINK.static) $( stlib) $^
$( RANLIB) $( stlib)
i f e q ( , $( SHLIB_EXPORTS ) )
$( MKLDEXPORT) $( stlib) $( shlib) >$( exports_file)
e l s e
( echo '#! $(shlib)' ; $( AWK) '/^[^#]/ {printf "%s\n",$$1}' ${ srcdir } /$( SHLIB_EXPORTS) ) >$( exports_file)
e n d i f
$( COMPILER) -o $( shlib) $( stlib) -Wl,-bE:$( exports_file) $( LDFLAGS) $( LDFLAGS_SL) $( SHLIB_LINK)
rm -f $( stlib)
$( AR) $( AROPT) $( stlib) $( shlib)
e n d i f # PORTNAME == aix
e l s e # PORTNAME == cygwin || PORTNAME == win32
e l s e # PORTNAME == cygwin || PORTNAME == win32
i f e q ( $( PORTNAME ) , c y g w i n )
i f e q ( $( PORTNAME ) , c y g w i n )