Commit 78a50c75 authored by Andy Polyakov's avatar Andy Polyakov
Browse files

Configurations/10-main.conf: VC-<target> cleanups.

parent a23f0316
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -109,6 +109,15 @@ my %targets=(
        inherit_from    => [ "BASE_common" ],
        template        => 1,

        lib_defines      =>
            sub {
                my @defs = ();
                unless ($disabled{"zlib-dynamic"}) {
                    my $zlib = $withargs{zlib_lib} // "ZLIB1";
                    push @defs, quotify("perl", 'LIBZ="' . $zlib . '"');
                }
                return [ @defs ];
            },
        ex_libs         =>
            sub {
                unless ($disabled{zlib}) {
+29 −50
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ sub vc_win64a_info {
        } elsif ($disabled{asm}) {
            # assembler is still used to compile uplink shim
            $vc_win64a_info = { AS        => "ml64",
                                ASFLAGS   => "/Zi",
                                ASFLAGS   => "/nologo /Zi",
                                asflags   => "/c /Cp /Cx",
                                asoutflag => "/Fo" };
        } else {
@@ -1346,46 +1346,45 @@ my %targets = (

#### Visual C targets
#
# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
# Win64 targets, WIN64I denotes IA-64/Itanium and WIN64A - AMD64
#
# Note about -wd4090, disable warning C4090. This warning returns false
# Note about /wd4090, disable warning C4090. This warning returns false
# positives in some situations. Disabling it altogether masks both
# legitimate and false cases, but as we compile on multiple platforms,
# we rely on other compilers to catch legitimate cases.
#
# Also note that we force threads no matter what.  Configuring "no-threads"
# is ignored.
#
# UNICODE is defined in VC-common and applies to all targets. It used to
# be an opt-in option for VC-WIN32, but not anymore. The original reason
# was because ANSI API was *native* system interface for no longer
# supported Windows 9x. Keep in mind that UNICODE only affects how
# OpenSSL libraries interact with underlying OS, it doesn't affect API
# that OpenSSL presents to application.

    "VC-common" => {
        inherit_from     => [ "BASE_Windows" ],
        template         => 1,
        CC               => "cl",
        CPP              => '$(CC) /EP /C',
        CFLAGS           => "-W3 -wd4090 -nologo",
        CFLAGS           => "/W3 /wd4090 /nologo",
        LDFLAGS          => add("/debug"),
        coutflag         => "/Fo",
        cflags           => '-Gs0 -GF -Gy',
        defines          => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN",
                                "UNICODE", "_UNICODE",
                                "_CRT_SECURE_NO_DEPRECATE",
                                "_WINSOCK_DEPRECATED_NO_WARNINGS"),
        lib_cflags       => add("/Zi /Fdossl_static"),
        lib_defines      => add([ "L_ENDIAN" ],
                                sub { my @defs = ();
                                      unless ($disabled{"zlib-dynamic"}) {
                                          my $zlib =
                                              $withargs{zlib_lib} // "ZLIB1";
                                          push @defs,
                                              quotify("perl",
                                                      'LIBZ="' . $zlib . '"');
                                      }
                                      return [ @defs ];
                                  }),
        dso_cflags       => "/Zi /Fddso",
        bin_cflags       => "/Zi /Fdapp",
        lib_cflags       => add("/Zi /Fdossl_static.pdb"),
        lib_defines      => add("L_ENDIAN"),
        dso_cflags       => "/Zi /Fddso.pdb",
        bin_cflags       => "/Zi /Fdapp.pdb",
        shared_ldflag    => "/dll",
        shared_target    => "win-shared", # meaningless except it gives Configure a hint
        thread_scheme    => "winthreads",
        dso_scheme       => "win32",
        apps_aux_src     => add("win32_init.c"),
        bn_ops           => "EXPORT_VAR_AS_FN",
        # additional parameter to build_scheme denotes install-path "flavour"
        build_scheme     => add("VC-common", { separator => undef }),
    },
@@ -1394,7 +1393,8 @@ my %targets = (
        template         => 1,
        CFLAGS           => add(picker(debug   => '/Od',
                                       release => '/O2')),
        cflags           => add(picker(debug   =>
        cflags           => add(picker(default => '/Gs0 /GF /Gy',
                                       debug   =>
                                       sub {
                                           ($disabled{shared} ? "" : "/MDd");
                                       },
@@ -1402,8 +1402,7 @@ my %targets = (
                                       sub {
                                           ($disabled{shared} ? "" : "/MD");
                                       })),
        defines          => add(picker(default => [ "UNICODE", "_UNICODE" ],
                                       debug   => [ "DEBUG", "_DEBUG" ])),
        defines          => add(picker(debug   => [ "DEBUG", "_DEBUG" ])),
        lib_cflags       => add(sub { $disabled{shared} ? "/MT /Zl" : () }),
        # Following might/should appears controversial, i.e. defining
        # /MDd without evaluating $disabled{shared}. It works in
@@ -1435,7 +1434,7 @@ my %targets = (
            push @ex_libs, 'bufferoverflowu.lib' if (`cl 2>&1` =~ /14\.00\.4[0-9]{4}\./);
            return join(" ", @_, @ex_libs);
        }),
        bn_ops           => "SIXTY_FOUR_BIT EXPORT_VAR_AS_FN",
        bn_ops           => add("SIXTY_FOUR_BIT"),
    },
    "VC-WIN64I" => {
        inherit_from     => [ "VC-WIN64-common", asm("ia64_asm"),
@@ -1463,27 +1462,15 @@ my %targets = (
        multilib         => "-x64",
    },
    "VC-WIN32" => {
        # x86 Win32 target used to default to ANSI API, but not anymore,
        # UNICODE is the only option. The original reason for providing
        # UNICODE as opt-in option was because ANSI API was *native*
        # system interface for [no longer supported] Windows 9x.
        inherit_from     => [ "VC-noCE-common", asm("x86_asm"),
                              sub { $disabled{shared} ? () : "uplink_common" } ],
        CFLAGS           => add("-WX"),
        CFLAGS           => add("/WX"),
        AS               => sub { vc_win32_info()->{AS} },
        ASFLAGS          => sub { vc_win32_info()->{ASFLAGS} },
        asoutflag        => sub { vc_win32_info()->{asoutflag} },
        asflags          => sub { vc_win32_info()->{asflags} },
        ex_libs          => add(sub {
            my @ex_libs = ();
            # WIN32 UNICODE build gets linked with unicows.lib for
            # backward compatibility with Win9x.
            push @ex_libs, 'unicows.lib'
                if (grep { $_ eq "UNICODE" } @{$user{CPPDEFINES}});
            return join(" ", @ex_libs, @_);
        }),
        sys_id           => "WIN32",
        bn_ops           => "BN_LLONG EXPORT_VAR_AS_FN",
        bn_ops           => add("BN_LLONG"),
        perlasm_scheme   => sub { vc_win32_info()->{perlasm_scheme} },
        # "WOW" stands for "Windows on Windows", and "VC-WOW" engages
        # some installation path heuristics in windows-makefile.tmpl...
@@ -1491,14 +1478,8 @@ my %targets = (
    },
    "VC-CE" => {
        inherit_from     => [ "VC-common" ],
        AS               => "ml",
        ASFLAGS          => "/nologo",
        asoutflag        => "/Fo",
        asflags          => "/Cp /coff /c /Cx /Zi",
        CC               => "cl",
        CFLAGS           => picker(default => '/W3 /WX /nologo',
                                   debug   => "/Od",
                                   release => "/O1i"),
        CFLAGS           => add(picker(debug   => "/Od",
                                       release => "/O1i")),
        CPPDEFINES       => picker(debug   => [ "DEBUG", "_DEBUG" ]),
        LDFLAGS          => add("/nologo /opt:ref"),
        cflags           =>
@@ -1508,9 +1489,7 @@ my %targets = (
                              ? ($disabled{shared} ? " /MT" : " /MD")
                              : " /MC"; }),
        cppflags         => sub { vc_wince_info()->{cppflags}; },
        defines          => [ "WIN32_LEAN_AND_MEAN" ],
        lib_defines      => [ "L_ENDIAN", "DSO_WIN32", "NO_CHMOD",
                              "OPENSSL_SMALL_FOOTPRINT" ],
        lib_defines      => add("NO_CHMOD", "OPENSSL_SMALL_FOOTPRINT"),
        lib_cppflags     => sub { vc_wince_info()->{cppflags}; },
        includes         =>
            add(combine(sub { defined(env('WCECOMPAT'))
@@ -1522,7 +1501,7 @@ my %targets = (
                                        sub { defined(env('PORTSDK_LIBPATH'))
                                                  ? "/entry:mainCRTstartup" : (); })),
        sys_id           => "WINCE",
        bn_ops           => "BN_LLONG EXPORT_VAR_AS_FN",
        bn_ops           => add("BN_LLONG"),
        ex_libs          => add(sub {
            my @ex_libs = ();
            push @ex_libs, 'ws2.lib' unless $disabled{sock};