-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add version information file. Info is printed when `--version` is passed * Fix Mac (?) * Use malloc,strcpy instead of badly-supported strdup * --always * fix issue because of merge * fix mac * fix shadow warning * Set date when building * Use actions/checkout v4 * fetch-tags * Use fetch-depth since fetch-tags didn't work * remove brackets * Update version_info.c Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com> * Update version_info.c Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com> * Update version_info.c Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com> * Update version_info.c Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com> * review * filter out NCC * Update .github/workflows/build.yml Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> --------- Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com> Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com> Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
- Loading branch information
1 parent
c4d24ce
commit 48b3c00
Showing
4 changed files
with
114 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* Function that prints version info. This file should be compiled with the following defined: | ||
* - PACKAGE_VERSION, e.g. with `-DPACKAGE_VERSION="\"$(LC_ALL=C git --git-dir .git describe --tags --dirty)\""` | ||
* - DATETIME, e.g. with `-DDATETIME="\"$(date +'%F %T UTC%z')\""` | ||
* | ||
* The code in this file is mostly taken from | ||
* - CPython: https://github.com/python/cpython/, licensed under the PSF, available here: https://docs.python.org/3/license.html | ||
* - The Ocarina of Time practice rom, gz: https://github.com/glankk/gz/ | ||
*/ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <libgen.h> | ||
|
||
#if defined(IDO53) | ||
#define IDO_VERSION "IDO 5.3" | ||
#elif defined(IDO71) | ||
#define IDO_VERSION "IDO 7.1" | ||
#else | ||
#define IDO_VERSION "" | ||
#endif | ||
|
||
#ifndef COMPILER | ||
|
||
// Note the __clang__ conditional has to come before the __GNUC__ one because | ||
// clang pretends to be GCC. | ||
#if defined(__clang__) | ||
#define COMPILER "Clang " __clang_version__ | ||
#elif defined(__GNUC__) | ||
#define COMPILER "GCC " __VERSION__ | ||
// Generic fallbacks. | ||
#elif defined(__cplusplus) | ||
#define COMPILER "C++" | ||
#else | ||
#define COMPILER "C" | ||
#endif | ||
|
||
#endif /* !COMPILER */ | ||
|
||
/* git */ | ||
#ifndef PACKAGE_VERSION | ||
#define PACKAGE_VERSION "Unknown version" | ||
#endif | ||
|
||
/* Date and time */ | ||
#ifndef DATETIME | ||
#define DATETIME "Unknown date" | ||
#endif | ||
|
||
extern char* progname; | ||
|
||
void print_version_info(void) { | ||
char* buf = malloc(strlen(progname) + 1); | ||
strcpy(buf, progname); | ||
char* name = basename(buf); | ||
|
||
printf("%s `%s` static recompilation, Decompals version\n", IDO_VERSION, name); | ||
printf("Source: https://github.com/decompals/ido-static-recomp\n"); | ||
printf("Version: %s\n", PACKAGE_VERSION); | ||
printf("Build date: %s\n", DATETIME); | ||
printf("Compiler: %s\n", COMPILER); | ||
|
||
free(buf); | ||
} |