Whenever a tool like ld65 wants to output its name into a log file, it
uses the name of command-line parameter 0. However, this parameter also
includes the .exe suffix if it is on Windows.
This patch removes the .exe suffix, so that the output is clean and
consistent across platforms.
This fixes#1990.
GetProgPath() now resolves the path derived from argv[0] always
via realpath(3p) to its real location in the filesystem, and returns
the path including binary name, effectively making it work like
windows' GetModuleFileName(), so we can re-use the existing code
to strip the trailing binary name.
since symlinks are now always resolved, we no longer need the
special case code for linux to use /proc/self/exe for this purpose.
until now, the strings intended to be hardcoded into the binary,
such as directory names and build id, were passed unquoted, which
means they're interpreted by the preprocessor as C tokens, rather
than strings, which can result in all sorts of "interesting"
behaviour such as interpreting paths starting with // as C++-style
comment.
this was then worked around using a stringize macro which turned
the tokens into a string (if they happened to be in a compatible
format).
adresses #1726
src/common/inttypes.h is a shim to fix building cc65 on
non-C99-compliant compilers missing inttypes.h (like VS2012 and
earlier). The shim is actually incomplete and does not define the PRI...
macros supplied by the actual compiler headers. Since we're planning to
use those macros, delete this header so cc65's source files instead use
host-supplied inttypes.h containing macro definitions.
New commands:
.PUSHCHARMAP: will push the current charmap state into an internal stack
.POPCHARMAP: will restore the current charmap to the last pushed charmap
Details:
The push and pop facilities are implemented directly inside the tgttrans.h,
to facilitate its reuse on the C compiler.
I placed the Git tag V2.19 in hindsight at 555282497c. But I certainly don't want to rewrite the Git history just for the reported version, so I simply set the reported version at today's HEAD to 2.19.
When compiling cc65, it will by default place the git hash (if available) of
the checked out commit in the version string. This isn't useful when building
a package for a Linux distribution, since there either won't be an upstream
git hash if there is one at all.
Thus we replace GIT_SHA with a more versatile BUILD_ID, which can be defined
to any arbitrary string. When building, its contents will be appended to the
version string instead of the git hash.
If BUILD_ID is not defined by the user the behaviour will be exactly the same
as before. That means BUILD_ID gets automatically defined to Git <GIT_SHA>,
if it can be determined from a checkout.