aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/buildsystems/Generators.pm42
-rw-r--r--contrib/buildsystems/Generators/QMake.pm189
-rw-r--r--contrib/buildsystems/Generators/Vcproj.pm579
-rw-r--r--contrib/buildsystems/Generators/Vcxproj.pm402
-rwxr-xr-xcontrib/buildsystems/engine.pl395
-rwxr-xr-xcontrib/buildsystems/generate29
-rwxr-xr-xcontrib/buildsystems/parse.pl228
-rw-r--r--contrib/coccinelle/meson.build38
-rw-r--r--contrib/completion/git-completion.bash49
-rw-r--r--contrib/completion/meson.build18
-rw-r--r--contrib/credential/netrc/meson.build22
-rw-r--r--contrib/subtree/README2
-rw-r--r--contrib/subtree/git-subtree.adoc19
-rwxr-xr-xcontrib/subtree/git-subtree.sh66
-rw-r--r--contrib/subtree/meson.build20
-rwxr-xr-xcontrib/subtree/t/t7900-subtree.sh113
16 files changed, 256 insertions, 1955 deletions
diff --git a/contrib/buildsystems/Generators.pm b/contrib/buildsystems/Generators.pm
deleted file mode 100644
index aa4cbaa2ad..0000000000
--- a/contrib/buildsystems/Generators.pm
+++ /dev/null
@@ -1,42 +0,0 @@
-package Generators;
-require Exporter;
-
-use strict;
-use File::Basename;
-no strict 'refs';
-use vars qw($VERSION @AVAILABLE);
-
-our $VERSION = '1.00';
-our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);
-@ISA = qw(Exporter);
-
-BEGIN {
- local(*D);
- my $me = $INC{"Generators.pm"};
- die "Couldn't find myself in \@INC, which is required to load the generators!" if ("$me" eq "");
- $me = dirname($me);
- if (opendir(D,"$me/Generators")) {
- foreach my $gen (readdir(D)) {
- next unless ($gen =~ /\.pm$/);
- require "${me}/Generators/$gen";
- $gen =~ s,\.pm,,;
- push(@AVAILABLE, $gen);
- }
- closedir(D);
- my $gens = join(', ', @AVAILABLE);
- }
-
- push @EXPORT_OK, qw(available);
-}
-
-sub available {
- return @AVAILABLE;
-}
-
-sub generate {
- my ($gen, $git_dir, $out_dir, $rel_dir, %build_structure) = @_;
- return eval("Generators::${gen}::generate(\$git_dir, \$out_dir, \$rel_dir, \%build_structure)") if grep(/^$gen$/, @AVAILABLE);
- die "Generator \"${gen}\" is not available!\nAvailable generators are: @AVAILABLE\n";
-}
-
-1;
diff --git a/contrib/buildsystems/Generators/QMake.pm b/contrib/buildsystems/Generators/QMake.pm
deleted file mode 100644
index ff3b657e61..0000000000
--- a/contrib/buildsystems/Generators/QMake.pm
+++ /dev/null
@@ -1,189 +0,0 @@
-package Generators::QMake;
-require Exporter;
-
-use strict;
-use vars qw($VERSION);
-
-our $VERSION = '1.00';
-our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);
-@ISA = qw(Exporter);
-
-BEGIN {
- push @EXPORT_OK, qw(generate);
-}
-
-sub generate {
- my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
-
- my @libs = @{$build_structure{"LIBS"}};
- foreach (@libs) {
- createLibProject($_, $git_dir, $out_dir, $rel_dir, %build_structure);
- }
-
- my @apps = @{$build_structure{"APPS"}};
- foreach (@apps) {
- createAppProject($_, $git_dir, $out_dir, $rel_dir, %build_structure);
- }
-
- createGlueProject($git_dir, $out_dir, $rel_dir, %build_structure);
- return 0;
-}
-
-sub createLibProject {
- my ($libname, $git_dir, $out_dir, $rel_dir, %build_structure) = @_;
- print "Generate $libname lib project\n";
- $rel_dir = "../$rel_dir";
-
- my $sources = join(" \\\n\t", sort(map("$rel_dir/$_", @{$build_structure{"LIBS_${libname}_SOURCES"}})));
- my $defines = join(" \\\n\t", sort(@{$build_structure{"LIBS_${libname}_DEFINES"}}));
- my $includes= join(" \\\n\t", sort(map("$rel_dir/$_", @{$build_structure{"LIBS_${libname}_INCLUDES"}})));
- my $cflags = join(" ", sort(@{$build_structure{"LIBS_${libname}_CFLAGS"}}));
-
- my $cflags_debug = $cflags;
- $cflags_debug =~ s/-MT/-MTd/;
- $cflags_debug =~ s/-O.//;
-
- my $cflags_release = $cflags;
- $cflags_release =~ s/-MTd/-MT/;
-
- my @tmp = @{$build_structure{"LIBS_${libname}_LFLAGS"}};
- my @tmp2 = ();
- foreach (@tmp) {
- if (/^-LTCG/) {
- } elsif (/^-L/) {
- $_ =~ s/^-L/-LIBPATH:$rel_dir\//;
- }
- push(@tmp2, $_);
- }
- my $lflags = join(" ", sort(@tmp));
-
- my $target = $libname;
- $target =~ s/\//_/g;
- $defines =~ s/-D//g;
- $defines =~ s/"/\\\\"/g;
- $includes =~ s/-I//g;
- mkdir "$target" || die "Could not create the directory $target for lib project!\n";
- open F, ">$target/$target.pro" || die "Could not open $target/$target.pro for writing!\n";
- print F << "EOM";
-TEMPLATE = lib
-TARGET = $target
-DESTDIR = $rel_dir
-
-CONFIG -= qt
-CONFIG += static
-
-QMAKE_CFLAGS =
-QMAKE_CFLAGS_RELEASE = $cflags_release
-QMAKE_CFLAGS_DEBUG = $cflags_debug
-QMAKE_LIBFLAGS = $lflags
-
-DEFINES += \\
- $defines
-
-INCLUDEPATH += \\
- $includes
-
-SOURCES += \\
- $sources
-EOM
- close F;
-}
-
-sub createAppProject {
- my ($appname, $git_dir, $out_dir, $rel_dir, %build_structure) = @_;
- print "Generate $appname app project\n";
- $rel_dir = "../$rel_dir";
-
- my $sources = join(" \\\n\t", sort(map("$rel_dir/$_", @{$build_structure{"APPS_${appname}_SOURCES"}})));
- my $defines = join(" \\\n\t", sort(@{$build_structure{"APPS_${appname}_DEFINES"}}));
- my $includes= join(" \\\n\t", sort(map("$rel_dir/$_", @{$build_structure{"APPS_${appname}_INCLUDES"}})));
- my $cflags = join(" ", sort(@{$build_structure{"APPS_${appname}_CFLAGS"}}));
-
- my $cflags_debug = $cflags;
- $cflags_debug =~ s/-MT/-MTd/;
- $cflags_debug =~ s/-O.//;
-
- my $cflags_release = $cflags;
- $cflags_release =~ s/-MTd/-MT/;
-
- my $libs;
- foreach (sort(@{$build_structure{"APPS_${appname}_LIBS"}})) {
- $_ =~ s/\//_/g;
- $libs .= " $_";
- }
- my @tmp = @{$build_structure{"APPS_${appname}_LFLAGS"}};
- my @tmp2 = ();
- foreach (@tmp) {
- # next if ($_ eq "-NODEFAULTLIB:MSVCRT.lib");
- if (/^-LTCG/) {
- } elsif (/^-L/) {
- $_ =~ s/^-L/-LIBPATH:$rel_dir\//;
- }
- push(@tmp2, $_);
- }
- my $lflags = join(" ", sort(@tmp));
-
- my $target = $appname;
- $target =~ s/\.exe//;
- $target =~ s/\//_/g;
- $defines =~ s/-D//g;
- $defines =~ s/"/\\\\"/g;
- $includes =~ s/-I//g;
- mkdir "$target" || die "Could not create the directory $target for app project!\n";
- open F, ">$target/$target.pro" || die "Could not open $target/$target.pro for writing!\n";
- print F << "EOM";
-TEMPLATE = app
-TARGET = $target
-DESTDIR = $rel_dir
-
-CONFIG -= qt embed_manifest_exe
-CONFIG += console
-
-QMAKE_CFLAGS =
-QMAKE_CFLAGS_RELEASE = $cflags_release
-QMAKE_CFLAGS_DEBUG = $cflags_debug
-QMAKE_LFLAGS = $lflags
-LIBS = $libs
-
-DEFINES += \\
- $defines
-
-INCLUDEPATH += \\
- $includes
-
-win32:QMAKE_LFLAGS += -LIBPATH:$rel_dir
-else: QMAKE_LFLAGS += -L$rel_dir
-
-SOURCES += \\
- $sources
-EOM
- close F;
-}
-
-sub createGlueProject {
- my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
- my $libs = join(" \\ \n", map("\t$_|$_.pro", @{$build_structure{"LIBS"}}));
- my $apps = join(" \\ \n", map("\t$_|$_.pro", @{$build_structure{"APPS"}}));
- $libs =~ s/\.a//g;
- $libs =~ s/\//_/g;
- $libs =~ s/\|/\//g;
- $apps =~ s/\.exe//g;
- $apps =~ s/\//_/g;
- $apps =~ s/\|/\//g;
-
- my $filename = $out_dir;
- $filename =~ s/.*\/([^\/]+)$/$1/;
- $filename =~ s/\/$//;
- print "Generate glue project $filename.pro\n";
- open F, ">$filename.pro" || die "Could not open $filename.pro for writing!\n";
- print F << "EOM";
-TEMPLATE = subdirs
-CONFIG += ordered
-SUBDIRS += \\
-$libs \\
-$apps
-EOM
- close F;
-}
-
-1;
diff --git a/contrib/buildsystems/Generators/Vcproj.pm b/contrib/buildsystems/Generators/Vcproj.pm
deleted file mode 100644
index 737647e76a..0000000000
--- a/contrib/buildsystems/Generators/Vcproj.pm
+++ /dev/null
@@ -1,579 +0,0 @@
-package Generators::Vcproj;
-require Exporter;
-
-use strict;
-use vars qw($VERSION);
-use Digest::SHA qw(sha256_hex);
-
-our $VERSION = '1.00';
-our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);
-@ISA = qw(Exporter);
-
-BEGIN {
- push @EXPORT_OK, qw(generate);
-}
-
-sub generate_guid ($) {
- my $hex = sha256_hex($_[0]);
- $hex =~ s/^(.{8})(.{4})(.{4})(.{4})(.{12}).*/{$1-$2-$3-$4-$5}/;
- $hex =~ tr/a-z/A-Z/;
- return $hex;
-}
-
-sub generate {
- my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
- my @libs = @{$build_structure{"LIBS"}};
- foreach (@libs) {
- createLibProject($_, $git_dir, $out_dir, $rel_dir, \%build_structure);
- }
-
- my @apps = @{$build_structure{"APPS"}};
- foreach (@apps) {
- createAppProject($_, $git_dir, $out_dir, $rel_dir, \%build_structure);
- }
-
- createGlueProject($git_dir, $out_dir, $rel_dir, %build_structure);
- return 0;
-}
-
-sub createLibProject {
- my ($libname, $git_dir, $out_dir, $rel_dir, $build_structure) = @_;
- print "Generate $libname vcproj lib project\n";
- $rel_dir = "..\\$rel_dir";
- $rel_dir =~ s/\//\\/g;
-
- my $target = $libname;
- $target =~ s/\//_/g;
- $target =~ s/\.a//;
-
- my $uuid = generate_guid($libname);
- $$build_structure{"LIBS_${target}_GUID"} = $uuid;
-
- my @srcs = sort(map("$rel_dir\\$_", @{$$build_structure{"LIBS_${libname}_SOURCES"}}));
- my @sources;
- foreach (@srcs) {
- $_ =~ s/\//\\/g;
- push(@sources, $_);
- }
- my $defines = join(",", sort(@{$$build_structure{"LIBS_${libname}_DEFINES"}}));
- my $includes= join(";", sort(map("&quot;$rel_dir\\$_&quot;", @{$$build_structure{"LIBS_${libname}_INCLUDES"}})));
- my $cflags = join(" ", sort(@{$$build_structure{"LIBS_${libname}_CFLAGS"}}));
- $cflags =~ s/\"/&quot;/g;
- $cflags =~ s/</&lt;/g;
- $cflags =~ s/>/&gt;/g;
-
- my $cflags_debug = $cflags;
- $cflags_debug =~ s/-MT/-MTd/;
- $cflags_debug =~ s/-O.//;
-
- my $cflags_release = $cflags;
- $cflags_release =~ s/-MTd/-MT/;
-
- my @tmp = @{$$build_structure{"LIBS_${libname}_LFLAGS"}};
- my @tmp2 = ();
- foreach (@tmp) {
- if (/^-LTCG/) {
- } elsif (/^-L/) {
- $_ =~ s/^-L/-LIBPATH:$rel_dir\//;
- }
- push(@tmp2, $_);
- }
- my $lflags = join(" ", sort(@tmp));
-
- $defines =~ s/-D//g;
- $defines =~ s/\"/\\&quot;/g;
- $defines =~ s/</&lt;/g;
- $defines =~ s/>/&gt;/g;
- $defines =~ s/\'//g;
- $includes =~ s/-I//g;
- mkdir "$target" || die "Could not create the directory $target for lib project!\n";
- open F, ">$target/$target.vcproj" || die "Could not open $target/$target.pro for writing!\n";
- binmode F, ":crlf";
- print F << "EOM";
-<?xml version="1.0" encoding = "Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9,00"
- Name="$target"
- ProjectGUID="$uuid">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$rel_dir"
- ConfigurationType="4"
- CharacterSet="0"
- IntermediateDirectory="\$(ProjectDir)\$(ConfigurationName)"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalOptions="$cflags_debug"
- Optimization="0"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="$includes"
- PreprocessorDefinitions="WIN32,_DEBUG,$defines"
- MinimalRebuild="true"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- ProgramDataBaseFileName="\$(IntDir)\\\$(TargetName).pdb"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$rel_dir"
- ConfigurationType="4"
- CharacterSet="0"
- WholeProgramOptimization="1"
- IntermediateDirectory="\$(ProjectDir)\$(ConfigurationName)"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalOptions="$cflags_release"
- Optimization="2"
- InlineFunctionExpansion="1"
- EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="$includes"
- PreprocessorDefinitions="WIN32,NDEBUG,$defines"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- ProgramDataBaseFileName="\$(IntDir)\\\$(TargetName).pdb"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-EOM
- foreach(@sources) {
- print F << "EOM";
- <File
- RelativePath="$_"/>
-EOM
- }
- print F << "EOM";
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
-EOM
- close F;
-}
-
-sub createAppProject {
- my ($appname, $git_dir, $out_dir, $rel_dir, $build_structure) = @_;
- print "Generate $appname vcproj app project\n";
- $rel_dir = "..\\$rel_dir";
- $rel_dir =~ s/\//\\/g;
-
- my $target = $appname;
- $target =~ s/\//_/g;
- $target =~ s/\.exe//;
-
- my $uuid = generate_guid($appname);
- $$build_structure{"APPS_${target}_GUID"} = $uuid;
-
- my @srcs = sort(map("$rel_dir\\$_", @{$$build_structure{"APPS_${appname}_SOURCES"}}));
- my @sources;
- foreach (@srcs) {
- $_ =~ s/\//\\/g;
- push(@sources, $_);
- }
- my $defines = join(",", sort(@{$$build_structure{"APPS_${appname}_DEFINES"}}));
- my $includes= join(";", sort(map("&quot;$rel_dir\\$_&quot;", @{$$build_structure{"APPS_${appname}_INCLUDES"}})));
- my $cflags = join(" ", sort(@{$$build_structure{"APPS_${appname}_CFLAGS"}}));
- $cflags =~ s/\"/&quot;/g;
- $cflags =~ s/</&lt;/g;
- $cflags =~ s/>/&gt;/g;
-
- my $cflags_debug = $cflags;
- $cflags_debug =~ s/-MT/-MTd/;
- $cflags_debug =~ s/-O.//;
-
- my $cflags_release = $cflags;
- $cflags_release =~ s/-MTd/-MT/;
-
- my $libs;
- foreach (sort(@{$$build_structure{"APPS_${appname}_LIBS"}})) {
- $_ =~ s/\//_/g;
- $libs .= " $_";
- }
- my @tmp = @{$$build_structure{"APPS_${appname}_LFLAGS"}};
- my @tmp2 = ();
- foreach (@tmp) {
- if (/^-LTCG/) {
- } elsif (/^-L/) {
- $_ =~ s/^-L/-LIBPATH:$rel_dir\//;
- }
- push(@tmp2, $_);
- }
- my $lflags = join(" ", sort(@tmp)) . " -LIBPATH:$rel_dir";
-
- $defines =~ s/-D//g;
- $defines =~ s/\"/\\&quot;/g;
- $defines =~ s/</&lt;/g;
- $defines =~ s/>/&gt;/g;
- $defines =~ s/\'//g;
- $defines =~ s/\\\\/\\/g;
- $includes =~ s/-I//g;
- mkdir "$target" || die "Could not create the directory $target for lib project!\n";
- open F, ">$target/$target.vcproj" || die "Could not open $target/$target.pro for writing!\n";
- binmode F, ":crlf";
- print F << "EOM";
-<?xml version="1.0" encoding = "Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9,00"
- Name="$target"
- ProjectGUID="$uuid">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$rel_dir"
- ConfigurationType="1"
- CharacterSet="0"
- IntermediateDirectory="\$(ProjectDir)\$(ConfigurationName)"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalOptions="$cflags_debug"
- Optimization="0"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="$includes"
- PreprocessorDefinitions="WIN32,_DEBUG,$defines"
- MinimalRebuild="true"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- ProgramDataBaseFileName="\$(IntDir)\\\$(TargetName).pdb"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$libs"
- AdditionalOptions="$lflags"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$rel_dir"
- ConfigurationType="1"
- CharacterSet="0"
- WholeProgramOptimization="1"
- IntermediateDirectory="\$(ProjectDir)\$(ConfigurationName)"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalOptions="$cflags_release"
- Optimization="2"
- InlineFunctionExpansion="1"
- EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="$includes"
- PreprocessorDefinitions="WIN32,NDEBUG,$defines"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- ProgramDataBaseFileName="\$(IntDir)\\\$(TargetName).pdb"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$libs"
- AdditionalOptions="$lflags"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-EOM
- foreach(@sources) {
- print F << "EOM";
- <File
- RelativePath="$_"/>
-EOM
- }
- print F << "EOM";
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
-EOM
- close F;
-}
-
-sub createGlueProject {
- my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
- print "Generate solutions file\n";
- $rel_dir = "..\\$rel_dir";
- $rel_dir =~ s/\//\\/g;
- my $SLN_HEAD = "Microsoft Visual Studio Solution File, Format Version 10.00\n# Visual Studio 2008\n";
- my $SLN_PRE = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = ";
- my $SLN_POST = "\nEndProject\n";
-
- my @libs = @{$build_structure{"LIBS"}};
- my @tmp;
- foreach (@libs) {
- $_ =~ s/\//_/g;
- $_ =~ s/\.a//;
- push(@tmp, $_);
- }
- @libs = @tmp;
-
- my @apps = @{$build_structure{"APPS"}};
- @tmp = ();
- foreach (@apps) {
- $_ =~ s/\//_/g;
- $_ =~ s/\.exe//;
- if ($_ eq "git" ) {
- unshift(@tmp, $_);
- } else {
- push(@tmp, $_);
- }
- }
- @apps = @tmp;
-
- open F, ">git.sln" || die "Could not open git.sln for writing!\n";
- binmode F, ":crlf";
- print F "$SLN_HEAD";
-
- my $uuid_libgit = $build_structure{"LIBS_libgit_GUID"};
- my $uuid_xdiff_lib = $build_structure{"LIBS_xdiff_lib_GUID"};
- foreach (@apps) {
- my $appname = $_;
- my $uuid = $build_structure{"APPS_${appname}_GUID"};
- print F "$SLN_PRE";
- print F "\"${appname}\", \"${appname}\\${appname}.vcproj\", \"${uuid}\"\n";
- print F " ProjectSection(ProjectDependencies) = postProject\n";
- print F " ${uuid_libgit} = ${uuid_libgit}\n";
- print F " ${uuid_xdiff_lib} = ${uuid_xdiff_lib}\n";
- print F " EndProjectSection";
- print F "$SLN_POST";
- }
- foreach (@libs) {
- my $libname = $_;
- my $uuid = $build_structure{"LIBS_${libname}_GUID"};
- print F "$SLN_PRE";
- print F "\"${libname}\", \"${libname}\\${libname}.vcproj\", \"${uuid}\"";
- print F "$SLN_POST";
- }
-
- print F << "EOM";
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
-EOM
- print F << "EOM";
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
-EOM
- foreach (@apps) {
- my $appname = $_;
- my $uuid = $build_structure{"APPS_${appname}_GUID"};
- print F "\t\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\n";
- print F "\t\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\n";
- print F "\t\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\n";
- print F "\t\t${uuid}.Release|Win32.Build.0 = Release|Win32\n";
- }
- foreach (@libs) {
- my $libname = $_;
- my $uuid = $build_structure{"LIBS_${libname}_GUID"};
- print F "\t\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\n";
- print F "\t\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\n";
- print F "\t\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\n";
- print F "\t\t${uuid}.Release|Win32.Build.0 = Release|Win32\n";
- }
-
- print F << "EOM";
- EndGlobalSection
-EndGlobal
-EOM
- close F;
-}
-
-1;
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
deleted file mode 100644
index b2e68a1671..0000000000
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ /dev/null
@@ -1,402 +0,0 @@
-package Generators::Vcxproj;
-require Exporter;
-
-use strict;
-use vars qw($VERSION);
-use Digest::SHA qw(sha256_hex);
-
-our $VERSION = '1.00';
-our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);
-@ISA = qw(Exporter);
-
-BEGIN {
- push @EXPORT_OK, qw(generate);
-}
-
-sub generate_guid ($) {
- my $hex = sha256_hex($_[0]);
- $hex =~ s/^(.{8})(.{4})(.{4})(.{4})(.{12}).*/{$1-$2-$3-$4-$5}/;
- $hex =~ tr/a-z/A-Z/;
- return $hex;
-}
-
-sub generate {
- my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
- my @libs = @{$build_structure{"LIBS"}};
- foreach (@libs) {
- createProject($_, $git_dir, $out_dir, $rel_dir, \%build_structure, 1);
- }
-
- my @apps = @{$build_structure{"APPS"}};
- foreach (@apps) {
- createProject($_, $git_dir, $out_dir, $rel_dir, \%build_structure, 0);
- }
-
- createGlueProject($git_dir, $out_dir, $rel_dir, %build_structure);
- return 0;
-}
-
-sub createProject {
- my ($name, $git_dir, $out_dir, $rel_dir, $build_structure, $static_library) = @_;
- my $label = $static_library ? "lib" : "app";
- my $prefix = $static_library ? "LIBS_" : "APPS_";
- my $config_type = $static_library ? "StaticLibrary" : "Application";
- print "Generate $name vcxproj $label project\n";
- my $cdup = $name;
- $cdup =~ s/[^\/]+/../g;
- $cdup =~ s/\//\\/g;
- $rel_dir = $rel_dir eq "." ? $cdup : "$cdup\\$rel_dir";
- $rel_dir =~ s/\//\\/g;
-
- my $target = $name;
- if ($static_library) {
- $target =~ s/\.a//;
- } else {
- $target =~ s/\.exe//;
- }
-
- my $uuid = generate_guid($name);
- $$build_structure{"$prefix${target}_GUID"} = $uuid;
- my $vcxproj = $target;
- $vcxproj =~ s/(.*\/)?(.*)/$&\/$2.vcxproj/;
- $vcxproj =~ s/([^\/]*)(\/lib)\/(lib.vcxproj)/$1$2\/$1_$3/;
- $$build_structure{"$prefix${target}_VCXPROJ"} = $vcxproj;
-
- my @srcs = sort(map("$rel_dir\\$_", @{$$build_structure{"$prefix${name}_SOURCES"}}));
- my @sources;
- foreach (@srcs) {
- $_ =~ s/\//\\/g;
- push(@sources, $_);
- }
- my $defines = join(";", sort(@{$$build_structure{"$prefix${name}_DEFINES"}}));
- my $includes= join(";", sort(map { s/^-I//; s/\//\\/g; File::Spec->file_name_is_absolute($_) ? $_ : "$rel_dir\\$_" } @{$$build_structure{"$prefix${name}_INCLUDES"}}));
- my $cflags = join(" ", sort(map { s/^-[GLMOWZ].*//; s/.* .*/"$&"/; $_; } @{$$build_structure{"$prefix${name}_CFLAGS"}}));
- $cflags =~ s/</&lt;/g;
- $cflags =~ s/>/&gt;/g;
-
- my $libs_release = "\n ";
- my $libs_debug = "\n ";
- if (!$static_library && $name ne 'headless-git') {
- $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
- $libs_debug = $libs_release;
- $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
- $libs_debug =~ s/libexpat\.lib/libexpatd\.lib/g;
- $libs_debug =~ s/libcurl\.lib/libcurl-d\.lib/g;
- }
-
- $defines =~ s/-D//g;
- $defines =~ s/</&lt;/g;
- $defines =~ s/>/&gt;/g;
- $defines =~ s/\'//g;
-
- die "Could not create the directory $target for $label project!\n" unless (-d "$target" || mkdir "$target");
-
- open F, ">$vcxproj" or die "Could not open $vcxproj for writing!\n";
- binmode F, ":crlf :utf8";
- print F chr(0xFEFF);
- print F << "EOM";
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>$uuid</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <VCPKGArch Condition="'\$(Platform)'=='Win32'">x86-windows</VCPKGArch>
- <VCPKGArch Condition="'\$(Platform)'!='Win32'">x64-windows</VCPKGArch>
- <VCPKGArchDirectory>$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)</VCPKGArchDirectory>
- <VCPKGBinDirectory Condition="'\$(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\bin</VCPKGBinDirectory>
- <VCPKGLibDirectory Condition="'\$(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\lib</VCPKGLibDirectory>
- <VCPKGBinDirectory Condition="'\$(Configuration)'!='Debug'">\$(VCPKGArchDirectory)\\bin</VCPKGBinDirectory>
- <VCPKGLibDirectory Condition="'\$(Configuration)'!='Debug'">\$(VCPKGArchDirectory)\\lib</VCPKGLibDirectory>
- <VCPKGIncludeDirectory>\$(VCPKGArchDirectory)\\include</VCPKGIncludeDirectory>
- <VCPKGLibs Condition="'\$(Configuration)'=='Debug'">$libs_debug</VCPKGLibs>
- <VCPKGLibs Condition="'\$(Configuration)'!='Debug'">$libs_release</VCPKGLibs>
- </PropertyGroup>
- <Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'\$(Configuration)'=='Debug'" Label="Configuration">
- <UseDebugLibraries>true</UseDebugLibraries>
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'\$(Configuration)'=='Release'" Label="Configuration">
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup>
- <ConfigurationType>$config_type</ConfigurationType>
- <PlatformToolset>v140</PlatformToolset>
- <!-- <CharacterSet>UTF-8</CharacterSet> -->
- <OutDir>..\\</OutDir>
- <!-- <IntDir>\$(ProjectDir)\$(Configuration)\\</IntDir> -->
- </PropertyGroup>
- <Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="Shared">
- </ImportGroup>
- <ImportGroup Label="PropertySheets">
- <Import Project="\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props" Condition="exists('\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <GenerateManifest>false</GenerateManifest>
- <EnableManagedIncrementalBuild>true</EnableManagedIncrementalBuild>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalOptions>$cflags %(AdditionalOptions)</AdditionalOptions>
- <AdditionalIncludeDirectories>$cdup;$cdup\\compat;$cdup\\compat\\regex;$cdup\\compat\\win32;$cdup\\compat\\poll;$cdup\\compat\\vcbuild\\include;\$(VCPKGIncludeDirectory);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <EnableParallelCodeGeneration />
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <PrecompiledHeader />
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Lib>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- </Lib>
- <Link>
- <AdditionalLibraryDirectories>\$(VCPKGLibDirectory);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <AdditionalDependencies>\$(VCPKGLibs);\$(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalOptions>invalidcontinue.obj %(AdditionalOptions)</AdditionalOptions>
- <EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
- <ManifestFile>$cdup\\compat\\win32\\git.manifest</ManifestFile>
- <SubSystem>Console</SubSystem>
- </Link>
-EOM
- if ($target eq 'libgit') {
- print F << "EOM";
- <PreBuildEvent Condition="!Exists('$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)\\include\\openssl\\ssl.h')">
- <Message>Initialize VCPKG</Message>
- <Command>del "$cdup\\compat\\vcbuild\\vcpkg"</Command>
- <Command>call "$cdup\\compat\\vcbuild\\vcpkg_install.bat"</Command>
- </PreBuildEvent>
-EOM
- }
- print F << "EOM";
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'\$(Platform)'=='Win32'">
- <Link>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'\$(Configuration)'=='Debug'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;$defines;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'\$(Configuration)'=='Release'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;$defines;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
-EOM
- foreach(@sources) {
- print F << "EOM";
- <ClCompile Include="$_" />
-EOM
- }
- print F << "EOM";
- </ItemGroup>
-EOM
- if ((!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') && !($name =~ /headless-git/)) {
- my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
- my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
- my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
-
- print F << "EOM";
- <ItemGroup>
- <ProjectReference Include="$cdup\\libgit\\libgit.vcxproj">
- <Project>$uuid_libgit</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
-EOM
- if (!($name =~ /xdiff|libreftable/)) {
- print F << "EOM";
- <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
- <Project>$uuid_libreftable</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
-EOM
- }
- if (!($name =~ 'xdiff')) {
- print F << "EOM";
- <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
- <Project>$uuid_xdiff_lib</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
-EOM
- }
- if ($name =~ /(test-(line-buffer|svn-fe)|^git-remote-testsvn)\.exe$/) {
- my $uuid_vcs_svn_lib = $$build_structure{"LIBS_vcs-svn/lib_GUID"};
- print F << "EOM";
- <ProjectReference Include="$cdup\\vcs-svn\\lib\\vcs-svn_lib.vcxproj">
- <Project>$uuid_vcs_svn_lib</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
-EOM
- }
- print F << "EOM";
- </ItemGroup>
-EOM
- }
- print F << "EOM";
- <Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.targets" />
-EOM
- if (!$static_library) {
- print F << "EOM";
- <Target Name="${target}_AfterBuild" AfterTargets="AfterBuild">
- <ItemGroup>
- <DLLsAndPDBs Include="\$(VCPKGBinDirectory)\\*.dll;\$(VCPKGBinDirectory)\\*.pdb" />
- </ItemGroup>
- <Copy SourceFiles="@(DLLsAndPDBs)" DestinationFolder="\$(OutDir)" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />
- <MakeDir Directories="..\\templates\\blt\\branches" />
- </Target>
-EOM
- }
- if ($target eq 'git') {
- print F " <Import Project=\"LinkOrCopyBuiltins.targets\" />\n";
- }
- if ($target eq 'git-remote-http') {
- print F " <Import Project=\"LinkOrCopyRemoteHttp.targets\" />\n";
- }
- print F << "EOM";
-</Project>
-EOM
- close F;
-}
-
-sub createGlueProject {
- my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
- print "Generate solutions file\n";
- $rel_dir = "..\\$rel_dir";
- $rel_dir =~ s/\//\\/g;
- my $SLN_HEAD = "Microsoft Visual Studio Solution File, Format Version 11.00\n# Visual Studio 2010\n";
- my $SLN_PRE = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = ";
- my $SLN_POST = "\nEndProject\n";
-
- my @libs = @{$build_structure{"LIBS"}};
- my @tmp;
- foreach (@libs) {
- $_ =~ s/\.a//;
- push(@tmp, $_);
- }
- @libs = @tmp;
-
- my @apps = @{$build_structure{"APPS"}};
- @tmp = ();
- foreach (@apps) {
- $_ =~ s/\.exe//;
- if ($_ eq "git" ) {
- unshift(@tmp, $_);
- } else {
- push(@tmp, $_);
- }
- }
- @apps = @tmp;
-
- open F, ">git.sln" || die "Could not open git.sln for writing!\n";
- binmode F, ":crlf :utf8";
- print F chr(0xFEFF);
- print F "$SLN_HEAD";
-
- foreach (@apps) {
- my $appname = $_;
- my $uuid = $build_structure{"APPS_${appname}_GUID"};
- print F "$SLN_PRE";
- my $vcxproj = $build_structure{"APPS_${appname}_VCXPROJ"};
- $vcxproj =~ s/\//\\/g;
- $appname =~ s/.*\///;
- print F "\"${appname}\", \"${vcxproj}\", \"${uuid}\"";
- print F "$SLN_POST";
- }
- foreach (@libs) {
- my $libname = $_;
- my $uuid = $build_structure{"LIBS_${libname}_GUID"};
- print F "$SLN_PRE";
- my $vcxproj = $build_structure{"LIBS_${libname}_VCXPROJ"};
- $vcxproj =~ s/\//\\/g;
- $libname =~ s/\//_/g;
- print F "\"${libname}\", \"${vcxproj}\", \"${uuid}\"";
- print F "$SLN_POST";
- }
-
- print F << "EOM";
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
-EOM
- print F << "EOM";
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
-EOM
- foreach (@apps) {
- my $appname = $_;
- my $uuid = $build_structure{"APPS_${appname}_GUID"};
- print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
- print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
- print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
- print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
- print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
- print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
- print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
- print F "\t\t${uuid}.Release|x86.Build.0 = Release|Win32\n";
- }
- foreach (@libs) {
- my $libname = $_;
- my $uuid = $build_structure{"LIBS_${libname}_GUID"};
- print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
- print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
- print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
- print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
- print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
- print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
- print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
- print F "\t\t${uuid}.Release|x86.Build.0 = Release|Win32\n";
- }
-
- print F << "EOM";
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
-EOM
- close F;
-}
-
-1;
diff --git a/contrib/buildsystems/engine.pl b/contrib/buildsystems/engine.pl
deleted file mode 100755
index 069be7e4be..0000000000
--- a/contrib/buildsystems/engine.pl
+++ /dev/null
@@ -1,395 +0,0 @@
-#!/usr/bin/perl -w
-######################################################################
-# Do not call this script directly!
-#
-# The generate script ensures that @INC is correct before the engine
-# is executed.
-#
-# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>
-######################################################################
-use strict;
-use File::Basename;
-use File::Spec;
-use Cwd;
-use Generators;
-use Text::ParseWords;
-
-my (%build_structure, %compile_options, @makedry);
-my $out_dir = getcwd();
-my $git_dir = $out_dir;
-$git_dir =~ s=\\=/=g;
-$git_dir = dirname($git_dir) while (!-e "$git_dir/git.c" && "$git_dir" ne "");
-die "Couldn't find Git repo" if ("$git_dir" eq "");
-
-my @gens = Generators::available();
-my $gen = "Vcproj";
-
-sub showUsage
-{
- my $genlist = join(', ', @gens);
- print << "EOM";
-generate usage:
- -g <GENERATOR> --gen <GENERATOR> Specify the buildsystem generator (default: $gen)
- Available: $genlist
- -o <PATH> --out <PATH> Specify output directory generation (default: .)
- --make-out <PATH> Write the output of GNU Make into a file
- -i <FILE> --in <FILE> Specify input file, instead of running GNU Make
- -h,-? --help This help
-EOM
- exit 0;
-}
-
-# Parse command-line options
-my $make_out;
-while (@ARGV) {
- my $arg = shift @ARGV;
- if ("$arg" eq "-h" || "$arg" eq "--help" || "$arg" eq "-?") {
- showUsage();
- exit(0);
- } elsif("$arg" eq "--out" || "$arg" eq "-o") {
- $out_dir = shift @ARGV;
- } elsif("$arg" eq "--make-out") {
- $make_out = shift @ARGV;
- } elsif("$arg" eq "--gen" || "$arg" eq "-g") {
- $gen = shift @ARGV;
- } elsif("$arg" eq "--in" || "$arg" eq "-i") {
- my $infile = shift @ARGV;
- open(F, "<$infile") || die "Couldn't open file $infile";
- @makedry = <F>;
- close(F);
- } else {
- die "Unknown option: " . $arg;
- }
-}
-
-# NOT using File::Spec->rel2abs($path, $base) here, as
-# it fails badly for me in the msysgit environment
-$git_dir = File::Spec->rel2abs($git_dir);
-$out_dir = File::Spec->rel2abs($out_dir);
-my $rel_dir = makeOutRel2Git($git_dir, $out_dir);
-
-# Print some information so the user feels informed
-print << "EOM";
------
-Generator: $gen
-Git dir: $git_dir
-Out dir: $out_dir
------
-Running GNU Make to figure out build structure...
-EOM
-
-# Pipe a make --dry-run into a variable, if not already loaded from file
-# Capture the make dry stderr to file for review (will be empty for a release build).
-
-my $ErrsFile = "msvc-build-makedryerrors.txt";
-@makedry = `make -C $git_dir -n MSVC=1 SKIP_VCPKG=1 V=1 2>$ErrsFile`
-if !@makedry;
-# test for an empty Errors file and remove it
-unlink $ErrsFile if -f -z $ErrsFile;
-
-if (defined $make_out) {
- open OUT, ">" . $make_out;
- print OUT @makedry;
- close OUT;
-}
-
-# Parse the make output into usable info
-parseMakeOutput();
-
-# Finally, ask the generator to start generating..
-Generators::generate($gen, $git_dir, $out_dir, $rel_dir, %build_structure);
-
-# main flow ends here
-# -------------------------------------------------------------------------------------------------
-
-
-# 1) path: /foo/bar/baz 2) path: /foo/bar/baz 3) path: /foo/bar/baz
-# base: /foo/bar/baz/temp base: /foo/bar base: /tmp
-# rel: .. rel: baz rel: ../foo/bar/baz
-sub makeOutRel2Git
-{
- my ($path, $base) = @_;
- my $rel;
- if ("$path" eq "$base") {
- return ".";
- } elsif ($base =~ /^$path/) {
- # case 1
- my $tmp = $base;
- $tmp =~ s/^$path//;
- foreach (split('/', $tmp)) {
- $rel .= "../" if ("$_" ne "");
- }
- } elsif ($path =~ /^$base/) {
- # case 2
- $rel = $path;
- $rel =~ s/^$base//;
- $rel = "./$rel";
- } else {
- my $tmp = $base;
- foreach (split('/', $tmp)) {
- $rel .= "../" if ("$_" ne "");
- }
- $rel .= $path;
- }
- $rel =~ s/\/\//\//g; # simplify
- $rel =~ s/\/$//; # don't end with /
- return $rel;
-}
-
-sub parseMakeOutput
-{
- print "Parsing GNU Make output to figure out build structure...\n";
- my $line = 0;
- while (my $text = shift @makedry) {
- my $ate_next;
- do {
- $ate_next = 0;
- $line++;
- chomp $text;
- chop $text if ($text =~ /\r$/);
- if ($text =~ /\\$/) {
- $text =~ s/\\$//;
- $text .= shift @makedry;
- $ate_next = 1;
- }
- } while($ate_next);
-
- if ($text =~ /^test /) {
- # options to test (eg -o) may be mistaken for linker options
- next;
- }
-
- if ($text =~ /^(mkdir|msgfmt) /) {
- # options to the Portable Object translations
- # the line "mkdir ... && msgfmt ..." contains no linker options
- next;
- }
-
- if($text =~ / -c /) {
- # compilation
- handleCompileLine($text, $line);
-
- } elsif ($text =~ / -o /) {
- # linking executable
- handleLinkLine($text, $line);
-
- } elsif ($text =~ /\.o / && $text =~ /\.a /) {
- # libifying
- handleLibLine($text, $line);
-#
-# } elsif ($text =~ /^cp /) {
-# # copy file around
-#
-# } elsif ($text =~ /^rm -f /) {
-# # shell command
-#
-# } elsif ($text =~ /^make[ \[]/) {
-# # make output
-#
-# } elsif ($text =~ /^echo /) {
-# # echo to file
-#
-# } elsif ($text =~ /^if /) {
-# # shell conditional
-#
-# } elsif ($text =~ /^tclsh /) {
-# # translation stuff
-#
-# } elsif ($text =~ /^umask /) {
-# # handling boilerplates
-#
-# } elsif ($text =~ /\$\(\:\)/) {
-# # ignore
-#
-# } elsif ($text =~ /^FLAGS=/) {
-# # flags check for dependencies
-#
-# } elsif ($text =~ /^'\/usr\/bin\/perl' -MError -e/) {
-# # perl commands for copying files
-#
-# } elsif ($text =~ /generate-cmdlist\.sh/) {
-# # command for generating list of commands
-#
-# } elsif ($text =~ /new locations or Tcl/) {
-# # command for detecting Tcl/Tk changes
-#
-# } elsif ($text =~ /mkdir -p/) {
-# # command creating path
-#
-# } elsif ($text =~ /: no custom templates yet/) {
-# # whatever
-#
-# } else {
-# print "Unhandled (line: $line): $text\n";
- }
- }
-
-# use Data::Dumper;
-# print "Parsed build structure:\n";
-# print Dumper(%build_structure);
-}
-
-# variables for the compilation part of each step
-my (@defines, @incpaths, @cflags, @sources);
-
-sub clearCompileStep
-{
- @defines = ();
- @incpaths = ();
- @cflags = ();
- @sources = ();
-}
-
-sub removeDuplicates
-{
- my (%dupHash, $entry);
- %dupHash = map { $_, 1 } @defines;
- @defines = keys %dupHash;
-
- %dupHash = map { $_, 1 } @incpaths;
- @incpaths = keys %dupHash;
-
- %dupHash = map { $_, 1 } @cflags;
- @cflags = keys %dupHash;
-}
-
-sub handleCompileLine
-{
- my ($line, $lineno) = @_;
- my @parts = shellwords($line);
- my $sourcefile;
- shift(@parts); # ignore cmd
- while (my $part = shift @parts) {
- if ("$part" eq "-o") {
- # ignore object file
- shift @parts;
- } elsif ("$part" eq "-c") {
- # ignore compile flag
- } elsif ("$part" eq "-c") {
- } elsif ($part =~ /^.?-I/) {
- push(@incpaths, $part);
- } elsif ($part =~ /^.?-D/) {
- push(@defines, $part);
- } elsif ($part =~ /^-/) {
- push(@cflags, $part);
- } elsif ($part =~ /\.(c|cc|cpp)$/) {
- $sourcefile = $part;
- } else {
- die "Unhandled compiler option @ line $lineno: $part";
- }
- }
- @{$compile_options{"${sourcefile}_CFLAGS"}} = @cflags;
- @{$compile_options{"${sourcefile}_DEFINES"}} = @defines;
- @{$compile_options{"${sourcefile}_INCPATHS"}} = @incpaths;
- clearCompileStep();
-}
-
-sub handleLibLine
-{
- my ($line, $lineno) = @_;
- my (@objfiles, @lflags, $libout, $part);
- # kill cmd and rm 'prefix'
- $line =~ s/^rm -f .* && .* rcs //;
- my @parts = shellwords($line);
- while ($part = shift @parts) {
- if ($part =~ /^-/) {
- push(@lflags, $part);
- } elsif ($part =~ /\.(o|obj)$/) {
- push(@objfiles, $part);
- } elsif ($part =~ /\.(a|lib)$/) {
- $libout = $part;
- $libout =~ s/\.a$//;
- } else {
- die "Unhandled lib option @ line $lineno: $part";
- }
- }
-# print "LibOut: '$libout'\nLFlags: @lflags\nOfiles: @objfiles\n";
-# exit(1);
- foreach (@objfiles) {
- my $sourcefile = $_;
- $sourcefile =~ s/\.o$/.c/;
- push(@sources, $sourcefile);
- push(@cflags, @{$compile_options{"${sourcefile}_CFLAGS"}});
- push(@defines, @{$compile_options{"${sourcefile}_DEFINES"}});
- push(@incpaths, @{$compile_options{"${sourcefile}_INCPATHS"}});
- }
- removeDuplicates();
-
- push(@{$build_structure{"LIBS"}}, $libout);
- @{$build_structure{"LIBS_${libout}"}} = ("_DEFINES", "_INCLUDES", "_CFLAGS", "_SOURCES",
- "_OBJECTS");
- @{$build_structure{"LIBS_${libout}_DEFINES"}} = @defines;
- @{$build_structure{"LIBS_${libout}_INCLUDES"}} = @incpaths;
- @{$build_structure{"LIBS_${libout}_CFLAGS"}} = @cflags;
- @{$build_structure{"LIBS_${libout}_LFLAGS"}} = @lflags;
- @{$build_structure{"LIBS_${libout}_SOURCES"}} = @sources;
- @{$build_structure{"LIBS_${libout}_OBJECTS"}} = @objfiles;
- clearCompileStep();
-}
-
-sub handleLinkLine
-{
- my ($line, $lineno) = @_;
- my (@objfiles, @lflags, @libs, $appout, $part);
- my @parts = shellwords($line);
- shift(@parts); # ignore cmd
- while ($part = shift @parts) {
- if ($part =~ /^-IGNORE/) {
- push(@lflags, $part);
- } elsif ($part =~ /^-[GRIMDO]/) {
- # eat compiler flags
- } elsif ("$part" eq "-o") {
- $appout = shift @parts;
- } elsif ("$part" eq "-lz") {
- push(@libs, "zlib.lib");
- } elsif ("$part" eq "-lcrypto") {
- push(@libs, "libcrypto.lib");
- } elsif ("$part" eq "-lssl") {
- push(@libs, "libssl.lib");
- } elsif ("$part" eq "-lcurl") {
- push(@libs, "libcurl.lib");
- } elsif ("$part" eq "-lexpat") {
- push(@libs, "libexpat.lib");
- } elsif ("$part" eq "-liconv") {
- push(@libs, "iconv.lib");
- } elsif ($part =~ /^[-\/]/) {
- push(@lflags, $part);
- } elsif ($part =~ /\.(a|lib)$/) {
- $part =~ s/\.a$/.lib/;
- push(@libs, $part);
- } elsif ($part eq 'invalidcontinue.obj') {
- # ignore - known to MSVC
- } elsif ($part =~ /\.o$/) {
- push(@objfiles, $part);
- } elsif ($part =~ /\.obj$/) {
- # do nothing, 'make' should not be producing .obj, only .o files
- } else {
- die "Unhandled link option @ line $lineno: $part";
- }
- }
-# print "AppOut: '$appout'\nLFlags: @lflags\nLibs : @libs\nOfiles: @objfiles\n";
-# exit(1);
- foreach (@objfiles) {
- my $sourcefile = $_;
- $sourcefile =~ s/^headless-git\.o$/compat\/win32\/headless.c/;
- $sourcefile =~ s/\.o$/.c/;
- push(@sources, $sourcefile);
- push(@cflags, @{$compile_options{"${sourcefile}_CFLAGS"}});
- push(@defines, @{$compile_options{"${sourcefile}_DEFINES"}});
- push(@incpaths, @{$compile_options{"${sourcefile}_INCPATHS"}});
- }
- removeDuplicates();
-
- removeDuplicates();
- push(@{$build_structure{"APPS"}}, $appout);
- @{$build_structure{"APPS_${appout}"}} = ("_DEFINES", "_INCLUDES", "_CFLAGS", "_LFLAGS",
- "_SOURCES", "_OBJECTS", "_LIBS");
- @{$build_structure{"APPS_${appout}_DEFINES"}} = @defines;
- @{$build_structure{"APPS_${appout}_INCLUDES"}} = @incpaths;
- @{$build_structure{"APPS_${appout}_CFLAGS"}} = @cflags;
- @{$build_structure{"APPS_${appout}_LFLAGS"}} = @lflags;
- @{$build_structure{"APPS_${appout}_SOURCES"}} = @sources;
- @{$build_structure{"APPS_${appout}_OBJECTS"}} = @objfiles;
- @{$build_structure{"APPS_${appout}_LIBS"}} = @libs;
- clearCompileStep();
-}
diff --git a/contrib/buildsystems/generate b/contrib/buildsystems/generate
deleted file mode 100755
index bc10f25ff2..0000000000
--- a/contrib/buildsystems/generate
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/perl -w
-######################################################################
-# Generate buildsystem files
-#
-# This script generate buildsystem files based on the output of a
-# GNU Make --dry-run, enabling Windows users to develop Git with their
-# trusted IDE with native projects.
-#
-# Note:
-# It is not meant as *the* way of building Git with MSVC, but merely a
-# convenience. The correct way of building Git with MSVC is to use the
-# GNU Make tool to build with the maintained Makefile in the root of
-# the project. If you have the msysgit environment installed and
-# available in your current console, together with the Visual Studio
-# environment you wish to build for, all you have to do is run the
-# command:
-# make MSVC=1
-#
-# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>
-######################################################################
-use strict;
-use File::Basename;
-use Cwd;
-
-my $git_dir = getcwd();
-$git_dir =~ s=\\=/=g;
-$git_dir = dirname($git_dir) while (!-e "$git_dir/git.c" && "$git_dir" ne "");
-die "Couldn't find Git repo" if ("$git_dir" eq "");
-exec join(" ", ("PERL5LIB=${git_dir}/contrib/buildsystems ${git_dir}/contrib/buildsystems/engine.pl", @ARGV));
diff --git a/contrib/buildsystems/parse.pl b/contrib/buildsystems/parse.pl
deleted file mode 100755
index c9656ece99..0000000000
--- a/contrib/buildsystems/parse.pl
+++ /dev/null
@@ -1,228 +0,0 @@
-#!/usr/bin/perl -w
-######################################################################
-# Do not call this script directly!
-#
-# The generate script ensures that @INC is correct before the engine
-# is executed.
-#
-# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>
-######################################################################
-use strict;
-use File::Basename;
-use Cwd;
-
-my $file = $ARGV[0];
-die "No file provided!" if !defined $file;
-
-my ($cflags, $target, $type, $line);
-
-open(F, "<$file") || die "Couldn't open file $file";
-my @data = <F>;
-close(F);
-
-while (my $text = shift @data) {
- my $ate_next;
- do {
- $ate_next = 0;
- $line++;
- chomp $text;
- chop $text if ($text =~ /\r$/);
- if ($text =~ /\\$/) {
- $text =~ s/\\$//;
- $text .= shift @data;
- $ate_next = 1;
- }
- } while($ate_next);
-
- if($text =~ / -c /) {
- # compilation
- handleCompileLine($text, $line);
-
- } elsif ($text =~ / -o /) {
- # linking executable
- handleLinkLine($text, $line);
-
- } elsif ($text =~ /\.o / && $text =~ /\.a /) {
- # libifying
- handleLibLine($text, $line);
-
-# } elsif ($text =~ /^cp /) {
-# # copy file around
-#
-# } elsif ($text =~ /^rm -f /) {
-# # shell command
-#
-# } elsif ($text =~ /^make[ \[]/) {
-# # make output
-#
-# } elsif ($text =~ /^echo /) {
-# # echo to file
-#
-# } elsif ($text =~ /^if /) {
-# # shell conditional
-#
-# } elsif ($text =~ /^tclsh /) {
-# # translation stuff
-#
-# } elsif ($text =~ /^umask /) {
-# # handling boilerplates
-#
-# } elsif ($text =~ /\$\(\:\)/) {
-# # ignore
-#
-# } elsif ($text =~ /^FLAGS=/) {
-# # flags check for dependencies
-#
-# } elsif ($text =~ /^'\/usr\/bin\/perl' -MError -e/) {
-# # perl commands for copying files
-#
-# } elsif ($text =~ /generate-cmdlist\.sh/) {
-# # command for generating list of commands
-#
-# } elsif ($text =~ /^test / && $text =~ /|| rm -f /) {
-# # commands removing executables, if they exist
-#
-# } elsif ($text =~ /new locations or Tcl/) {
-# # command for detecting Tcl/Tk changes
-#
-# } elsif ($text =~ /mkdir -p/) {
-# # command creating path
-#
-# } elsif ($text =~ /: no custom templates yet/) {
-# # whatever
-
- } else {
-# print "Unhandled (line: $line): $text\n";
- }
-}
-close(F);
-
-# use Data::Dumper;
-# print "Parsed build structure:\n";
-# print Dumper(%build_structure);
-
-# -------------------------------------------------------------------
-# Functions under here
-# -------------------------------------------------------------------
-my (%build_structure, @defines, @incpaths, @cflags, @sources);
-
-sub clearCompileStep
-{
- @defines = ();
- @incpaths = ();
- @cflags = ();
- @sources = ();
-}
-
-sub removeDuplicates
-{
- my (%dupHash, $entry);
- %dupHash = map { $_, 1 } @defines;
- @defines = keys %dupHash;
-
- %dupHash = map { $_, 1 } @incpaths;
- @incpaths = keys %dupHash;
-
- %dupHash = map { $_, 1 } @cflags;
- @cflags = keys %dupHash;
-
- %dupHash = map { $_, 1 } @sources;
- @sources = keys %dupHash;
-}
-
-sub handleCompileLine
-{
- my ($line, $lineno) = @_;
- my @parts = split(' ', $line);
- shift(@parts); # ignore cmd
- while (my $part = shift @parts) {
- if ("$part" eq "-o") {
- # ignore object file
- shift @parts;
- } elsif ("$part" eq "-c") {
- # ignore compile flag
- } elsif ("$part" eq "-c") {
- } elsif ($part =~ /^.?-I/) {
- push(@incpaths, $part);
- } elsif ($part =~ /^.?-D/) {
- push(@defines, $part);
- } elsif ($part =~ /^-/) {
- push(@cflags, $part);
- } elsif ($part =~ /\.(c|cc|cpp)$/) {
- push(@sources, $part);
- } else {
- die "Unhandled compiler option @ line $lineno: $part";
- }
- }
- #print "Sources: @sources\nCFlags: @cflags\nDefine: @defines\nIncpat: @incpaths\n";
- #exit(1);
-}
-
-sub handleLibLine
-{
- my ($line, $lineno) = @_;
- my (@objfiles, @lflags, $libout, $part);
- # kill cmd and rm 'prefix'
- $line =~ s/^rm -f .* && .* rcs //;
- my @parts = split(' ', $line);
- while ($part = shift @parts) {
- if ($part =~ /^-/) {
- push(@lflags, $part);
- } elsif ($part =~ /\.(o|obj)$/) {
- push(@objfiles, $part);
- } elsif ($part =~ /\.(a|lib)$/) {
- $libout = $part;
- } else {
- die "Unhandled lib option @ line $lineno: $part";
- }
- }
- #print "LibOut: '$libout'\nLFlags: @lflags\nOfiles: @objfiles\n";
- #exit(1);
- removeDuplicates();
- push(@{$build_structure{"LIBS"}}, $libout);
- @{$build_structure{"LIBS_${libout}"}} = ("_DEFINES", "_INCLUDES", "_CFLAGS", "_SOURCES",
- "_OBJECTS");
- @{$build_structure{"LIBS_${libout}_DEFINES"}} = @defines;
- @{$build_structure{"LIBS_${libout}_INCLUDES"}} = @incpaths;
- @{$build_structure{"LIBS_${libout}_CFLAGS"}} = @cflags;
- @{$build_structure{"LIBS_${libout}_SOURCES"}} = @sources;
- @{$build_structure{"LIBS_${libout}_OBJECTS"}} = @objfiles;
- clearCompileStep();
-}
-
-sub handleLinkLine
-{
- my ($line, $lineno) = @_;
- my (@objfiles, @lflags, @libs, $appout, $part);
- my @parts = split(' ', $line);
- shift(@parts); # ignore cmd
- while ($part = shift @parts) {
- if ($part =~ /^-[GRIDO]/) {
- # eat compiler flags
- } elsif ("$part" eq "-o") {
- $appout = shift @parts;
- } elsif ($part =~ /^-/) {
- push(@lflags, $part);
- } elsif ($part =~ /\.(a|lib)$/) {
- push(@libs, $part);
- } elsif ($part =~ /\.(o|obj)$/) {
- push(@objfiles, $part);
- } else {
- die "Unhandled lib option @ line $lineno: $part";
- }
- }
- #print "AppOut: '$appout'\nLFlags: @lflags\nLibs : @libs\nOfiles: @objfiles\n";
- #exit(1);
- removeDuplicates();
- push(@{$build_structure{"APPS"}}, $appout);
- @{$build_structure{"APPS_${appout}"}} = ("_DEFINES", "_INCLUDES", "_CFLAGS", "_LFLAGS",
- "_SOURCES", "_OBJECTS", "_LIBS");
- @{$build_structure{"APPS_${appout}_DEFINES"}} = @defines;
- @{$build_structure{"APPS_${appout}_INCLUDES"}} = @incpaths;
- @{$build_structure{"APPS_${appout}_CFLAGS"}} = @cflags;
- @{$build_structure{"APPS_${appout}_LFLAGS"}} = @lflags;
- @{$build_structure{"APPS_${appout}_SOURCES"}} = @sources;
- @{$build_structure{"APPS_${appout}_OBJECTS"}} = @objfiles;
- @{$build_structure{"APPS_${appout}_LIBS"}} = @libs;
- clearCompileStep();
-}
diff --git a/contrib/coccinelle/meson.build b/contrib/coccinelle/meson.build
index 5d76a7fee6..dc3f73c2e7 100644
--- a/contrib/coccinelle/meson.build
+++ b/contrib/coccinelle/meson.build
@@ -1,23 +1,13 @@
-spatch = find_program('spatch', required: get_option('coccinelle'))
+coccinelle_opt = get_option('coccinelle').require(
+ fs.exists(meson.project_source_root() / '.git'),
+ error_message: 'coccinelle can only be run from a git checkout',
+)
+
+spatch = find_program('spatch', required: coccinelle_opt)
if not spatch.found()
subdir_done()
endif
-third_party_sources = [
- ':!contrib',
- ':!compat/inet_ntop.c',
- ':!compat/inet_pton.c',
- ':!compat/nedmalloc',
- ':!compat/obstack.*',
- ':!compat/poll',
- ':!compat/regex',
- ':!sha1collisiondetection',
- ':!sha1dc',
- ':!t/unit-tests/clar',
- ':!t/unit-tests/clar',
- ':!t/t[0-9][0-9][0-9][0-9]*',
-]
-
rules = [
'array.cocci',
'commit.cocci',
@@ -50,18 +40,18 @@ concatenated_rules = custom_target(
capture: true,
)
-sources = [ ]
-foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_sources, check: true).stdout().split()
- sources += source
+coccinelle_sources = []
+foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_excludes, check: true).stdout().split()
+ coccinelle_sources += source
endforeach
-headers = [ ]
-foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()
- headers += meson.project_source_root() / header
+coccinelle_headers = []
+foreach header : headers_to_check
+ coccinelle_headers += meson.project_source_root() / header
endforeach
patches = [ ]
-foreach source : sources
+foreach source : coccinelle_sources
patches += custom_target(
command: [
spatch,
@@ -73,7 +63,7 @@ foreach source : sources
input: meson.project_source_root() / source,
output: source.underscorify() + '.patch',
capture: true,
- depend_files: headers,
+ depend_files: coccinelle_headers,
)
endforeach
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 413911be3b..e3d88b0672 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -234,6 +234,17 @@ __git_dequote ()
done
}
+# Prints the number of slash-separated components in a path.
+# 1: Path to count components of.
+__git_count_path_components ()
+{
+ local path="$1"
+ local relative="${path#/}"
+ relative="${relative%/}"
+ local slashes="/${relative//[^\/]}"
+ echo "${#slashes}"
+}
+
# The following function is based on code from:
#
# bash_completion - programmable completion functions for bash 3.2+
@@ -779,16 +790,39 @@ __git_tags ()
__git_dwim_remote_heads ()
{
local pfx="${1-}" cur_="${2-}" sfx="${3-}"
- local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers
# employ the heuristic used by git checkout and git switch
# Try to find a remote branch that cur_es the completion word
# but only output if the branch name is unique
- __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
- --sort="refname:strip=3" \
- ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
- "refs/remotes/*/$cur_*" "refs/remotes/*/$cur_*/**" | \
- uniq -u
+ local awk_script='
+ function casemap(s) {
+ if (ENVIRON["IGNORE_CASE"])
+ return tolower(s)
+ else
+ return s
+ }
+ BEGIN {
+ split(ENVIRON["REMOTES"], remotes, /\n/)
+ for (i in remotes)
+ remotes[i] = "refs/remotes/" casemap(remotes[i])
+ cur_ = casemap(ENVIRON["CUR_"])
+ }
+ {
+ ref_case = casemap($0)
+ for (i in remotes) {
+ if (index(ref_case, remotes[i] "/" cur_) == 1) {
+ branch = substr($0, length(remotes[i] "/") + 1)
+ print ENVIRON["PFX"] branch ENVIRON["SFX"]
+ break
+ }
+ }
+ }
+ '
+ __git for-each-ref --format='%(refname)' refs/remotes/ |
+ PFX="$pfx" SFX="$sfx" CUR_="$cur_" \
+ IGNORE_CASE=${GIT_COMPLETION_IGNORE_CASE+1} \
+ REMOTES="$(__git_remotes | sort -r)" awk "$awk_script" |
+ sort | uniq -u
}
# Lists refs from the local (by default) or from a remote repository.
@@ -894,7 +928,8 @@ __git_refs ()
case "HEAD" in
$match*|$umatch*) echo "${pfx}HEAD$sfx" ;;
esac
- __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
+ local strip="$(__git_count_path_components "refs/remotes/$remote")"
+ __git for-each-ref --format="$fer_pfx%(refname:strip=$strip)$sfx" \
${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/remotes/$remote/$match*" \
"refs/remotes/$remote/$match*/**"
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
index 3a9ddab594..576125b083 100644
--- a/contrib/completion/meson.build
+++ b/contrib/completion/meson.build
@@ -14,3 +14,21 @@ foreach script : [
)
endif
endforeach
+
+# We have to discern between the test dependency and the installed file. Our
+# tests assume the completion scripts to have the same name as the in-tree
+# files, but the installed filenames need to match the executable's basename.
+if meson.version().version_compare('>=1.3.0')
+ fs.copyfile('git-completion.bash', 'git',
+ install: true,
+ install_dir: get_option('datadir') / 'bash-completion/completions',
+ )
+else
+ configure_file(
+ input: 'git-completion.bash',
+ output: 'git',
+ copy: true,
+ install: true,
+ install_dir: get_option('datadir') / 'bash-completion/completions',
+ )
+endif
diff --git a/contrib/credential/netrc/meson.build b/contrib/credential/netrc/meson.build
index a990dbb86d..16fa69e317 100644
--- a/contrib/credential/netrc/meson.build
+++ b/contrib/credential/netrc/meson.build
@@ -7,14 +7,16 @@ credential_netrc = custom_target(
install_dir: get_option('libexecdir') / 'git-core',
)
-credential_netrc_testenv = test_environment
-credential_netrc_testenv.set('CREDENTIAL_NETRC_PATH', credential_netrc.full_path())
+if get_option('tests')
+ credential_netrc_testenv = test_environment
+ credential_netrc_testenv.set('CREDENTIAL_NETRC_PATH', credential_netrc.full_path())
-test('t-git-credential-netrc',
- shell,
- args: [ meson.current_source_dir() / 't-git-credential-netrc.sh' ],
- workdir: meson.current_source_dir(),
- env: credential_netrc_testenv,
- depends: test_dependencies + bin_wrappers + [credential_netrc],
- timeout: 0,
-)
+ test('t-git-credential-netrc',
+ shell,
+ args: [ meson.current_source_dir() / 't-git-credential-netrc.sh' ],
+ workdir: meson.current_source_dir(),
+ env: credential_netrc_testenv,
+ depends: test_dependencies + bin_wrappers + [credential_netrc],
+ kwargs: test_kwargs,
+ )
+endif
diff --git a/contrib/subtree/README b/contrib/subtree/README
index c686b4a69b..65d167b678 100644
--- a/contrib/subtree/README
+++ b/contrib/subtree/README
@@ -1,5 +1,5 @@
-Please read git-subtree.txt for documentation.
+Please read git-subtree.adoc for documentation.
Please don't contact me using github mail; it's slow, ugly, and worst of
all, redundant. Email me instead at apenwarr@gmail.com and I'll be happy to
diff --git a/contrib/subtree/git-subtree.adoc b/contrib/subtree/git-subtree.adoc
index 004abf415b..b2bcbcad0d 100644
--- a/contrib/subtree/git-subtree.adoc
+++ b/contrib/subtree/git-subtree.adoc
@@ -9,14 +9,14 @@ git-subtree - Merge subtrees together and split repository into subtrees
SYNOPSIS
--------
[verse]
-'git subtree' [<options>] -P <prefix> add <local-commit>
-'git subtree' [<options>] -P <prefix> add <repository> <remote-ref>
-'git subtree' [<options>] -P <prefix> merge <local-commit> [<repository>]
-'git subtree' [<options>] -P <prefix> split [<local-commit>]
+'git subtree' [<options>] -P <prefix> [-S[<keyid>]] add <local-commit>
+'git subtree' [<options>] -P <prefix> [-S[<keyid>]] add <repository> <remote-ref>
+'git subtree' [<options>] -P <prefix> [-S[<keyid>]] merge <local-commit> [<repository>]
+'git subtree' [<options>] -P <prefix> [-S[<keyid>]] split [<local-commit>]
[verse]
-'git subtree' [<options>] -P <prefix> pull <repository> <remote-ref>
-'git subtree' [<options>] -P <prefix> push <repository> <refspec>
+'git subtree' [<options>] -P <prefix> [-S[<keyid>]] pull <repository> <remote-ref>
+'git subtree' [<options>] -P <prefix> [-S[<keyid>]] push <repository> <refspec>
DESCRIPTION
-----------
@@ -149,6 +149,13 @@ OPTIONS FOR ALL COMMANDS
want to manipulate. This option is mandatory
for all commands.
+-S[<keyid>]::
+--gpg-sign[=<keyid>]::
+--no-gpg-sign::
+ GPG-sign commits. The `keyid` argument is optional and
+ defaults to the committer identity; `--no-gpg-sign` is useful to
+ countermand a `--gpg-sign` option given earlier on the command line.
+
OPTIONS FOR 'add' AND 'merge' (ALSO: 'pull', 'split --rejoin', AND 'push --rejoin')
-----------------------------------------------------------------------------------
These options for 'add' and 'merge' may also be given to 'pull' (which
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 15ae86db1b..3fddba797c 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -26,12 +26,12 @@ then
fi
OPTS_SPEC="\
-git subtree add --prefix=<prefix> <commit>
-git subtree add --prefix=<prefix> <repository> <ref>
-git subtree merge --prefix=<prefix> <commit>
-git subtree split --prefix=<prefix> [<commit>]
-git subtree pull --prefix=<prefix> <repository> <ref>
-git subtree push --prefix=<prefix> <repository> <refspec>
+git subtree add --prefix=<prefix> [-S[=<key-id>]] <commit>
+git subtree add --prefix=<prefix> [-S[=<key-id>]] <repository> <ref>
+git subtree merge --prefix=<prefix> [-S[=<key-id>]] <commit>
+git subtree split --prefix=<prefix> [-S[=<key-id>]] [<commit>]
+git subtree pull --prefix=<prefix> [-S[=<key-id>]] <repository> <ref>
+git subtree push --prefix=<prefix> [-S[=<key-id>]] <repository> <refspec>
--
h,help! show the help
q,quiet! quiet
@@ -46,6 +46,7 @@ rejoin merge the new branch back into HEAD
options for 'add' and 'merge' (also: 'pull', 'split --rejoin', and 'push --rejoin')
squash merge subtree changes as a single commit
m,message!= use the given message as the commit message for the merge commit
+S,gpg-sign?key-id GPG-sign commits. The keyid argument is optional and defaults to the committer identity
"
indent=0
@@ -115,7 +116,7 @@ main () {
then
set -- -h
fi
- set_args="$(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)"
+ set_args="$(echo "$OPTS_SPEC" | git rev-parse --parseopt --stuck-long -- "$@" || echo exit $?)"
eval "$set_args"
. git-sh-setup
require_work_tree
@@ -131,9 +132,6 @@ main () {
opt="$1"
shift
case "$opt" in
- --annotate|-b|-P|-m|--onto)
- shift
- ;;
--rejoin)
arg_split_rejoin=1
;;
@@ -171,48 +169,44 @@ main () {
arg_split_annotate=
arg_addmerge_squash=
arg_addmerge_message=
+ arg_gpg_sign=
while test $# -gt 0
do
opt="$1"
shift
case "$opt" in
- -q)
+ --quiet)
arg_quiet=1
;;
- -d)
+ --debug)
arg_debug=1
;;
- --annotate)
+ --annotate=*)
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
- arg_split_annotate="$1"
- shift
+ arg_split_annotate="${opt#*=}"
;;
--no-annotate)
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
arg_split_annotate=
;;
- -b)
+ --branch=*)
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
- arg_split_branch="$1"
- shift
+ arg_split_branch="${opt#*=}"
;;
- -P)
- arg_prefix="${1%/}"
- shift
+ --prefix=*)
+ arg_prefix="${opt#*=}"
;;
- -m)
+ --message=*)
test -n "$allow_addmerge" || die_incompatible_opt "$opt" "$arg_command"
- arg_addmerge_message="$1"
- shift
+ arg_addmerge_message="${opt#*=}"
;;
--no-prefix)
arg_prefix=
;;
- --onto)
+ --onto=*)
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
- arg_split_onto="$1"
- shift
+ arg_split_onto="${opt#*=}"
;;
--no-onto)
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
@@ -240,6 +234,9 @@ main () {
test -n "$allow_addmerge" || die_incompatible_opt "$opt" "$arg_command"
arg_addmerge_squash=
;;
+ --gpg-sign=* | --gpg-sign | --no-gpg-sign)
+ arg_gpg_sign="$opt"
+ ;;
--)
break
;;
@@ -272,6 +269,7 @@ main () {
debug "quiet: {$arg_quiet}"
debug "dir: {$dir}"
debug "opts: {$*}"
+ debug "gpg-sign: {$arg_gpg_sign}"
debug
"cmd_$arg_command" "$@"
@@ -537,7 +535,7 @@ copy_commit () {
printf "%s" "$arg_split_annotate"
cat
) |
- git commit-tree "$2" $3 # reads the rest of stdin
+ git commit-tree $arg_gpg_sign "$2" $3 # reads the rest of stdin
) || die "fatal: can't copy commit $1"
}
@@ -683,10 +681,10 @@ new_squash_commit () {
if test -n "$old"
then
squash_msg "$dir" "$oldsub" "$newsub" |
- git commit-tree "$tree" -p "$old" || exit $?
+ git commit-tree $arg_gpg_sign "$tree" -p "$old" || exit $?
else
squash_msg "$dir" "" "$newsub" |
- git commit-tree "$tree" || exit $?
+ git commit-tree $arg_gpg_sign "$tree" || exit $?
fi
}
@@ -925,11 +923,11 @@ cmd_add_commit () {
then
rev=$(new_squash_commit "" "" "$rev") || exit $?
commit=$(add_squashed_msg "$rev" "$dir" |
- git commit-tree "$tree" $headp -p "$rev") || exit $?
+ git commit-tree $arg_gpg_sign "$tree" $headp -p "$rev") || exit $?
else
revp=$(peel_committish "$rev") || exit $?
commit=$(add_msg "$dir" $headrev "$rev" |
- git commit-tree "$tree" $headp -p "$revp") || exit $?
+ git commit-tree $arg_gpg_sign "$tree" $headp -p "$revp") || exit $?
fi
git reset "$commit" || exit $?
@@ -1080,9 +1078,9 @@ cmd_merge () {
if test -n "$arg_addmerge_message"
then
git merge --no-ff -Xsubtree="$arg_prefix" \
- --message="$arg_addmerge_message" "$rev"
+ --message="$arg_addmerge_message" $arg_gpg_sign "$rev"
else
- git merge --no-ff -Xsubtree="$arg_prefix" $rev
+ git merge --no-ff -Xsubtree="$arg_prefix" $arg_gpg_sign $rev
fi
}
diff --git a/contrib/subtree/meson.build b/contrib/subtree/meson.build
index 9c72b23625..98dd8e0c8e 100644
--- a/contrib/subtree/meson.build
+++ b/contrib/subtree/meson.build
@@ -12,16 +12,18 @@ git_subtree = custom_target(
install_dir: get_option('libexecdir') / 'git-core',
)
-subtree_test_environment = test_environment
-subtree_test_environment.prepend('PATH', meson.current_build_dir())
+if get_option('tests')
+ subtree_test_environment = test_environment
+ subtree_test_environment.prepend('PATH', meson.current_build_dir())
-test('t7900-subtree', shell,
- args: [ 't7900-subtree.sh' ],
- env: subtree_test_environment,
- workdir: meson.current_source_dir() / 't',
- depends: test_dependencies + bin_wrappers + [ git_subtree ],
- timeout: 0,
-)
+ test('t7900-subtree', shell,
+ args: [ 't7900-subtree.sh' ],
+ env: subtree_test_environment,
+ workdir: meson.current_source_dir() / 't',
+ depends: test_dependencies + bin_wrappers + [ git_subtree ],
+ kwargs: test_kwargs,
+ )
+endif
if get_option('docs').contains('man')
subtree_xml = custom_target(
diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
index 3c6103f6d2..3edbb33af4 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -11,6 +11,7 @@ and push subcommands of git subtree.
TEST_DIRECTORY=$(pwd)/../../../t
. "$TEST_DIRECTORY"/test-lib.sh
+. "$TEST_DIRECTORY"/lib-gpg.sh
# Use our own wrapper around test-lib.sh's test_create_repo, in order
# to set log.date=relative. `git subtree` parses the output of `git
@@ -1563,4 +1564,116 @@ test_expect_success 'subtree descendant check' '
)
'
+test_expect_success GPG 'add subproj with GPG signing using -S flag' '
+ subtree_test_create_repo "$test_count" &&
+ subtree_test_create_repo "$test_count/sub proj" &&
+ test_create_commit "$test_count" main1 &&
+ test_create_commit "$test_count/sub proj" sub1 &&
+ (
+ cd "$test_count" &&
+ git fetch ./"sub proj" HEAD &&
+ git subtree add --prefix="sub dir" -S FETCH_HEAD &&
+ git verify-commit HEAD &&
+ test "$(last_commit_subject)" = "Add '\''sub dir/'\'' from commit '\''$(git rev-parse FETCH_HEAD)'\''"
+ )
+'
+
+test_expect_success GPG 'add subproj with GPG signing using --gpg-sign flag' '
+ subtree_test_create_repo "$test_count" &&
+ subtree_test_create_repo "$test_count/sub proj" &&
+ test_create_commit "$test_count" main1 &&
+ test_create_commit "$test_count/sub proj" sub1 &&
+ (
+ cd "$test_count" &&
+ git fetch ./"sub proj" HEAD &&
+ git subtree add --prefix="sub dir" --gpg-sign FETCH_HEAD &&
+ git verify-commit HEAD &&
+ test "$(last_commit_subject)" = "Add '\''sub dir/'\'' from commit '\''$(git rev-parse FETCH_HEAD)'\''"
+ )
+'
+
+test_expect_success GPG 'add subproj with GPG signing using specific key ID' '
+ subtree_test_create_repo "$test_count" &&
+ subtree_test_create_repo "$test_count/sub proj" &&
+ test_create_commit "$test_count" main1 &&
+ test_create_commit "$test_count/sub proj" sub1 &&
+ (
+ cd "$test_count" &&
+ git fetch ./"sub proj" HEAD &&
+ git subtree add --prefix="sub dir" -S"$GIT_COMMITTER_EMAIL" FETCH_HEAD &&
+ git verify-commit HEAD &&
+ test "$(last_commit_subject)" = "Add '\''sub dir/'\'' from commit '\''$(git rev-parse FETCH_HEAD)'\''"
+ )
+'
+
+test_expect_success GPG 'merge with GPG signing' '
+ subtree_test_create_repo "$test_count" &&
+ subtree_test_create_repo "$test_count/sub proj" &&
+ test_create_commit "$test_count" main1 &&
+ test_create_commit "$test_count/sub proj" sub1 &&
+ (
+ cd "$test_count" &&
+ git fetch ./"sub proj" HEAD &&
+ git subtree add --prefix="sub dir" FETCH_HEAD
+ ) &&
+ test_create_commit "$test_count/sub proj" sub2 &&
+ (
+ cd "$test_count" &&
+ git fetch ./"sub proj" HEAD &&
+ git subtree merge --prefix="sub dir" -S FETCH_HEAD &&
+ git verify-commit HEAD
+ )
+'
+
+test_expect_success GPG 'split with GPG signing and --rejoin' '
+ subtree_test_create_repo "$test_count" &&
+ subtree_test_create_repo "$test_count/sub proj" &&
+ test_create_commit "$test_count" main1 &&
+ test_create_commit "$test_count/sub proj" sub1 &&
+ (
+ cd "$test_count" &&
+ git fetch ./"sub proj" HEAD &&
+ git subtree add --prefix="sub dir" FETCH_HEAD
+ ) &&
+ test_create_commit "$test_count" "sub dir/main-sub1" &&
+ (
+ cd "$test_count" &&
+ git subtree split --prefix="sub dir" --rejoin -S &&
+ git verify-commit HEAD
+ )
+'
+
+test_expect_success GPG 'add with --squash and GPG signing' '
+ subtree_test_create_repo "$test_count" &&
+ subtree_test_create_repo "$test_count/sub proj" &&
+ test_create_commit "$test_count" main1 &&
+ test_create_commit "$test_count/sub proj" sub1 &&
+ (
+ cd "$test_count" &&
+ git fetch ./"sub proj" HEAD &&
+ git subtree add --prefix="sub dir" --squash -S FETCH_HEAD &&
+ git verify-commit HEAD &&
+ # With --squash, the commit subject should reference the squash commit (first parent of merge)
+ squash_commit=$(git rev-parse HEAD^2) &&
+ test "$(last_commit_subject)" = "Merge commit '\''$squash_commit'\'' as '\''sub dir'\''"
+ )
+'
+
+test_expect_success GPG 'pull with GPG signing' '
+ subtree_test_create_repo "$test_count" &&
+ subtree_test_create_repo "$test_count/sub proj" &&
+ test_create_commit "$test_count" main1 &&
+ test_create_commit "$test_count/sub proj" sub1 &&
+ (
+ cd "$test_count" &&
+ git subtree add --prefix="sub dir" ./"sub proj" HEAD
+ ) &&
+ test_create_commit "$test_count/sub proj" sub2 &&
+ (
+ cd "$test_count" &&
+ git subtree pull --prefix="sub dir" -S ./"sub proj" HEAD &&
+ git verify-commit HEAD
+ )
+'
+
test_done