1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2026-05-01 00:07:19 +02:00

Update libraries and make it build on windows.

Still gets some warnings because compilers have changed. But should work.
This commit is contained in:
Sandu Liviu Catalin
2025-06-25 22:34:23 +03:00
parent 520a5eacc5
commit f2b7499f85
3038 changed files with 251668 additions and 273857 deletions
+38 -17
View File
@@ -2,13 +2,10 @@
use strict;
use warnings;
use autodie qw( :all );
use FindBin qw( $Bin );
use File::Path qw( mkpath );
use File::Slurp qw( edit_file read_file );
use File::Which qw( which );
sub main {
my $target = shift || "$Bin/..";
@@ -16,7 +13,7 @@ sub main {
my @translators = qw ( lowdown pandoc );
my $translator;
foreach my $p (@translators) {
if ( defined which($p) ) {
if ( _which($p) ) {
$translator = $p;
last;
}
@@ -33,6 +30,14 @@ sub main {
_make_man( $translator, $target, 'mmdblookup', 1 );
}
sub _which {
my $program = shift;
for my $path ( split /:/, $ENV{PATH} ) {
return 1 if -x "$path/$program";
}
return 0;
}
sub _make_man {
my $translator = shift;
my $target = shift;
@@ -54,7 +59,7 @@ sub _make_man {
'-M', "section:$section",
$input,
'-o', $output,
);
) == 0 or die "Failed to run pandoc: $?";
_pandoc_postprocess($output);
}
elsif ( $translator eq 'lowdown' ) {
@@ -67,18 +72,27 @@ sub _make_man {
'-M', "section:$section",
$input,
'-o', $output,
);
) == 0 or die "Failed to run lowdown: $?";
}
}
sub _make_lib_man_links {
my $target = shift;
my $header = read_file("$Bin/../include/maxminddb.h");
open my $header_fh, '<', "$Bin/../include/maxminddb.h"
or die "Failed to open header file: $!";
my $header = do { local $/; <$header_fh> };
die "Error reading file header file: $!" unless defined $header;
close $header_fh or die "Failed to close header file: $!";
for my $proto ( $header =~ /^ *extern.+?(MMDB_\w+)\(/gsm ) {
open my $fh, '>', "$target/man/man3/$proto.3";
print {$fh} ".so man3/libmaxminddb.3\n";
close $fh;
open my $fh, '>', "$target/man/man3/$proto.3"
or die "Failed to open file: $!";
print {$fh} ".so man3/libmaxminddb.3\n"
or die "Failed to write to file: $!";
close $fh or die "Failed to close file: $!";
}
}
@@ -87,13 +101,20 @@ sub _make_lib_man_links {
sub _pandoc_postprocess {
my $file = shift;
edit_file(
sub {
s/^\.IP\n\.nf/.IP "" 4\n.nf/gm;
s/(Automatically generated by Pandoc)(.+)$/$1/m;
},
$file
);
open my $fh, '<', $file or die "Failed to open man file for reading: $!";
my @lines = <$fh>;
die "Error when reading man page: $!" if $!;
close $fh or die "Failed to close file: $!";
for my $line (@lines) {
$line =~ s/^\.IP\n\.nf/.IP "" 4\n.nf/gm;
$line =~ s/(Automatically generated by Pandoc)(.+)$/$1/m;
}
open $fh, '>', $file or die "Failed to open file for writing: $!";
print $fh @lines or die "Failed to write to file: $!";
close $fh or die "Failed to close file: $!";
}
main(shift);
-54
View File
@@ -1,54 +0,0 @@
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin qw( $Bin );
use Data::UUID;
use File::Slurp qw( read_file write_file );
use Path::Iterator::Rule;
sub main {
my $rule = Path::Iterator::Rule->new;
$rule->file->name(qr/_t.c$/);
my $ug = Data::UUID->new;
my $template = read_file("$Bin/../projects/test.vcxproj.template");
my @names;
for my $file ( $rule->all("$Bin/../t/") ) {
my ($name) = $file =~ /(\w*)_t.c$/;
next unless $name;
next if $name eq 'threads';
push @names, $name;
my $project = $template;
$project =~ s/%TESTNAME%/$name/g;
my $uuid = $ug->to_string( $ug->create );
$project =~ s/%UUID%/$uuid/g;
write_file( "$Bin/../projects/VS12-tests/$name.vcxproj", $project );
}
_modify_yml(@names);
}
sub _modify_yml {
my @names = @_;
my $exe_block = join "\n",
map { " - .\\projects\\VS12\\Debug\\test_${_}.exe" } @names;
my $file = "$Bin/../appveyor.yml";
my $config = read_file($file);
$config =~ s/(#EXES).*?(#ENDEXES)/$1\n$exe_block\n $2/s;
write_file( $file, $config );
}
main();
+1 -5
View File
@@ -115,8 +115,4 @@ popd
git push
message="$version
$notes"
hub release create -a "$dist" -m "$message" "$version"
gh release create --target "$(git branch --show-current)" -t "$version" -n "$notes" "$version" "$dist"