xref: /freebsd/crypto/openssl/Configurations/platform/Unix.pm (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
1package platform::Unix;
2
3use strict;
4use warnings;
5use Carp;
6
7use vars qw(@ISA);
8
9require platform::BASE;
10@ISA = qw(platform::BASE);
11
12# Assume someone set @INC right before loading this module
13use configdata;
14
15sub binext              { $target{exe_extension} || '' }
16sub dsoext              { $target{dso_extension} || platform->shlibextsimple()
17                              || '.so' }
18# Because these are also used in scripts and not just Makefile, we must
19# convert $(SHLIB_VERSION_NUMBER) to the actual number.
20sub shlibext            { (my $x = $target{shared_extension}
21                               || '.so.$(SHLIB_VERSION_NUMBER)')
22                              =~ s|\.\$\(SHLIB_VERSION_NUMBER\)
23                                  |.$config{shlib_version}|x;
24                          $x; }
25sub libext              { $target{lib_extension} || '.a' }
26sub defext              { $target{def_extension} || '.ld' }
27sub objext              { $target{obj_extension} || '.o' }
28sub depext              { $target{obj_extension} || '.d' }
29
30# Other extra that aren't defined in platform::BASE
31sub shlibextsimple      { (my $x = $target{shared_extension} || '.so')
32                              =~ s|\.\$\(SHLIB_VERSION_NUMBER\)||;
33                          $x; }
34sub shlibvariant        { $target{shlib_variant} || "" }
35sub makedepcmd          { $disabled{makedepend} ? undef : $config{makedepcmd} }
36
37# No conversion of assembler extension on Unix
38sub asm {
39    return $_[1];
40}
41
42# At some point, we might decide that static libraries are called something
43# other than the default...
44sub staticname {
45    # Non-installed libraries are *always* static, and their names remain
46    # the same, except for the mandatory extension
47    my $in_libname = platform::BASE->staticname($_[1]);
48    return $in_libname
49        if $unified_info{attributes}->{libraries}->{$_[1]}->{noinst};
50
51    # We currently return the same name anyway...  but we might choose to
52    # append '_static' or '_a' some time in the future.
53    return platform::BASE->staticname($_[1]);
54}
55
56sub sharedname {
57    return platform::BASE::__concat(platform::BASE->sharedname($_[1]),
58                                    ($_[0]->shlibvariant() // ''));
59}
60
61sub sharedname_simple {
62    return platform::BASE::__isshared($_[1]) ? $_[1] : undef;
63}
64
65sub sharedlib_simple {
66    # This function returns the simplified shared library name (no version
67    # or variant in the shared library file name) if the simple variants of
68    # the base name or the suffix differ from the full variants of the same.
69
70    # Note: if $_[1] isn't a shared library name, then $_[0]->sharedname()
71    # and $_[0]->sharedname_simple() will return undef.  This needs being
72    # accounted for.
73    my $name = $_[0]->sharedname($_[1]);
74    my $simplename = $_[0]->sharedname_simple($_[1]);
75    my $ext = $_[0]->shlibext();
76    my $simpleext = $_[0]->shlibextsimple();
77
78    return undef unless defined $simplename && defined $name;
79    return undef if ($name eq $simplename && $ext eq $simpleext);
80    return platform::BASE::__concat($simplename, $simpleext);
81}
82
83sub sharedlib_import {
84    return undef;
85}
86
871;
88