Skip to content

Commit 2926085

Browse files
committed
#5 - ci-upgrades
1 parent 536e23b commit 2926085

File tree

4 files changed

+213
-83
lines changed

4 files changed

+213
-83
lines changed

libtool_win32.pl

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/perl -w
22
# -*- mode: perl; -*-
3-
# $Id: libtool_win32.pl,v 1.10 2023/12/26 17:01:00 cvsuser Exp $
3+
# $Id: libtool_win32.pl,v 1.11 2025/02/01 19:57:27 cvsuser Exp $
44
# libtool emulation for WIN32 builds.
55
#
66
# **Warning**
@@ -18,7 +18,7 @@
1818
# $(D_LIB)/%.lo: %.cpp
1919
# $(LIBTOOL) --mode=compile $(CXX) $(CXXFLAGS) -o $(D_OBJ)/$@ -c $<
2020
#
21-
# Copyright Adam Young 2012 - 2023
21+
# Copyright Adam Young 2012 - 2025
2222
# All rights reserved.
2323
#
2424
# This file is part of the Midnight Commander.
@@ -362,8 +362,8 @@
362362
my $cl_ltcg = 0;
363363
my $cl_debug = undef;
364364
my $cl_runtime = 'MT';
365+
my $targetarch = '';
365366
my $gcc_debugger = 0;
366-
my $x64 = 0;
367367
my @OBJECTS;
368368
my @RESOURCES;
369369
my @EXPORTS;
@@ -374,9 +374,9 @@
374374
my @STUFF;
375375

376376
$cc = 'gcc' if ('g++' eq $cc); # alises
377-
if ('cl' eq $cc) {
378-
if (defined $ENV{'LIB'}) { # x64 toolchain selection (TODO: option)
379-
$x64 = 1 if ($ENV{'LIB'} =~ /amd64/);
377+
if ($cc eq 'cl') {
378+
if (defined $ENV{'VSCMD_ARG_TGT_ARCH'} && $ENV{'VSCMD_ARG_TGT_ARCH'} eq "x64") {
379+
$targetarch = 'x64';
380380
}
381381
}
382382

@@ -773,7 +773,7 @@
773773
}
774774

775775
MSVCRuntimeX64($cl_runtime, \@LIBRARIES)
776-
if ($x64 && $cl_runtime);
776+
if ($targetarch eq 'x64' && $cl_runtime);
777777

778778
Verbose "libraries:";
779779
foreach(@LIBRARIES) { Verbose "\t$_"; }
@@ -869,35 +869,31 @@
869869
#
870870
if (defined $ENV{'VCToolsInstallDir'}) { # 2010 plus
871871
my $toolbase = $ENV{'VCToolsInstallDir'};
872-
if ($x64) {
873-
Error("link: x64 linker needed");
874-
} else {
875-
$cmd = "\"${toolbase}\\bin\\Hostx86\\x86\\link\" @STUFF \@$cmdfile";
876-
}
872+
my $toolarch = "Hostx86\\x86";
873+
874+
$toolarch = "Hostx64\\x64" # x86 or x64
875+
if ($targetarch eq 'x64');
876+
877+
$cmd = "\"${toolbase}\\bin\\${toolarch}\\link\" \@$cmdfile";
877878

878879
} elsif (defined $ENV{'VCINSTALLDIR'}) { # 2008
879880
my $toolbase = $ENV{'VCINSTALLDIR'};
880-
if ($x64) {
881-
$cmd = "\"${toolbase}\\bin\\amd64\\link\" @STUFF \@$cmdfile";
882-
} else {
883-
$cmd = "\"${toolbase}\\bin\\link\" @STUFF \@$cmdfile";
884-
}
881+
$cmd = "\"${toolbase}\\bin\\link\" \@$cmdfile";
885882

886-
} else { # default
887-
if ($x64) {
888-
Error("link: x64 linker needed");
889-
} else {
890-
$cmd = "link @STUFF \@$cmdfile";
891-
}
883+
} else { # default
884+
$cmd = "link \@$cmdfile";
892885
}
893886

894887
open(CMD, ">${cmdfile}") or
895888
die "cannot create <${$cmdfile}>: $!\n";
896889

890+
print CMD "/MACHINE:${targetarch}\n"
891+
if ($targetarch); # ARM|ARM64|ARM64X|EBC|X64|X86
892+
897893
if ($linktype eq 'dll') {
898894
print CMD "/DLL\n";
899895
print CMD "/SUBSYSTEM:WINDOWS\n";
900-
if ($x64) { # cdecl
896+
if ($targetarch eq 'x64') { # cdecl
901897
print CMD "/ENTRY:_DllMainCRTStartup"."\n";
902898
} else { # STDCALL
903899
print CMD "/ENTRY:_DllMainCRTStartup\@12"."\n";
@@ -908,9 +904,6 @@
908904
print CMD "/SUBSYSTEM:CONSOLE\n";
909905
print CMD "/OUT:${output}\n";
910906
}
911-
912-
print CMD "/MACHINE:X64\n"
913-
if ($x64);
914907
print CMD "/MANIFEST\n";
915908
print CMD "/NXCOMPAT\n";
916909
print CMD "/DYNAMICBASE\n";
@@ -929,7 +922,7 @@
929922
print CMD "/LTCG\n"
930923
if ($cl_ltcg);
931924
print CMD "/IGNORE:4197\n" # FIXME: warning LNK4197: export 'XXXe' specified multiple times; using first specification
932-
if ($x64);
925+
if ($targetarch eq 'x64');
933926

934927
foreach(@OBJECTS) {
935928
print CMD true_object($_)."\n";
@@ -1130,6 +1123,7 @@
11301123
print LA "dll=${dllpath}\n";
11311124
print LA "pdb=${pdbpath}\n" if ($pdbpath);
11321125
print LA "manifest=${manifestpath}\n" if ($manifestpath);
1126+
print LA "targetarch=${targetarch}\n" if ($targetarch);
11331127
print LA "[objects]\n";
11341128
foreach(@OBJECTS) {
11351129
print LA true_object($_)."\n";

makeconfig.pm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# $Id: makeconfig.pm,v 1.3 2023/12/26 17:01:00 cvsuser Exp $
1+
# $Id: makeconfig.pm,v 1.4 2025/02/01 19:57:27 cvsuser Exp $
22
# Makefile generation under Win32.
33
# -*- perl; tabs: 8; indent-width: 4; -*-
44
# Automake emulation for non-unix environments.
55
#
66
#
7-
# Copyright (c) 2020 - 2022, Adam Young.
7+
# Copyright (c) 2020 - 2025, Adam Young.
88
# All rights reserved.
99
#
1010
# This file is part of the WinRSH/WinSSH project.
@@ -59,6 +59,7 @@ our $CONFIG_FILE = 'w32config.h';
5959
our $TOOLCHAIN = undef;
6060

6161
our @MAKEFILES = (); # local makefiles; build order
62+
our @CONTRIBEXTRA = ();
6263

6364
our @LIBRARIES = (); # local libraries -l<xxx> lib<xxx>.lib
6465
our @LIBRARIES2 = (); # local libraries -l<xxx> xxx.lib
@@ -321,6 +322,7 @@ sub __ExportConfigurations
321322
$self->{LIBRARIES2} = \@LIBRARIES2;
322323
$self->{TESTLIBRARIES} = \@TESTLIBRARIES;
323324
$self->{OPTLIBRARIES} = \@OPTLIBRARIES;
325+
$self->{CONTRIBEXTRA} = \@CONTRIBEXTRA;
324326

325327
$$x_tokens{PACKAGE_VERSION} = $PACKAGE_VERSION;
326328
$$x_tokens{PACKAGE_STRING} = $PACKAGE_NAME . ' ' . $PACKAGE_VERSION;

makelib.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/perl
2-
# $Id: makelib.in,v 1.12 2023/12/26 17:01:00 cvsuser Exp $
2+
# $Id: makelib.in,v 1.13 2025/02/01 19:57:27 cvsuser Exp $
33
# -*- mode: perl; tabs: 8; indent-width: 4; -*-
44
# makelib configuration
55
#
@@ -34,7 +34,7 @@
3434

3535
$PACKAGE = 'winsh';
3636
$PACKAGE_NAME = 'WinSSH/WinRSH';
37-
$PACKAGE_VERSION = '0.3.0';
37+
$PACKAGE_VERSION = '0.3.1';
3838

3939
$PACKAGE_URL = 'https://github.com/adamyg/winxsh';
4040

0 commit comments

Comments
 (0)