Compare commits

...

3 Commits

Author SHA1 Message Date
Rangi
d961c697d7 Update libpng to 1.6.51 (#1862) 2025-11-22 19:05:52 -05:00
Rangi
1eb4eb3339 Reuse the usage.name for printing version info 2025-11-18 22:32:45 -05:00
Rangi
a3d3e1525a Fix RGBLINK object type detection 2025-11-18 22:01:43 -05:00
8 changed files with 28 additions and 27 deletions

View File

@@ -1,13 +1,13 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
pngver=1.6.50 pngver=1.6.51
## Grab sources and check them ## Grab sources and check them
curl -LOJ "http://prdownloads.sourceforge.net/libpng/libpng-$pngver.tar.xz?download" curl -LOJ "http://prdownloads.sourceforge.net/libpng/libpng-$pngver.tar.xz?download"
# Brew doesn't provide any sha256sum, so we're making do with `sha2` instead. # Brew doesn't provide any sha256sum, so we're making do with `sha2` instead.
if [ "$(sha2 -q -256 libpng-$pngver.tar.xz)" != 4df396518620a7aa3651443e87d1b2862e4e88cad135a8b93423e01706232307 ]; then if [ "$(sha2 -q -256 libpng-$pngver.tar.xz)" != a050a892d3b4a7bb010c3a95c7301e49656d72a64f1fc709a90b8aded192bed2 ]; then
sha2 -256 libpng-$pngver.tar.xz sha2 -256 libpng-$pngver.tar.xz
echo Checksum mismatch! Aborting. >&2 echo Checksum mismatch! Aborting. >&2
exit 1 exit 1

View File

@@ -16,8 +16,8 @@ function getlibrary ([string] $URI, [string] $filename, [string] $hash, [string]
} }
getlibrary 'https://www.zlib.net/zlib131.zip' 'zlib.zip' '72af66d44fcc14c22013b46b814d5d2514673dda3d115e64b690c1ad636e7b17' . getlibrary 'https://www.zlib.net/zlib131.zip' 'zlib.zip' '72af66d44fcc14c22013b46b814d5d2514673dda3d115e64b690c1ad636e7b17' .
getlibrary 'https://github.com/pnggroup/libpng/archive/refs/tags/v1.6.50.zip' 'libpng.zip' 'f6bb2544d2cf5465af3a695dee0b7eacff82f11a50aa4672ef0e19df6e16d455' . getlibrary 'https://github.com/pnggroup/libpng/archive/refs/tags/v1.6.51.zip' 'libpng.zip' 'd1e8544445152f5c71fc58d06067da80f3f642f268d2c3e1114a7f34fd739e32' .
getlibrary 'https://github.com/lexxmark/winflexbison/releases/download/v2.5.25/win_flex_bison-2.5.25.zip' 'winflexbison.zip' '8d324b62be33604b2c45ad1dd34ab93d722534448f55a16ca7292de32b6ac135' install_dir getlibrary 'https://github.com/lexxmark/winflexbison/releases/download/v2.5.25/win_flex_bison-2.5.25.zip' 'winflexbison.zip' '8d324b62be33604b2c45ad1dd34ab93d722534448f55a16ca7292de32b6ac135' install_dir
Move-Item zlib-1.3.1 zlib Move-Item zlib-1.3.1 zlib
Move-Item libpng-1.6.50 libpng Move-Item libpng-1.6.51 libpng

View File

@@ -1,13 +1,13 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
pngver=1.6.50 pngver=1.6.51
arch="$1" arch="$1"
## Grab sources and check them ## Grab sources and check them
wget http://downloads.sourceforge.net/project/libpng/libpng16/$pngver/libpng-$pngver.tar.xz wget http://downloads.sourceforge.net/project/libpng/libpng16/$pngver/libpng-$pngver.tar.xz
echo 4df396518620a7aa3651443e87d1b2862e4e88cad135a8b93423e01706232307 libpng-$pngver.tar.xz | sha256sum -c - echo a050a892d3b4a7bb010c3a95c7301e49656d72a64f1fc709a90b8aded192bed2 libpng-$pngver.tar.xz | sha256sum -c -
## Extract sources and patch them ## Extract sources and patch them

View File

@@ -296,7 +296,7 @@ static void parseArg(int ch, char *arg) {
// LCOV_EXCL_START // LCOV_EXCL_START
case 'V': case 'V':
printf("rgbasm %s\n", get_package_version_string()); printf("%s %s\n", usage.name.c_str(), get_package_version_string());
exit(0); exit(0);
case 'v': case 'v':
@@ -381,7 +381,7 @@ static void verboseOutputConfig() {
style_Set(stderr, STYLE_MAGENTA, false); style_Set(stderr, STYLE_MAGENTA, false);
fprintf(stderr, "rgbasm %s\n", get_package_version_string()); fprintf(stderr, "%s %s\n", usage.name.c_str(), get_package_version_string());
printVVVVVVerbosity(); printVVVVVVerbosity();

View File

@@ -252,7 +252,7 @@ static void parseArg(int ch, char *arg) {
// LCOV_EXCL_START // LCOV_EXCL_START
case 'V': case 'V':
printf("rgbfix %s\n", get_package_version_string()); printf("%s %s\n", usage.name.c_str(), get_package_version_string());
exit(0); exit(0);
case 'v': case 'v':

View File

@@ -409,7 +409,7 @@ static void parseArg(int ch, char *arg) {
// LCOV_EXCL_START // LCOV_EXCL_START
case 'V': case 'V':
printf("rgbgfx %s\n", get_package_version_string()); printf("%s %s\n", usage.name.c_str(), get_package_version_string());
exit(0); exit(0);
case 'v': case 'v':
@@ -481,7 +481,7 @@ static void verboseOutputConfig() {
style_Set(stderr, STYLE_MAGENTA, false); style_Set(stderr, STYLE_MAGENTA, false);
fprintf(stderr, "rgbgfx %s\n", get_package_version_string()); fprintf(stderr, "%s %s\n", usage.name.c_str(), get_package_version_string());
printVVVVVVerbosity(); printVVVVVVerbosity();

View File

@@ -283,7 +283,7 @@ static void parseArg(int ch, char *arg) {
// LCOV_EXCL_START // LCOV_EXCL_START
case 'V': case 'V':
printf("rgblink %s\n", get_package_version_string()); printf("%s %s\n", usage.name.c_str(), get_package_version_string());
exit(0); exit(0);
case 'v': case 'v':
@@ -330,7 +330,7 @@ static void verboseOutputConfig() {
style_Set(stderr, STYLE_MAGENTA, false); style_Set(stderr, STYLE_MAGENTA, false);
fprintf(stderr, "rgblink %s\n", get_package_version_string()); fprintf(stderr, "%s %s\n", usage.name.c_str(), get_package_version_string());
printVVVVVVerbosity(); printVVVVVVerbosity();

View File

@@ -420,19 +420,15 @@ void obj_ReadFile(std::string const &filePath, size_t fileID) {
} }
Defer closeFile{[&] { fclose(file); }}; Defer closeFile{[&] { fclose(file); }};
// First, check if the object is a RGBDS object or a SDCC one. If the first byte is 'R', // First, check if the object is a RGBDS object, a SDCC one, or neither.
// we'll assume it's a RGBDS object file, and otherwise, that it's a SDCC object file. // A single `ungetc` is guaranteed to work.
int c = getc(file); switch (ungetc(getc(file), file)) {
ungetc(c, file); // Guaranteed to work
switch (c) {
case EOF: case EOF:
fatal("File \"%s\" is empty!", fileName); fatal("File \"%s\" is empty!", fileName);
case 'R': case 'X':
break; case 'D':
case 'Q': {
default:
// This is (probably) a SDCC object file, defer the rest of detection to it. // This is (probably) a SDCC object file, defer the rest of detection to it.
// Since SDCC does not provide line info, everything will be reported as coming from the // Since SDCC does not provide line info, everything will be reported as coming from the
// object file. It's better than nothing. // object file. It's better than nothing.
@@ -450,11 +446,16 @@ void obj_ReadFile(std::string const &filePath, size_t fileID) {
return; return;
} }
// Begin by reading the magic bytes case 'R':
int matchedElems; // Check the magic byte signature for a RGB object file.
if (char magic[literal_strlen(RGBDS_OBJECT_VERSION_STRING)];
fread(magic, 1, sizeof(magic), file) == sizeof(magic)
&& !memcmp(magic, RGBDS_OBJECT_VERSION_STRING, sizeof(magic))) {
break;
}
[[fallthrough]];
if (fscanf(file, RGBDS_OBJECT_VERSION_STRING "%n", &matchedElems) == 1 default:
&& matchedElems != literal_strlen(RGBDS_OBJECT_VERSION_STRING)) {
fatal("%s: Not a RGBDS object file", fileName); fatal("%s: Not a RGBDS object file", fileName);
} }