mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-09 03:41:10 +08:00

Use reverse DNS naming for .desktop and .metainfo.xml as your supposed to do nowadays according to freedesktop.org. This also happens to match what is mandated by flatpak, so it simplifies the flatpak post install script a little. + cleanup the mess that flatpak builds can leave behind when you do a clean.
47 lines
1.2 KiB
Perl
Executable File
47 lines
1.2 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
my @t = localtime();
|
|
my $sec = $t[0];
|
|
my $min = $t[1];
|
|
my $hour = $t[2];
|
|
my $mday = $t[3];
|
|
my $mon = $t[4] + 1;
|
|
my $year = $t[5] + 1900;
|
|
|
|
my @months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
|
|
|
|
my $tmp = sprintf("%s %u, %u %u:%02u:%02u%s",$months[$mon-1],$mday,$year,(($hour + 11) % 12) + 1,$min,$sec,$hour >= 12 ? "pm" : "am");
|
|
|
|
my $commit = `git rev-parse --short=7 HEAD`;
|
|
chomp($commit);
|
|
|
|
open(X,">","include/build_timestamp.h") || die;
|
|
print X "/*auto-generated*/\n";
|
|
print X "#define UPDATED_STR \"$tmp\"\n";
|
|
print X "#define GIT_COMMIT_HASH \"$commit\"\n";
|
|
print X "#define COPYRIGHT_END_YEAR \"$year\"\n";
|
|
close(X);
|
|
|
|
# why perl....
|
|
use strict;
|
|
use warnings;
|
|
|
|
my $file = "contrib/linux/com.dosbox_x.DOSBox-X.metainfo.xml.in";
|
|
open FILE, $file or die "Can't read from $file!\n";
|
|
|
|
my @lines;
|
|
while (my $line = <FILE>) {
|
|
if ($line =~ /date=/) {
|
|
push @lines, (" <release version=\"\@PACKAGE_VERSION\@\" date=\"" . $year . "-" . $mon . "-" . $mday . "\"/>\n");
|
|
} elsif ($line =~ /<!-- Copyright/) {
|
|
push @lines, ("<!-- Copyright 2011-$year Jonathan Campbell -->\n");
|
|
} else {
|
|
push @lines, $line;
|
|
}
|
|
}
|
|
close FILE;
|
|
|
|
open FILE, '>', $file or die "Can't write to $file!\n";
|
|
print FILE @lines;
|
|
close FILE;
|