Remake the installation of shared libraries in unix-Makefile.tmpl

Instead of having the installation recipe rely on special knowledge,
feed it with information, including what shared library files belong
together.  For Cygwin and Mingw, that's the .dll and its import
library .dll.a.  For Unixen, it's the shared library file name with SO
version and the one without.

Reviewed-by: Andy Polyakov <appro@openssl.org>
This commit is contained in:
Richard Levitte 2016-02-15 18:39:49 +01:00
parent 9ee0ed3de6
commit c8c2b77900

View file

@ -88,6 +88,8 @@ MISC_SCRIPTS=$(SRCDIR)/tools/c_hash $(SRCDIR)/tools/c_info \
$(SRCDIR)/tools/c_issuer $(SRCDIR)/tools/c_name \ $(SRCDIR)/tools/c_issuer $(SRCDIR)/tools/c_name \
$(BLDDIR)/apps/CA.pl $(SRCDIR)/apps/tsget $(BLDDIR)/apps/CA.pl $(SRCDIR)/apps/tsget
SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -}
# DESTDIR is for package builders so that they can configure for, say, # DESTDIR is for package builders so that they can configure for, say,
# /usr/ and yet have everything installed to /tmp/somedir/usr/. # /usr/ and yet have everything installed to /tmp/somedir/usr/.
# Normally it is left empty. # Normally it is left empty.
@ -282,25 +284,28 @@ install_dev:
$(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
done done
@ : {- output_off() if $config{no_shared}; "" -} @ : {- output_off() if $config{no_shared}; "" -}
@set -e; for s in $(SHLIBS); do \ @set -e; for s in $(SHLIB_INFO); do \
fn=`basename $$s`; \ s1=`echo "$$s" | cut -f1 -d";"`; \
echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ s2=`echo "$$s" | cut -f2 -d";"`; \
cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ fn1=`basename $$s1`; \
chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ fn2=`basename $$s2`; \
mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \ : {- output_off() if windowsdll(); "" -}; \
$(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
if [ "$(SHLIB_EXT)" != "$(SHLIB_EXT_SIMPLE)" ]; then \ cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
fn2=`basename $$fn $(SHLIB_EXT)`$(SHLIB_EXT_SIMPLE); \ mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \
ln -sf $$fn $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
if [ "$$fn1" != "$$fn2" ]; then \
echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
fi; \ fi; \
: {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \
$(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
: {- output_off() unless windowsdll(); "" -}; \ : {- output_off() unless windowsdll(); "" -}; \
echo "install $$s.a -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a"; \
cp $$s.a $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a.new; \
chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a.new; \
mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a.new \
$(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a; \
: {- output_on() unless windowsdll(); "" -}; \
done done
@ : {- output_on() if $config{no_shared}; "" -} @ : {- output_on() if $config{no_shared}; "" -}
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
@ -327,20 +332,25 @@ uninstall_dev:
echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
done done
@set -e; for s in $(SHLIBS); do \ @ : {- output_off() if $config{no_shared}; "" -}
fn=`basename $$s`; \ @set -e; for s in $(SHLIB_INFO); do \
if [ "$(SHLIB_EXT)" != "$(SHLIB_EXT_SIMPLE)" ]; then \ s1=`echo "$$s" | cut -f1 -d";"`; \
fn2=`basename $$fn $(SHLIB_EXT)`$(SHLIB_EXT_SIMPLE); \ s2=`echo "$$s" | cut -f2 -d";"`; \
fn1=`basename $$s1`; \
fn2=`basename $$s2`; \
: {- output_off() if windowsdll(); "" -}; \
echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
if [ "$$fn1" != "$$fn2" ]; then \
echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
fi; \ fi; \
echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
: {- output_off() unless windowsdll(); "" -}; \ : {- output_off() unless windowsdll(); "" -}; \
echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a"; \
$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a; \
: {- output_on() unless windowsdll(); "" -}; \
done done
@ : {- output_on() if $config{no_shared}; "" -}
@echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc" @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
@$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc @$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
@echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc" @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"