musl libc build, rather than glibc
We've had reports of a couple of issues building against musl libc.
Issues reported:
- build procedures utilize cat for Guidebook-creation, and cat
is deprecated in distros that use musl libc.
- some of the CRASHREPORT code is using library functions that
are not available in the musl libc environment. The reported
functions were backtrace() and backtrace_symbols(), which use
header file /usr/include/execinfo.h.
So we'll try to accommodate this. Since we don't have a means of
autodetecting the musl libc situation during the build (as of yet), the
builder will have to specify 'make musl=1' on the make command line.
Specifying 'musl=1' on the make command line will:
1. ensure that NOCRASHREPORT gets defined in the C preprocessor.
2. set COLCMD to be '../util/stripbs' instead of 'col -bx'.
Closes #1393
This commit is contained in:
1
util/.gitignore
vendored
1
util/.gitignore
vendored
@@ -11,6 +11,7 @@ lev_comp
|
||||
dlb
|
||||
dlb_main
|
||||
recover
|
||||
stripbs
|
||||
tilemap
|
||||
tileedit
|
||||
tile2x11
|
||||
|
||||
42
util/stripbs.c
Normal file
42
util/stripbs.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/* NetHack 3.7 stripbs.c */
|
||||
/* Copyright (c) Michael Allison, 2025. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
/*
|
||||
* a simple filter to strip character-backspace-character
|
||||
* from stdin and write the results to stdout.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int stop = 0, trouble = 0;
|
||||
char buf[2];
|
||||
char *cp = &buf[0], *prev = &buf[1];
|
||||
|
||||
*prev = 0;
|
||||
while (!stop) {
|
||||
if ((fread(buf, 1, 1, stdin)) > 0) {
|
||||
if (*cp == 8) {
|
||||
*prev = 0;
|
||||
} else {
|
||||
if (*prev)
|
||||
fputc(*prev, stdout);
|
||||
*prev = *cp;
|
||||
}
|
||||
} else {
|
||||
if (errno != EOF)
|
||||
trouble = 1;
|
||||
if (*prev)
|
||||
fputc(*prev, stdout);
|
||||
stop = 1;
|
||||
}
|
||||
}
|
||||
fflush(stdout);
|
||||
fclose(stdout);
|
||||
return trouble ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user