PR: 2003
authorDr. Stephen Henson <steve@openssl.org>
Mon, 10 Aug 2009 14:37:51 +0000 (14:37 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 10 Aug 2009 14:37:51 +0000 (14:37 +0000)
Make it possible to install OpenSSL in directories with name other
than "lib" for example "lib64". Based on patch from Jeremy Utley.

CHANGES
Configure
Makefile.org
engines/Makefile
fips/Makefile

diff --git a/CHANGES b/CHANGES
index 407b8a573cf1bbc6d632d298c93dd79dabc57cb8..5e55c01ec73ecc379ff11f52cadb1746e8623f62 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,12 @@
 
  Changes between 0.9.8k and 0.9.8l  [xx XXX xxxx]
 
+  *) Add support for --libdir option and LIBDIR variable in makefiles. This
+     makes it possible to install openssl libraries in locations which 
+     have names other than "lib", for example "/usr/lib64" which some
+     systems need.
+     [Steve Henson, based on patch from Jeremy Utley]
+
   *) Don't allow the use of leading 0x80 in OIDs. This is a violation of
      X690 8.9.12 and can produce some misleading textual output of OIDs.
      [Steve Henson, reported by Dan Kaminsky]
index 62a5d35d41979527458440db07727e68b8f0adc9..2dfad458a895e8e502d5342b358b8f20642b43be 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -585,6 +585,7 @@ my $idx_ranlib = $idx++;
 my $idx_arflags = $idx++;
 
 my $prefix="";
+my $libdir="";
 my $openssldir="";
 my $exe_ext="";
 my $install_prefix="";
@@ -820,6 +821,10 @@ PROCESS_ARGS:
                                {
                                $prefix=$1;
                                }
+                       elsif (/^--libdir=(.*)$/)
+                               {
+                               $libdir=$1;
+                               }
                        elsif (/^--openssldir=(.*)$/)
                                {
                                $openssldir=$1;
@@ -1083,6 +1088,8 @@ if ($openssldir eq "" and $prefix eq "")
        }
 $prefix=$openssldir if $prefix eq "";
 
+$libdir="lib" if $libdir eq "";
+
 $default_ranlib= &which("ranlib") or $default_ranlib="true";
 $perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
   or $perl="perl";
@@ -1467,6 +1474,7 @@ while (<IN>)
        s/^SHLIB_EXT=.*/SHLIB_EXT=$shared_extension/;
        s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/;
        s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
+       s/^LIBDIR=.*$/LIBDIR=$libdir/;
        s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/;
        s/^PLATFORM=.*$/PLATFORM=$target/;
        s/^OPTIONS=.*$/OPTIONS=$options/;
index 06b942fa5c085cf1751f1b670b45db3dc7995077..a7ba612e9f224701fcec2116a7f3c41295a286c8 100644 (file)
@@ -71,6 +71,7 @@ PERL= perl
 TAR= tar
 TARFLAGS= --no-recursion
 MAKEDEPPROG=makedepend
+LIBDIR=lib
 
 # We let the C compiler driver to take care of .s files. This is done in
 # order to be excused from maintaining a separate set of architecture
@@ -112,7 +113,7 @@ LIBZLIB=
 # $(INSTALLTOP) for this build make be different so hard
 # code the path.
 
-FIPSLIBDIR=/usr/local/ssl/lib/
+FIPSLIBDIR=/usr/local/ssl/$(LIBDIR)/
 
 # This is set to "y" if fipscanister.o is compiled internally as
 # opposed to coming from an external validated location.
@@ -200,7 +201,7 @@ BUILDENV=   PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
                CC='${CC}' CFLAG='${CFLAG}'                     \
                AS='${CC}' ASFLAG='${CFLAG} -c'                 \
                AR='${AR}' PERL='${PERL}' RANLIB='${RANLIB}'    \
-               SDIRS='${SDIRS}' LIBRPATH='${INSTALLTOP}/lib'   \
+               SDIRS='${SDIRS}' LIBRPATH='${INSTALLTOP}/$(LIBDIR)'     \
                INSTALL_PREFIX='${INSTALL_PREFIX}'              \
                INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}'   \
                MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD ${MAKEDEPPROG}' \
@@ -436,7 +437,7 @@ do_$(SHLIB_TARGET):
 libcrypto.pc: Makefile
        @ ( echo 'prefix=$(INSTALLTOP)'; \
            echo 'exec_prefix=$${prefix}'; \
-           echo 'libdir=$${exec_prefix}/lib'; \
+           echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
            echo 'includedir=$${prefix}/include'; \
            echo ''; \
            echo 'Name: OpenSSL-libcrypto'; \
@@ -449,7 +450,7 @@ libcrypto.pc: Makefile
 libssl.pc: Makefile
        @ ( echo 'prefix=$(INSTALLTOP)'; \
            echo 'exec_prefix=$${prefix}'; \
-           echo 'libdir=$${exec_prefix}/lib'; \
+           echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
            echo 'includedir=$${prefix}/include'; \
            echo ''; \
            echo 'Name: OpenSSL'; \
@@ -462,7 +463,7 @@ libssl.pc: Makefile
 openssl.pc: Makefile
        @ ( echo 'prefix=$(INSTALLTOP)'; \
            echo 'exec_prefix=$${prefix}'; \
-           echo 'libdir=$${exec_prefix}/lib'; \
+           echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
            echo 'includedir=$${prefix}/include'; \
            echo ''; \
            echo 'Name: OpenSSL'; \
@@ -615,9 +616,9 @@ install: all install_docs install_sw
 
 install_sw:
        @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
-               $(INSTALL_PREFIX)$(INSTALLTOP)/lib \
-               $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines \
-               $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig \
+               $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
+               $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
+               $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
                $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
                $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
                $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
@@ -632,10 +633,10 @@ install_sw:
        do \
                if [ -f "$$i" ]; then \
                (       echo installing $$i; \
-                       cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
-                       $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
-                       chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
-                       mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
+                       cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
+                       $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
+                       chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
+                       mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
                fi; \
        done;
        @set -e; if [ -n "$(SHARED_LIBS)" ]; then \
@@ -645,22 +646,22 @@ install_sw:
                        if [ -f "$$i" -o -f "$$i.a" ]; then \
                        (       echo installing $$i; \
                                if [ "$(PLATFORM)" != "Cygwin" ]; then \
-                                       cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
-                                       chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
-                                       mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
+                                       cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
+                                       chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
+                                       mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
                                else \
                                        c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
                                        cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
                                        chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
                                        mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
-                                       cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
-                                       chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
-                                       mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
+                                       cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
+                                       chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
+                                       mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
                                fi ); \
                        fi; \
                done; \
                (       here="`pwd`"; \
-                       cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
+                       cd $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR); \
                        $(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
                if [ "$(INSTALLTOP)" != "/usr" ]; then \
                        echo 'OpenSSL shared libraries have been installed in:'; \
@@ -669,12 +670,12 @@ install_sw:
                        sed -e '1,/^$$/d' doc/openssl-shared.txt; \
                fi; \
        fi
-       cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig
-       chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig/libcrypto.pc
-       cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig
-       chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig/libssl.pc
-       cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig
-       chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig/openssl.pc
+       cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
+       chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
+       cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
+       chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
+       cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
+       chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
 
 install_docs:
        @$(PERL) $(TOP)/util/mkdir-p.pl \
index d8198b65860630b710122aff04151097654896a9..29e2ac49d07e4ef062a7f7a96d5e2e23b950a856 100644 (file)
@@ -100,13 +100,13 @@ install:
                                *DSO_DL*)       sfx="sl";;      \
                                *)              sfx="bad";;     \
                                esac; \
-                               cp lib$$l.$$sfx $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
+                               cp lib$$l.$$sfx $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/lib$$l.$$sfx.new; \
                          else \
                                sfx="so"; \
-                               cp cyg$$l.dll $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
+                               cp cyg$$l.dll $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/lib$$l.$$sfx.new; \
                          fi; \
-                         chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
-                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx ); \
+                         chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/lib$$l.$$sfx.new; \
+                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/lib$$l.$$sfx.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/lib$$l.$$sfx ); \
                done; \
        fi
 
index 87f95e2cc455535fda0e4fb5d87ff22dcfeee3d0..6e7d56945a01a31282503b705ba01711ca86b2bf 100644 (file)
@@ -188,8 +188,8 @@ install:
        done
        cp -p -f $(FIPSLIBDIR)fipscanister.o $(FIPSLIBDIR)fipscanister.o.sha1 \
                $(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fips_premain.c.sha1 \
-               $(INSTALL_PREFIX)$(INSTALLTOP)/lib/; \
-       chmod 0444 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/fips*
+               $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/; \
+       chmod 0444 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/fips*
 
 lint:
        @target=lint; $(RECURSIVE_MAKE)