Module: tools Branch: master Commit: 34479b22731c94a0283928091d41b4ddf379587c URL: https://source.winehq.org/git/tools.git/?a=commit;h=34479b22731c94a028392809...
Author: Francois Gouget fgouget@codeweavers.com Date: Mon Mar 23 10:04:03 2020 +0100
testbot: Simplify building Wine.
The shared BuildWine() function will reconfigure Wine if given the configure parameters, and build the specified Wine target. For the build VMs the configure options disable the X and FreeType checks, tell Wine not to build the WineTest executable, and the buildtests target ensures only the tests are built. Meanwhile the wine VMs essentially use the default configure options and make target.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47849 Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/bin/build/Build.pl | 71 ++------------------------------------- testbot/bin/build/Reconfig.pl | 55 +++--------------------------- testbot/bin/build/WineReconfig.pl | 29 ++-------------- testbot/bin/build/WineTest.pl | 30 ++--------------- testbot/lib/Build/Utils.pm | 26 +++++++++++++- 5 files changed, 38 insertions(+), 173 deletions(-)
diff --git a/testbot/bin/build/Build.pl b/testbot/bin/build/Build.pl index 4c342a5..b2c13c8 100755 --- a/testbot/bin/build/Build.pl +++ b/testbot/bin/build/Build.pl @@ -50,72 +50,6 @@ use WineTestBot::Missions; use WineTestBot::Utils;
-# -# Build helpers -# - - -sub BuildNative() -{ - InfoMsg "\nRebuilding native tools\n"; - my $CPUCount = GetCPUCount(); - system("cd '$DataDir/wine-native' && set -x && ". - "time make -j$CPUCount __tooldeps__"); - if ($? != 0) - { - LogMsg "The Wine native tools build failed\n"; - return !1; - } - - return 1; -} - -sub BuildTestExecutables($$$) -{ - my ($TaskMissions, $Impacts, $Build) = @_; - - return 1 if (!$TaskMissions->{Builds}->{$Build}); - - my (@BuildDirs, @TestExes); - foreach my $TestInfo (values %{$Impacts->{Tests}}) - { - next if (!$TestInfo->{UnitCount}); - push @BuildDirs, $TestInfo->{Path}; - my $TestExe = "$TestInfo->{Path}/$TestInfo->{ExeBase}.exe"; - push @TestExes, $TestExe; - unlink("$DataDir/wine-$Build/$TestExe"); # Ignore errors - } - - InfoMsg "\nBuilding the $Build Wine test executable(s)\n"; - if (!@BuildDirs) - { - InfoMsg "Nothing to do\n"; - return 1; - } - - my $CPUCount = GetCPUCount(); - system("cd '$DataDir/wine-$Build' && set -x && ". - "time make -j$CPUCount ". join(" ", sort @BuildDirs)); - if ($? != 0) - { - LogMsg "The $Build Wine crossbuild failed\n"; - return !1; - } - - my $Success = 1; - foreach my $TestExe (@TestExes) - { - if (!-f "$DataDir/wine-$Build/$TestExe") - { - LogMsg "Make didn't produce the $Build $TestExe file\n"; - $Success = !1; - } - } - - return $Success; -} - - # # Setup and command line processing # @@ -233,9 +167,8 @@ if ($DataDir =~ /'/) my $Impacts = ApplyPatch("wine", $PatchFile);
if (!$Impacts or - ($Impacts->{PatchedRoot} and !BuildNative()) or - !BuildTestExecutables($TaskMissions, $Impacts, "exe32") or - !BuildTestExecutables($TaskMissions, $Impacts, "exe64")) + !BuildWine($TaskMissions, "no-rm", "exe32", undef, "buildtests") or + !BuildWine($TaskMissions, "no-rm", "exe64", undef, "buildtests")) { exit(1); } diff --git a/testbot/bin/build/Reconfig.pl b/testbot/bin/build/Reconfig.pl index 62644e1..dd403ef 100755 --- a/testbot/bin/build/Reconfig.pl +++ b/testbot/bin/build/Reconfig.pl @@ -51,60 +51,15 @@ use WineTestBot::Missions; # Build helpers #
-sub BuildNative($) -{ - my ($NoRm) = @_; - - rmtree "$DataDir/wine-native" if (!$NoRm); - mkdir "$DataDir/wine-native" if (!-d "$DataDir/wine-native"); - - # Rebuild from scratch to make sure cruft will not accumulate - InfoMsg "\nRebuilding native tools\n"; - my $CPUCount = GetCPUCount(); - system("cd '$DataDir/wine-native' && set -x && ". - "time ../wine/configure --enable-win64 --without-x --without-freetype --disable-winetest && ". - "time make -j$CPUCount __tooldeps__"); - - if ($? != 0) - { - LogMsg "The Wine native tools build failed\n"; - return !1; - } - - return 1; -} - -sub BuildCross($$$) -{ - my ($TaskMissions, $NoRm, $Build) = @_; - - return 1 if (!$TaskMissions->{Builds}->{$Build}); - rmtree "$DataDir/wine-$Build" if (!$NoRm); - mkdir "$DataDir/wine-$Build" if (!-d "$DataDir/wine-$Build"); - - # Rebuild from scratch to make sure cruft will not accumulate - InfoMsg "\nRebuilding the $Build Wine test executables\n"; - my $CPUCount = GetCPUCount(); - my $Host = ($Build eq "exe64" ? "x86_64-w64-mingw32" : "i686-w64-mingw32"); - system("cd '$DataDir/wine-$Build' && set -x && ". - "time ../wine/configure --host=$Host --with-wine-tools=../wine-native --without-x --without-freetype --disable-winetest && ". - "time make -j$CPUCount buildtests"); - if ($? != 0) - { - LogMsg "The $Build Wine crossbuild failed\n"; - return !1; - } - - return 1; -} - sub UpdateWineBuilds($$) { my ($TaskMissions, $NoRm) = @_;
- return BuildNative($NoRm) && - BuildCross($TaskMissions, $NoRm, "exe32") && - BuildCross($TaskMissions, $NoRm, "exe64"); + my $Configure = "--without-x --without-freetype --disable-winetest"; + return BuildWine($TaskMissions, $NoRm, "exe32", + $Configure, "buildtests") && + BuildWine($TaskMissions, $NoRm, "exe64", + "$Configure --enable-win64", "buildtests"); }
diff --git a/testbot/bin/build/WineReconfig.pl b/testbot/bin/build/WineReconfig.pl index ad0d429..383c6bf 100755 --- a/testbot/bin/build/WineReconfig.pl +++ b/testbot/bin/build/WineReconfig.pl @@ -43,44 +43,21 @@ use File::Path; use Build::Utils; use WineTestBot::Config; use WineTestBot::Missions; +use WineTestBot::Utils qw(ShQuote);
# # Build helpers #
-sub BuildWine($$$$;$) -{ - my ($TaskMissions, $NoRm, $Build, $Extras, $WithWine) = @_; - - return 1 if (!$TaskMissions->{Builds}->{$Build}); - rmtree "$DataDir/wine-$Build" if (!$NoRm); - mkdir "$DataDir/wine-$Build" if (!-d "$DataDir/wine-$Build"); - - # If $NoRm is not set, rebuild from scratch to make sure cruft will not - # accumulate - InfoMsg "\nRebuilding the $Build Wine\n"; - my $CPUCount = GetCPUCount(); - $Extras .= " --with-wine64='$WithWine'" if (defined $WithWine); - system("cd '$DataDir/wine-$Build' && set -x && ". - "time ../wine/configure $Extras && ". - "time make -j$CPUCount"); - if ($? != 0) - { - LogMsg "The $Build Wine build failed\n"; - return !1; - } - - return 1; -} - sub UpdateWineBuilds($$) { my ($TaskMissions, $NoRm) = @_;
return BuildWine($TaskMissions, $NoRm, "win32", "") && BuildWine($TaskMissions, $NoRm, "wow64", "--enable-win64") && - BuildWine($TaskMissions, $NoRm, "wow32", "", "$DataDir/wine-wow64"); + BuildWine($TaskMissions, $NoRm, "wow32", "--with-wine64=". + ShQuote("$DataDir/wine-wow64")); }
diff --git a/testbot/bin/build/WineTest.pl b/testbot/bin/build/WineTest.pl index 1afe9b8..1a75076 100755 --- a/testbot/bin/build/WineTest.pl +++ b/testbot/bin/build/WineTest.pl @@ -47,30 +47,6 @@ use WineTestBot::Missions; use WineTestBot::Utils;
-# -# Build helpers -# - -sub BuildWine($$) -{ - my ($TaskMissions, $Build) = @_; - - return 1 if (!$TaskMissions->{Builds}->{$Build}); - - InfoMsg "\nRebuilding the $Build Wine\n"; - my $CPUCount = GetCPUCount(); - system("cd '$DataDir/wine-$Build' && set -x && ". - "time make -j$CPUCount"); - if ($? != 0) - { - LogMsg "The $Build build failed\n"; - return !1; - } - - return 1; -} - - # # Test helpers # @@ -447,9 +423,9 @@ if ($Action eq "testpatch") { $Impacts = ApplyPatch("wine", "$DataDir/staging/$FileName"); exit(1) if (!$Impacts or - !BuildWine($TaskMissions, "win32") or - !BuildWine($TaskMissions, "wow64") or - !BuildWine($TaskMissions, "wow32")); + !BuildWine($TaskMissions, "no-rm", "win32", undef) or + !BuildWine($TaskMissions, "no-rm", "wow64", undef) or + !BuildWine($TaskMissions, "no-rm", "wow32", undef)); } foreach my $Mission (@{$TaskMissions->{Missions}}) { diff --git a/testbot/lib/Build/Utils.pm b/testbot/lib/Build/Utils.pm index 8a6982c..3050be1 100644 --- a/testbot/lib/Build/Utils.pm +++ b/testbot/lib/Build/Utils.pm @@ -29,7 +29,7 @@ use Exporter 'import'; our @EXPORT = qw(GetToolName InfoMsg LogMsg Error GitPull ApplyPatch GetCPUCount BuildNativeTestAgentd BuildWindowsTestAgentd - GetTestLauncher BuildTestLauncher UpdateAddOns + GetTestLauncher BuildTestLauncher BuildWine UpdateAddOns SetupWineEnvironment GetWineDir GetTestDir RunWine CreateWinePrefix);
@@ -317,6 +317,30 @@ sub BuildTestLauncher() return 1; }
+sub BuildWine($$$$;$) +{ + my ($TaskMissions, $NoRm, $Build, $Configure, $Targets) = @_; + $Targets ||= ""; + + return 1 if (!$TaskMissions->{Builds}->{$Build}); + # Rebuild from scratch to make sure cruft will not accumulate + rmtree "$DataDir/wine-$Build" if (!$NoRm); + mkdir "$DataDir/wine-$Build" if (!-d "$DataDir/wine-$Build"); + + InfoMsg "\nRebuilding the $Build Wine\n"; + my $CPUCount = GetCPUCount(); + system("cd '$DataDir/wine-$Build' && set -x && ". + (defined $Configure ? "time ../wine/configure $Configure && " : ""). + "time make -j$CPUCount $Targets"); + if ($? != 0) + { + LogMsg "The $Build Wine build failed\n"; + return !1; + } + + return 1; +} +
# # Wine addons updates