summaryrefslogtreecommitdiff
path: root/Ports/alpine
diff options
context:
space:
mode:
authorTaj Morton <tajmorton@gmail.com>2022-11-27 17:49:01 -0800
committerLinus Groh <mail@linusgroh.de>2022-12-03 22:12:13 +0000
commit14baf35441681263363d1b713d955f7f8cc6d05f (patch)
tree0151506432afd17686565185134ca90b28b31179 /Ports/alpine
parent69f41eb062bf2c3ca4495201915a3b660ea73df5 (diff)
downloadserenity-14baf35441681263363d1b713d955f7f8cc6d05f.zip
Ports/alpine: Add patches to build Alpine on Serenity
Diffstat (limited to 'Ports/alpine')
-rwxr-xr-xPorts/alpine/package.sh64
-rw-r--r--Ports/alpine/patches/0001-Compiler-helpers-for-build-system-not-host.patch32
-rw-r--r--Ports/alpine/patches/0002-Add-serenity-as-OS-type-in-Alpine.patch198
-rw-r--r--Ports/alpine/patches/0003-Add-Alpine-system-configuration-file-that-specifies-.patch32
-rw-r--r--Ports/alpine/patches/ReadMe.md30
5 files changed, 356 insertions, 0 deletions
diff --git a/Ports/alpine/package.sh b/Ports/alpine/package.sh
new file mode 100755
index 0000000000..ffa0d03280
--- /dev/null
+++ b/Ports/alpine/package.sh
@@ -0,0 +1,64 @@
+#!/usr/bin/env -S bash ../.port_include.sh
+port='alpine'
+version='2.26'
+useconfigure='true'
+configopts=(
+ '--disable-static'
+ '--enable-shared'
+)
+use_fresh_config_sub='true'
+use_fresh_config_guess='true'
+files="https://alpineapp.email/alpine/release/src/alpine-2.26.tar.xz alpine-${version}.tar.xz c0779c2be6c47d30554854a3e14ef5e36539502b331068851329275898a9baba"
+auth_type='sha256'
+depends=(
+ 'openssl'
+ 'ncurses'
+ 'ca-certificates'
+)
+launcher_name='Alpine'
+launcher_category='Internet'
+launcher_command='/usr/local/bin/alpine'
+launcher_run_in_terminal='true'
+icon_file='web/cgi/favicon.ico'
+
+pre_configure() {
+ # Rebuild after patching configure.ac to support serenity host.
+
+ # `automake` may exit with a warning about how there is a mismatch
+ # between the versions of autoconf and automake that were previously
+ # used to generate aclocal and specifed in configure.ac.
+ # We just need `automake` to generate `./compile` (so that we can run
+ # autoreconf to regenerate everything).
+ run automake --add-missing || true
+ run autoreconf
+}
+
+configure() {
+ run ./"$configscript" \
+ "${configopts[@]}" \
+ --host="${SERENITY_ARCH}-pc-serenity" \
+ --build="$($workdir/config.guess)" \
+ --with-ssl-lib-dir="${SERENITY_INSTALL_ROOT}/usr/local/lib" \
+ --with-include-path="${SERENITY_INSTALL_ROOT}/usr/local/include:${SERENITY_INSTALL_ROOT}/usr/local/include/openssl" \
+ --with-system-pinerc='/etc/pine.conf' \
+ --with-system-fixed-pinerc='/etc/pine.conf.fixed'
+}
+
+install() {
+ run make DESTDIR="$DESTDIR" "${installopts[@]}" install
+ # Install system configuration file that tells Alpine where to find CA certificates
+ # installed from the `ca-certificates` package.
+ # (The full `/usr/bin/install` path is used because `install()` is a function within this script.)
+ run /usr/bin/install \
+ --mode=644 \
+ --no-target-directory \
+ -D \
+ pine-system.serenity.conf "${SERENITY_INSTALL_ROOT}/etc/pine.conf"
+}
+
+post_install() {
+ echo "==== Post Installation Instructions ===="
+ echo "To save account passwords, create an empty file named .alpine.pwd"
+ echo "in your home diretory:"
+ echo " touch ~/.alpine.pwd"
+}
diff --git a/Ports/alpine/patches/0001-Compiler-helpers-for-build-system-not-host.patch b/Ports/alpine/patches/0001-Compiler-helpers-for-build-system-not-host.patch
new file mode 100644
index 0000000000..5ffc02d9ee
--- /dev/null
+++ b/Ports/alpine/patches/0001-Compiler-helpers-for-build-system-not-host.patch
@@ -0,0 +1,32 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Taj Morton <tajmorton@gmail.com>
+Date: Sun, 27 Nov 2022 16:27:48 -0800
+Subject: [PATCH] Compiler helpers for build system, not host.
+
+---
+ pith/Makefile.am | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/pith/Makefile.am b/pith/Makefile.am
+index 748b9ececd2b7e120a0bc25b1e949788bf55fc06..bfee7cce61e1a5b589aa153038064563d8f94220 100644
+--- a/pith/Makefile.am
++++ b/pith/Makefile.am
+@@ -30,12 +30,12 @@ libpith_a_SOURCES = ablookup.c abdlc.c addrbook.c addrstring.c adrbklib.c bldadd
+ state.c status.c store.c stream.c string.c strlst.c takeaddr.c tempfile.c text.c \
+ thread.c adjtime.c url.c util.c helptext.c smkeys.c smime.c
+
+-help_c_gen$(EXEEXT): $(help_c_gen_OBJECTS) $(help_c_gen_DEPENDENCIES)
+- @rm -f help_c_gen$(EXEEXT)
+- $(LINK) $(help_c_gen_OBJECTS) $(help_c_gen_LDADD)
+-help_h_gen$(EXEEXT): $(help_h_gen_OBJECTS) $(help_h_gen_DEPENDENCIES)
+- @rm -f help_h_gen$(EXEEXT)
+- $(LINK) $(help_h_gen_OBJECTS) $(help_h_gen_LDADD)
++help_c_gen$(BUILD_EXEEXT): help_c_gen.c
++ @rm -f help_c_gen$(BUILD_EXEEXT)
++ $(CC_FOR_BUILD) help_c_gen.c -o help_c_gen$(BUILD_EXEEXT)
++help_h_gen$(BUILD_EXEEXT):
++ @rm -f help_h_gen$(BUILD_EXEEXT)
++ $(CC_FOR_BUILD) help_h_gen.c -o help_h_gen$(BUILD_EXEEXT)
+
+ helptext.c: help_c_gen pine.hlp
+ ./help_c_gen < pine.hlp > $@
diff --git a/Ports/alpine/patches/0002-Add-serenity-as-OS-type-in-Alpine.patch b/Ports/alpine/patches/0002-Add-serenity-as-OS-type-in-Alpine.patch
new file mode 100644
index 0000000000..95a1baf8f5
--- /dev/null
+++ b/Ports/alpine/patches/0002-Add-serenity-as-OS-type-in-Alpine.patch
@@ -0,0 +1,198 @@
+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.ac | 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.ac b/configure.ac
+index 4fa94f16078daf6187131177b4153845fc0f2bce..1d899fa29ffb698a396a5756e707a51f20367679 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1289,6 +1289,12 @@ case "$host" in
+ 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"
diff --git a/Ports/alpine/patches/0003-Add-Alpine-system-configuration-file-that-specifies-.patch b/Ports/alpine/patches/0003-Add-Alpine-system-configuration-file-that-specifies-.patch
new file mode 100644
index 0000000000..37e5087630
--- /dev/null
+++ b/Ports/alpine/patches/0003-Add-Alpine-system-configuration-file-that-specifies-.patch
@@ -0,0 +1,32 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Taj Morton <tajmorton@gmail.com>
+Date: Sat, 3 Dec 2022 08:46:22 -0800
+Subject: [PATCH] Add Alpine system configuration file that specifies location
+ of CA certificates.
+
+The system-certs-file configuration option is provided to
+SSL_CTX_load_verify_locations() as the CAfile argument (via
+imap/src/osdep/unix/ssl_unix.c).
+
+system-certs-file and CAfile are used (as opposed to
+system-certs-path and CApath, used to specify a directory)
+because certificate files within the CApath directory must follow a
+specific naming convention, where the filename matches the CA subject
+name hash value.
+
+See man 3 SSL_CTX_set_default_verify_paths for details on how OpenSSL
+looks up CA certificates.
+https://www.openssl.org/docs/man3.0/man3/SSL_CTX_set_default_verify_paths.html
+---
+ pine-system.serenity.conf | 2 ++
+ 1 file changed, 2 insertions(+)
+ create mode 100644 pine-system.serenity.conf
+
+diff --git a/pine-system.serenity.conf b/pine-system.serenity.conf
+new file mode 100644
+index 0000000000000000000000000000000000000000..c20b30eeebdfa2e539663ae96bf4917f0824c3fe
+--- /dev/null
++++ b/pine-system.serenity.conf
+@@ -0,0 +1,2 @@
++system-certs-file = /etc/ssl/certs/ca-certificates.crt
++
diff --git a/Ports/alpine/patches/ReadMe.md b/Ports/alpine/patches/ReadMe.md
new file mode 100644
index 0000000000..c3998a2f90
--- /dev/null
+++ b/Ports/alpine/patches/ReadMe.md
@@ -0,0 +1,30 @@
+# Patches for alpine on SerenityOS
+
+## `0001-Compiler-helpers-for-build-system-not-host.patch`
+
+Compiler helpers for build system, not host.
+
+
+## `0002-Add-serenity-as-OS-type-in-Alpine.patch`
+
+Add serenity as OS type in Alpine.
+
+
+## `0003-Add-Alpine-system-configuration-file-that-specifies-.patch`
+
+Add Alpine system configuration file that specifies location of CA certificates.
+
+The system-certs-file configuration option is provided to
+SSL_CTX_load_verify_locations() as the CAfile argument (via
+imap/src/osdep/unix/ssl_unix.c).
+
+system-certs-file and CAfile are used (as opposed to
+system-certs-path and CApath, used to specify a directory)
+because certificate files within the CApath directory must follow a
+specific naming convention, where the filename matches the CA subject
+name hash value.
+
+See man 3 SSL_CTX_set_default_verify_paths for details on how OpenSSL
+looks up CA certificates.
+https://www.openssl.org/docs/man3.0/man3/SSL_CTX_set_default_verify_paths.html
+