Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions sys/src/ape/cmd/diff/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* config.h for diffutils on Plan9/APE */

/* Package info */
#define PACKAGE "diffutils"
#define PACKAGE_NAME "GNU diffutils"
#define PACKAGE_VERSION "3.10"
#define VERSION "3.10"

/* Standard POSIX/APE capabilities */
#define HAVE_FORK 1
#define HAVE_WORKING_FORK 1
#define HAVE_SIGACTION 1
#define HAVE_SIGINTERRUPT 1
#define HAVE_GETEUID 1
#define HAVE_GETUID 1

/* struct stat fields present on Plan9/APE */
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
#define HAVE_STRUCT_STAT_ST_RDEV 1
#undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
#define HAVE_STRUCT_DIRENT_D_TYPE 1
#define HAVE_TM_GMTOFF 1
Comment on lines +21 to +22

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The Plan 9 APE environment does not provide the d_type member in struct dirent (defined in <dirent.h>) nor the tm_gmtoff member in struct tm (defined in <time.h>). Defining these macros as 1 will cause compilation errors when the source code attempts to access these non-existent fields. These should be undefined for the APE port.

Suggested change
#define HAVE_STRUCT_DIRENT_D_TYPE 1
#define HAVE_TM_GMTOFF 1
#undef HAVE_STRUCT_DIRENT_D_TYPE
#undef HAVE_TM_GMTOFF


/* c-stack / sigsegv: we don't have stack overflow recovery */
#undef HAVE_GETRLIMIT
#undef HAVE_SIGALTSTACK
#undef HAVE_SIGSEGV_RECOVERY
#undef HAVE_STACKVMA
#undef HAVE_STACK_OVERFLOW_RECOVERY

/* locale */
#define LOCALEDIR "/sys/lib/ape/locale"
2 changes: 1 addition & 1 deletion sys/src/ape/cmd/diff/mkfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RPLS= -Drpl_malloc=malloc -Drpl_free=free -Drpl_getopt_long=getopt_long\
-Drpl_optarg=optarg -Drpl_optind=optind

CC=pcc -c
CFLAGS=-B -p -D_POSIX_SOURCE -DREGEX_MALLOC -I$DIFFSRC/src -I$DIFFSRC/lib \
CFLAGS=-B -p -D_POSIX_SOURCE -DREGEX_MALLOC -I. -I$DIFFSRC/src -I$DIFFSRC/lib \
-DHAVE_CONFIG_H -DDIFF_PROGRAM="/bin/diff" $RPLS\

%.$O: $DIFFSRC/src/%.c
Expand Down
29 changes: 29 additions & 0 deletions sys/src/ape/cmd/patch/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* config.h for GNU patch on Plan9/APE */

/* Package info */
#define PACKAGE "patch"
#define PACKAGE_NAME "GNU patch"
#define PACKAGE_VERSION "2.7.6"
#define VERSION "2.7.6"

/* Standard POSIX/APE capabilities */
#define HAVE_FORK 1
#define HAVE_WORKING_FORK 1
#define HAVE_SIGACTION 1
#define HAVE_SIGFILLSET 1
#define HAVE_GETEUID 1
#define HAVE_GETUID 1
#undef HAVE_SETMODE_DOS

/* c-stack: no stack overflow recovery on Plan9 */
#undef HAVE_GETRLIMIT
#undef HAVE_SIGALTSTACK
#undef HAVE_SIGSEGV_RECOVERY
#undef HAVE_STACKVMA
#undef HAVE_STACK_OVERFLOW_RECOVERY

/* Enable merge mode (passed via -DENABLE_MERGE in CFLAGS too) */
#define ENABLE_MERGE 1

/* locale */
#define LOCALEDIR "/sys/lib/ape/locale"
2 changes: 1 addition & 1 deletion sys/src/ape/cmd/patch/mkfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BIN=$APEXPROOT/$objtype/bin/ape

CC=pcc -c
CFLAGS=-B -p -D_POSIX_SOURCE \
-D_BSD_EXTENSION -I$PTCHSRC \
-D_BSD_EXTENSION -I. -I$PTCHSRC \
-I$PTCHSRC/src -I$PTCHSRC/lib \
-DHAVE_CONFIG_H -DENABLE_MERGE\
-Ded_PROGRAM="/bin/ed"\
Expand Down
Loading