serenity/Ports/alpine/patches/0002-Add-serenity-as-OS-type-in-Alpine.patch
Taj Morton 5941117739 Ports/alpine: Patch build system files that added Serenity support
Changes the strategy for building Alpine to patch the distribution build
system files (configure, pith/Makefile.in), instead of regenerating them
from scratch.
This reduces fragility of the port as it no longer depends on the build
system having a compatible version of the auto* tools installed.
Resolves SerenityOS/serenity#19891.
2023-07-10 13:16:20 +02:00

199 lines
6.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taj Morton <tajmorton@gmail.com>
Date: Mon, 28 Nov 2022 19:55:04 -0800
Subject: [PATCH] Add serenity as OS type in Alpine.
---
configure | 6 +++
imap/Makefile | 2 +-
imap/src/osdep/unix/Makefile | 9 +++++
imap/src/osdep/unix/os_serenity.c | 59 +++++++++++++++++++++++++++++
imap/src/osdep/unix/os_serenity.h | 62 +++++++++++++++++++++++++++++++
5 files changed, 137 insertions(+), 1 deletion(-)
create mode 100644 imap/src/osdep/unix/os_serenity.c
create mode 100644 imap/src/osdep/unix/os_serenity.h
diff --git a/configure b/configure
index 2c417775d04165f3272767b3eb1025cbbe0a2fe3..5b9085b6e69d9faf838cbb9b7c54693f25d8bb9c 100755
--- a/configure
+++ b/configure
@@ -19007,6 +19007,12 @@ $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
alpine_mode_readonly="(0600)"
alpine_c_client_target="neb"
;;
+ *-*-serenity*)
+ systype="SERENITY"
+ alpine_path_delim="/"
+ alpine_mode_readonly="(0600)"
+ alpine_c_client_target="serenity"
+ ;;
*-*-bsdi*)
systype="BSI"
alpine_path_delim="/"
diff --git a/imap/Makefile b/imap/Makefile
index d459ef3f1cd3fe0e8bb50f4e57c65aa05f312a50..213a58f908d70fdf74caed712a90926be4a739a5 100644
--- a/imap/Makefile
+++ b/imap/Makefile
@@ -310,7 +310,7 @@ SPECIALS:
# Note on SCO you may have to set LN to "ln".
-a32 a41 a52 aix bs3 bsi d-g d54 do4 drs epx ga4 gas gh9 ghp ghs go5 gsc gsg gso gul h11 hpp hpx lnp lyn mct mnt nec nto nxt nx3 osf os4 ptx qnx qn6 sc5 sco sgi sg6 shp sl4 sl5 slx snx soc sol sos uw2: an
+a32 a41 a52 aix bs3 bsi d-g d54 do4 drs epx ga4 gas gh9 ghp ghs go5 gsc gsg gso gul h11 hpp hpx lnp lyn mct mnt nec nto nxt nx3 osf os4 ptx qnx qn6 sc5 sco serenity sgi sg6 shp sl4 sl5 slx snx soc sol sos uw2: an
$(BUILD) BUILDTYPE=$@
# If you use sv4, you may find that it works to move it to use the an process.
diff --git a/imap/src/osdep/unix/Makefile b/imap/src/osdep/unix/Makefile
index 249d324c9da6b4af0a4a4e33cdbe5c10c46e91ac..c10c4965ca210e97ddfdb7bc324138427e205706 100644
--- a/imap/src/osdep/unix/Makefile
+++ b/imap/src/osdep/unix/Makefile
@@ -659,6 +659,15 @@ sco: # Santa Cruz Operation
BASELDFLAGS="-lsocket -lprot -lcrypt_i -lx -los" \
RANLIB=true LN=ln
+serenity:
+ $(BUILD) `$(CAT) SPECIALS` OS=$@ \
+ SIGTYPE=psx CHECKPW=psx CRXTYPE=nfs \
+ SPOOLDIR=/var/spool \
+ ACTIVEFILE=/var/lib/news/active \
+ RSHPATH=/usr/bin/rsh \
+ BASECFLAGS="$(GCCCFLAGS)" \
+ BASELDFLAGS="-lcrypt"
+
# Note: setting _POSIX_SOURCE doesn't seem to build it as of SGI IRIX 5.3
sgi: # Silicon Graphics
diff --git a/imap/src/osdep/unix/os_serenity.c b/imap/src/osdep/unix/os_serenity.c
new file mode 100644
index 0000000000000000000000000000000000000000..807cdcbc51b97706c352f01159ef3255eb38e0f9
--- /dev/null
+++ b/imap/src/osdep/unix/os_serenity.c
@@ -0,0 +1,59 @@
+/* ========================================================================
+ * Copyright 2022 Taj Morton
+ * ========================================================================
+ */
+
+/*
+ * Program: Operating-system dependent routines -- SerenityOS version
+ *
+ * Author: Taj Morton
+ *
+ * Date: 27 November 2022
+ * Last Edited: 27 Novemner 2022
+ *
+ * This file is based on content that is:
+ * Copyright 1988-2007 University of Washington
+ * Copyright 2008-2009 Mark Crispin
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+#include "tcp_unix.h" /* must be before osdep includes tcp.h */
+#include "mail.h"
+#include "osdep.h"
+#include <stdio.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <ctype.h>
+#include <errno.h>
+extern int errno; /* just in case */
+#include <pwd.h>
+#include "misc.h"
+
+/* Stub of BSD gethostid() function.
+ * Returns a unique identifier for this machine.
+ */
+long gethostid (void)
+{
+ /* Return placeholder value. */
+ return 0xdeadbeef;
+}
+
+#include "fs_unix.c"
+#include "ftl_unix.c"
+#include "nl_unix.c"
+#include "env_unix.c"
+#define fork vfork
+#include "tcp_unix.c"
+#include "gr_waitp.c"
+#include "tz_sv4.c"
+#include "utime.c"
diff --git a/imap/src/osdep/unix/os_serenity.h b/imap/src/osdep/unix/os_serenity.h
new file mode 100644
index 0000000000000000000000000000000000000000..a1284105d9a25e9efe8b46e1440352e52df15928
--- /dev/null
+++ b/imap/src/osdep/unix/os_serenity.h
@@ -0,0 +1,62 @@
+/* ========================================================================
+ * Copyright 2022 Taj Morton
+ * ========================================================================
+ */
+
+/*
+ * Program: Operating-system dependent routines -- SerenityOS version
+ *
+ * Author: Taj Morton
+ *
+ * Date: 27 November 2022
+ * Last Edited: 27 Novemner 2022
+ *
+ * This file is based on content that is:
+ * Copyright 1988-2007 University of Washington
+ * Copyright 2008-2009 Mark Crispin
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <syslog.h>
+#include <shadow.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <utime.h>
+#include <sys/select.h>
+#include <sys/file.h>
+#include <LibCrypt/crypt.h> /* crypt() prototype is here. */
+
+#define FNDELAY O_NONBLOCK
+#define setpgrp setpgid
+#define direct dirent
+
+#define L_SET SEEK_SET
+#define L_INCR SEEK_CUR
+#define L_XTND SEEK_END
+
+#ifndef htons
+#include <netinet/in.h> /* htons() prototypes are here. */
+#endif
+
+#ifndef gethostid
+long gethostid (void); /* Stub for function not yet implemented in libc. */
+#endif
+
+#define utime portable_utime
+int portable_utime (char *file, time_t timep[2]);
+
+#include "env_unix.h"
+#include "fs.h"
+#include "ftl.h"
+#include "nl.h"
+#include "tcp.h"