Skip to content

Commit

Permalink
Simplify the handling of shared library version numbers
Browse files Browse the repository at this point in the history
$(SHLIB_MAJOR).$(SHLIB_MINOR) is really a synonym for
$(SHLIB_VERSION_NUMBER), and is therefore an added complexity,
so better to use $(SHLIB_VERSION_NUMBER) directly.  SHLIB_MAJOR and
SHLIB_MINOR are now unused, but are kept around purely as information
in case someone relies on their existence.

At the same time, add support for custom shared library extensions
with the three new Makefile variables SHLIB_EXT, SHLIB_EXT_SIMPLE and
SHLIB_EXT_IMPORT.  By default, they hold the variants of shared
library extensions we support.  On mingw and cygwin, SHLIB_EXT_IMPORT
is defined; on all other Unix platforms, it's empty.

An example to get shared libraries with a slightly different SOVER name:

    $ make SHLIB_EXT='.$(SHLIB_VERSION_NUMBER).so'

Fixes #3902

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from #3964)
  • Loading branch information
levitte committed Jul 26, 2017
1 parent 00606b0 commit d445302
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 68 deletions.
62 changes: 31 additions & 31 deletions Configurations/10-main.conf
Expand Up @@ -183,7 +183,7 @@ sub vms_info {
dso_scheme => "dlfcn",
thread_scheme => "pthreads",
shared_target => "solaris-shared",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},
#### Solaris x86 with GNU C setups
"solaris-x86-gcc" => {
Expand Down Expand Up @@ -333,7 +333,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "irix-shared",
shared_ldflag => "-mabi=n32",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
multilib => "32",
},
"irix-mips3-cc" => {
Expand All @@ -350,7 +350,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "irix-shared",
shared_ldflag => "-n32",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
multilib => "32",
},
# N64 ABI builds.
Expand All @@ -368,7 +368,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "irix-shared",
shared_ldflag => "-mabi=64",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
multilib => "64",
},
"irix64-mips4-cc" => {
Expand All @@ -385,7 +385,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "irix-shared",
shared_ldflag => "-64",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
multilib => "64",
},

Expand Down Expand Up @@ -431,7 +431,7 @@ sub vms_info {
shared_target => "hpux-shared",
shared_cflag => "-fPIC",
shared_ldflag => "-shared",
shared_extension => ".sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
},
"hpux-parisc1_1-gcc" => {
inherit_from => [ "hpux-parisc-gcc", asm("parisc11_asm") ],
Expand All @@ -451,7 +451,7 @@ sub vms_info {
shared_target => "hpux-shared",
shared_cflag => "-fpic",
shared_ldflag => "-shared",
shared_extension => ".sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
multilib => "/pa20_64",
},

Expand All @@ -473,7 +473,7 @@ sub vms_info {
shared_target => "hpux-shared",
shared_cflag => "+Z",
shared_ldflag => "-b",
shared_extension => ".sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
},
"hpux-parisc1_1-cc" => {
inherit_from => [ "hpux-parisc-cc", asm("parisc11_asm") ],
Expand All @@ -494,7 +494,7 @@ sub vms_info {
shared_target => "hpux-shared",
shared_cflag => "+Z",
shared_ldflag => "+DD64 -b",
shared_extension => ".sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
multilib => "/pa20_64",
},

Expand All @@ -513,7 +513,7 @@ sub vms_info {
shared_target => "hpux-shared",
shared_cflag => "+Z",
shared_ldflag => "+DD32 -b",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
multilib => "/hpux32",
},
# Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted
Expand All @@ -532,7 +532,7 @@ sub vms_info {
shared_target => "hpux-shared",
shared_cflag => "+Z",
shared_ldflag => "+DD64 -b",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
multilib => "/hpux64",
},
# GCC builds...
Expand All @@ -550,7 +550,7 @@ sub vms_info {
shared_target => "hpux-shared",
shared_cflag => "-fpic",
shared_ldflag => "-shared",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
multilib => "/hpux32",
},
"hpux64-ia64-gcc" => {
Expand All @@ -567,7 +567,7 @@ sub vms_info {
shared_target => "hpux-shared",
shared_cflag => "-fpic",
shared_ldflag => "-mlp64 -shared",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
multilib => "/hpux64",
},

Expand Down Expand Up @@ -632,7 +632,7 @@ sub vms_info {
shared_target => "linux-shared",
shared_cflag => "-fPIC -DOPENSSL_USE_NODELETE",
shared_ldflag => "-Wl,-znodelete",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},
"linux-generic64" => {
inherit_from => [ "linux-generic32" ],
Expand Down Expand Up @@ -874,7 +874,7 @@ sub vms_info {
shared_target => "linux-shared",
shared_cflag => "--pic",
shared_ldflag => add("-z --sysv --shared"),
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
ranlib => "true",
},

Expand Down Expand Up @@ -990,7 +990,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "bsd-gcc-shared",
shared_cflag => "-fPIC",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},
"BSD-generic64" => {
inherit_from => [ "BSD-generic32" ],
Expand Down Expand Up @@ -1046,7 +1046,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "bsd-gcc-shared",
shared_cflag => "-fPIC",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},

"nextstep" => {
Expand Down Expand Up @@ -1080,7 +1080,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "bsd-gcc-shared",
shared_cflag => "-fPIC",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},
"QNX6-i386" => {
inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
Expand All @@ -1090,7 +1090,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "bsd-gcc-shared",
shared_cflag => "-fPIC",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},

#### SCO/Caldera targets.
Expand Down Expand Up @@ -1133,7 +1133,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "svr5-shared",
shared_cflag => "-Kpic",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},
"unixware-7-gcc" => {
inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
Expand All @@ -1147,7 +1147,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "gnu-shared",
shared_cflag => "-fPIC",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},
# SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the SCO cc.
"sco5-cc" => {
Expand All @@ -1160,7 +1160,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "svr3-shared",
shared_cflag => "-Kpic",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},
"sco5-gcc" => {
inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
Expand All @@ -1173,7 +1173,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "svr3-shared",
shared_cflag => "-fPIC",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},

#### IBM's AIX.
Expand All @@ -1196,7 +1196,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "aix-shared",
shared_ldflag => "-shared -static-libgcc -Wl,-G",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
arflags => "-X32",
},
"aix64-gcc" => {
Expand All @@ -1213,7 +1213,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "aix-shared",
shared_ldflag => "-maix64 -shared -static-libgcc -Wl,-G",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
arflags => "-X64",
},
"aix-cc" => {
Expand All @@ -1231,7 +1231,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "aix-shared",
shared_ldflag => "-q32 -G",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
arflags => "-X 32",
},
"aix64-cc" => {
Expand All @@ -1249,7 +1249,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "aix-shared",
shared_ldflag => "-q64 -G",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
arflags => "-X 64",
},

Expand Down Expand Up @@ -1593,7 +1593,7 @@ sub vms_info {
shared_target => "darwin-shared",
shared_cflag => "-fPIC",
shared_ldflag => "-dynamiclib",
shared_extension => ".\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
shared_extension => ".\$(SHLIB_VERSION_NUMBER).dylib",
},
# Option "freeze" such as -std=gnu9x can't negatively interfere
# with future defaults for below two targets, because MacOS X
Expand Down Expand Up @@ -1677,7 +1677,7 @@ sub vms_info {
dso_scheme => "dlfcn",
shared_target => "linux-shared",
shared_cflag => "-fPIC",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},

##### VxWorks for various targets
Expand Down Expand Up @@ -1757,7 +1757,7 @@ sub vms_info {
shared_target => "linux-shared",
shared_cflag => "-fPIC",
shared_ldflag => "-shared",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
ranlib => "$ENV{'RANLIB'}",
},
"uClinux-dist64" => {
Expand All @@ -1773,7 +1773,7 @@ sub vms_info {
shared_target => "linux-shared",
shared_cflag => "-fPIC",
shared_ldflag => "-shared",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
ranlib => "$ENV{'RANLIB'}",
},

Expand Down
2 changes: 1 addition & 1 deletion Configurations/50-haiku.conf
Expand Up @@ -14,7 +14,7 @@
shared_target => "gnu-shared",
shared_cflag => "-fPIC",
shared_ldflag => "-shared",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},
"haiku-x86" => {
inherit_from => [ "haiku-common", asm("x86_elf_asm") ],
Expand Down
8 changes: 4 additions & 4 deletions Configurations/90-team.conf
Expand Up @@ -26,7 +26,7 @@
shared_target => "linux-shared",
shared_cflag => "-fPIC",
shared_ldflag => "-m64",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
multilib => "64",
},
"debug-linux-pentium" => {
Expand Down Expand Up @@ -74,7 +74,7 @@
dso_scheme => "dlfcn",
shared_target => "linux-shared",
shared_cflag => "-fPIC",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},
"dist" => {
cc => "cc",
Expand All @@ -92,7 +92,7 @@
dso_scheme => "dlfcn",
shared_target => "bsd-gcc-shared",
shared_cflag => "-fPIC",
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
},
"darwin64-debug-test-64-clang" => {
inherit_from => [ "x86_64_asm" ],
Expand All @@ -107,6 +107,6 @@
shared_target => "darwin-shared",
shared_cflag => "-fPIC -fno-common",
shared_ldflag => "-arch x86_64 -dynamiclib",
shared_extension => ".\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
shared_extension => ".\$(SHLIB_VERSION_NUMBER).dylib",
},
);
9 changes: 5 additions & 4 deletions Configurations/descrip.mms.tmpl
Expand Up @@ -9,7 +9,7 @@
our $osslprefix = 'OSSL$';
(our $osslprefix_q = $osslprefix) =~ s/\$/\\\$/;

our $sover = sprintf "%02d%02d", $config{shlib_major}, $config{shlib_minor};
our $sover_dirname = sprintf "%02d%02d", split(/\./, $config{shlib_version_number});
our $osslver = sprintf "%02d%02d", split(/\./, $config{version});

our $sourcedir = $config{sourcedir};
Expand Down Expand Up @@ -169,7 +169,7 @@ OPENSSLDIR={- catdir($config{openssldir}) or
# The same, but for C
OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000]
# Where installed engines reside, for C
ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover.$target{pointer_size} -}:
ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover_dirname.$target{pointer_size} -}:

CC= {- $target{cc} -}
CFLAGS= /DEFINE=({- join(",", @{$target{defines}}, @{$config{defines}},"OPENSSLDIR=\"\"\"\$(OPENSSLDIR_C)\"\"\"","ENGINESDIR=\"\"\"\$(ENGINESDIR_C)\"\"\"") -}) {- $target{cflags} -} {- $config{cflags} -}
Expand Down Expand Up @@ -442,9 +442,9 @@ install_runtime : install_shared _install_runtime_ns
install_engines : check_INSTALLTOP
@ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
@ WRITE SYS$OUTPUT "*** Installing engines"
- CREATE/DIR ossl_installroot:[ENGINES{- $sover.$target{pointer_size} -}.'arch']
- CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
{- join("\n ",
map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover$target{pointer_size}.'arch']" }
map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
@{$unified_info{install}->{engines}}) -}
@ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !

Expand Down Expand Up @@ -497,6 +497,7 @@ vmsconfig.pm : configdata.pm
WRITE CONFIG "our %config = ("
WRITE CONFIG " target => '","{- $config{target} -}","',"
WRITE CONFIG " version => '","{- $config{version} -}","',"
WRITE CONFIG " shlib_version_number => '","{- $config{shlib_version_number} -}","',"
WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
Expand Down

0 comments on commit d445302

Please sign in to comment.