Rework building: Windows changes to handle extensions and product names
[openssl.git] / Configurations / platform / Windows.pm
1 package platform::Windows;
2
3 use strict;
4 use warnings;
5 use Carp;
6
7 use vars qw(@ISA);
8
9 require platform::BASE;
10 @ISA = qw(platform::BASE);
11
12 # Assume someone set @INC right before loading this module
13 use configdata;
14
15 sub binext              { '.exe' }
16 sub dsoext              { '.dll' }
17 sub shlibext            { '.dll' }
18 sub libext              { '.lib' }
19 sub defext              { '.def' }
20 sub objext              { '.obj' }
21 sub depext              { '.d' }
22 sub asmext              { '.asm' }
23
24 # Other extra that aren't defined in platform::BASE
25 sub resext              { '.res' }
26 sub shlibextimport      { '.lib' }
27 sub shlibvariant        { $target{shlib_variant} || '' }
28
29 sub staticname {
30     # Non-installed libraries are *always* static, and their names remain
31     # the same, except for the mandatory extension
32     my $in_libname = platform::BASE->staticname($_[1]);
33     return $in_libname
34         unless ( grep { platform::BASE->staticname($_) eq $in_libname }
35                  @{$unified_info{install}->{libraries}} );
36
37     # To make sure not to clash with an import library, we make the static
38     # variant of our installed libraries get '_static' added to their names.
39     return platform::BASE->staticname($_[1])
40         . ($disabled{shared} ? '' : '_static');
41 }
42
43 # To mark forward compatibility, we include the OpenSSL major release version
44 # number in the installed shared library names.
45 (my $sover_filename = $config{shlib_version}) =~ s|\.|_|g;
46 sub shlib_version_as_filename {
47     return $sover_filename
48 }
49 sub sharedname {
50     return platform::BASE::__concat(platform::BASE->sharedname($_[1]),
51                                     "-",
52                                     $_[0]->shlib_version_as_filename(),
53                                     ($_[0]->shlibvariant() // ''));
54 }
55
56 sub sharedname_import {
57     return platform::BASE::__isshared($_[1]) ? $_[1] : undef;
58 }
59
60 sub sharedlib_import {
61     return platform::BASE::__concat($_[0]->sharedname_import($_[1]),
62                                     $_[0]->shlibextimport());
63 }
64
65 1;