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