diff options
author | Fabian Dellwing <fabian.dellwing@gmail.com> | 2023-04-25 19:59:27 +0200 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-04-30 19:23:08 +0200 |
commit | 8f34478e7505fd5991aeda201ba4952c1639a4d3 (patch) | |
tree | bc00fcf5214693b6360358572849be478a29f95c /Ports | |
parent | 1951f7874dc8792d427d053da1fb92dfc4aadde1 (diff) | |
download | serenity-8f34478e7505fd5991aeda201ba4952c1639a4d3.zip |
Ports: Add ssmtp port
Diffstat (limited to 'Ports')
7 files changed, 184 insertions, 0 deletions
diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 72be0ae579..b1ed71f4b1 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -259,6 +259,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`sparsehash`](sparsehash/) | Google's C++ associative containers | 2.0.4 | https://github.com/sparsehash/sparsehash | | [`speexdsp`](speexdsp/) | Speex audio processing library | 1.2.1 | https://www.speex.org/ | | [`sqlite`](sqlite/) | SQLite | 3410200 | https://www.sqlite.org/ | +| [`ssmtp`](ssmtp/) | sSMTP is a simple MTA | 2.64-11 | https://wiki.debian.org/sSMTP | | [`stb`](stb/) | stb single-file public domain libraries for C/C++ | af1a5bc | https://github.com/nothings/stb | | [`stockfish`](stockfish/) | Stockfish: A free and strong UCI chess engine | 15.1 | https://github.com/official-stockfish/Stockfish | | [`stpuzzles`](stpuzzles/) | Simon Tatham's Portable Puzzle Collection | | https://www.chiark.greenend.org.uk/~sgtatham/puzzles/ | diff --git a/Ports/ssmtp/package.sh b/Ports/ssmtp/package.sh new file mode 100755 index 0000000000..621974e9e4 --- /dev/null +++ b/Ports/ssmtp/package.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env -S bash ../.port_include.sh +port='ssmtp' +version='2.64-11' +files="https://salsa.debian.org/debian/ssmtp/-/archive/debian/${version}/ssmtp-debian-${version}.tar.gz ssmtp-debian-${version}.tar.gz 82abe0fb54e2ee209e9f8745498ce5f4e35f2f2b1bf95bd5e6dfbcfc61a8ebe2" +auth_type='sha256' +useconfigure='true' +workdir="ssmtp-debian-${version}" +configopts=( + '--enable-ssl' + '--enable-md5auth' + "--prefix=${SERENITY_INSTALL_ROOT}/usr/local" +) +depends=('openssl') + +pre_patch() { + # Debian released multiple patches that fix issues with ssmtp. But they also decided to replace openssl with gnutls for internal licencing reasons. + # As we have a stable openssl port and no stable gnutls port, we skip that patch. + run perl -n -i -e '/01-374327-use-gnutls.patch/ or print' debian/patches/series + # We will also skip the solaris patch as it messes with `generate_config` we already messed with :^) + run perl -n -i -e '/02-557725-solaris.patch/ or print' debian/patches/series + run bash -c 'while IFS= read -r line; do git apply debian/patches/$line || true; done < debian/patches/series' +} + +pre_configure() { + run_replace_in_file 's#$LIBS -lssl"#$LIBS -lssl -lcrypto --library '"${SERENITY_INSTALL_ROOT}"'/usr/local/lib/"#' configure +} diff --git a/Ports/ssmtp/patches/0001-Remove-_GNU_SOURCE-as-we-are-not-GNU.-With-it-we-seg.patch b/Ports/ssmtp/patches/0001-Remove-_GNU_SOURCE-as-we-are-not-GNU.-With-it-we-seg.patch new file mode 100644 index 0000000000..0a2809344a --- /dev/null +++ b/Ports/ssmtp/patches/0001-Remove-_GNU_SOURCE-as-we-are-not-GNU.-With-it-we-seg.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fabian Dellwing <fabian.dellwing@gmail.com> +Date: Tue, 25 Apr 2023 15:35:52 +0200 +Subject: [PATCH] Remove `_GNU_SOURCE` as we are not GNU. With it we segfault + after calling `basename()`. + +--- + ssmtp.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/ssmtp.c b/ssmtp.c +index af4d1e58d28fa9450bfc6a80fbacc75ca28c2220..985858f42420a11f3a78ec8f8c281091e17fdc54 100644 +--- a/ssmtp.c ++++ b/ssmtp.c +@@ -11,7 +11,6 @@ + + */ + #define VERSION "2.64" +-#define _GNU_SOURCE + + #include <sys/socket.h> + #include <netinet/in.h> diff --git a/Ports/ssmtp/patches/0002-We-dont-have-u_int32_t-but-do-have-uint32_t-so-we-ty.patch b/Ports/ssmtp/patches/0002-We-dont-have-u_int32_t-but-do-have-uint32_t-so-we-ty.patch new file mode 100644 index 0000000000..3b27aa9328 --- /dev/null +++ b/Ports/ssmtp/patches/0002-We-dont-have-u_int32_t-but-do-have-uint32_t-so-we-ty.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fabian Dellwing <fabian.dellwing@gmail.com> +Date: Tue, 25 Apr 2023 15:37:42 +0200 +Subject: [PATCH] We dont have `u_int32_t` but do have `uint32_t`, so we + typedef to build successfull. + +--- + md5auth/md5.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/md5auth/md5.h b/md5auth/md5.h +index 0f4d73e6d151c08dfd538b3e50b86cf4b0fd4c5d..bc82cd525c3123f8a7a65ed183611af798503f7b 100644 +--- a/md5auth/md5.h ++++ b/md5auth/md5.h +@@ -23,6 +23,8 @@ These notices must be retained in any copies of any part of this + documentation and/or software. + */ + ++typedef uint32_t u_int32_t; ++ + /* MD5 context. */ + typedef struct { + u_int32_t state[4]; /* state (ABCD) */ diff --git a/Ports/ssmtp/patches/0003-Hardcode-paths-to-two-files-that-will-be-compiled-in.patch b/Ports/ssmtp/patches/0003-Hardcode-paths-to-two-files-that-will-be-compiled-in.patch new file mode 100644 index 0000000000..22cf31ca45 --- /dev/null +++ b/Ports/ssmtp/patches/0003-Hardcode-paths-to-two-files-that-will-be-compiled-in.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fabian Dellwing <fabian.dellwing@gmail.com> +Date: Tue, 25 Apr 2023 19:18:45 +0200 +Subject: [PATCH] Hardcode paths to two files that will be compiled inside the + binary. Otherwise it gets compiled with the hosts build path prepended. + +--- + Makefile.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index f0aff41a5dc710173ea30dce9b38c4ec49c7b76c..30c666f4e7ba6d55d08a0b067a7290d449eb85c5 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -32,8 +32,8 @@ INSTALL=@INSTALL@ + + EXTRADEFS=\ + -DSSMTPCONFDIR=\"$(SSMTPCONFDIR)\" \ +--DCONFIGURATION_FILE=\"$(CONFIGURATION_FILE)\" \ +--DREVALIASES_FILE=\"$(REVALIASES_FILE)\" \ ++-DCONFIGURATION_FILE=\"/usr/local/etc/ssmtp/ssmtp.conf\" \ ++-DREVALIASES_FILE=\"/usr/local/etc/ssmtp/revaliases\" \ + + + CFLAGS=@DEFS@ $(EXTRADEFS) @CFLAGS@ diff --git a/Ports/ssmtp/patches/0004-Use-generic-default-configuration.patch b/Ports/ssmtp/patches/0004-Use-generic-default-configuration.patch new file mode 100644 index 0000000000..135c94d8e5 --- /dev/null +++ b/Ports/ssmtp/patches/0004-Use-generic-default-configuration.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fabian Dellwing <fabian.dellwing@gmail.com> +Date: Fri, 28 Apr 2023 07:43:47 +0200 +Subject: [PATCH] Use generic default configuration + +Make the installation fully non-interactive and create a sane +default ssmtp.conf +--- + generate_config | 37 ++----------------------------------- + 1 file changed, 2 insertions(+), 35 deletions(-) + +diff --git a/generate_config b/generate_config +index a16efd46b88829a987935be2f1a920416aa19599..d09cd177d3a4c057d93e96d225a12fee4a2b9026 100755 +--- a/generate_config ++++ b/generate_config +@@ -1,37 +1,4 @@ +-#!/bin/sh -e +- +-# +-# Figure out the system's mailname +-# +- +-syshostname=`hostname --fqdn` +-if test -f /etc/mailname +-then +- mailname="`head -1 /etc/mailname`" +-fi +- +-if test -z "$mailname" +-then +- mailname=$syshostname +-fi +- +-echo "Please enter the mail name of your system." +-echo "This is the hostname portion of the address to be shown" +-echo "on outgoing news and mail messages headers." +-echo "The default is $syshostname, your system's host name." +-echo +-echo -n "Mail name [$syshostname]: " +-read mailname +-echo +- +-echo -n "Please enter the SMTP port number [25]: " +-read smtpport +-if test -z "$smtpport" +-then +- mailhub=$mailhub +-else +- mailhub="$mailhub:$smtpport" +-fi ++#!/bin/bash -e + + # + # Generate configuration file +@@ -56,7 +23,7 @@ mailhub=mail + # Where will the mail seem to come from? + #rewriteDomain=`echo -n $mailname` + # The full hostname +-hostname=`hostname --fqdn` ++hostname=courage + EOF + + echo diff --git a/Ports/ssmtp/patches/ReadMe.md b/Ports/ssmtp/patches/ReadMe.md new file mode 100644 index 0000000000..2d4e2c9e3d --- /dev/null +++ b/Ports/ssmtp/patches/ReadMe.md @@ -0,0 +1,24 @@ +# Patches for ssmtp on SerenityOS + +## `0001-Remove-_GNU_SOURCE-as-we-are-not-GNU.-With-it-we-seg.patch` + +Remove `_GNU_SOURCE` as we are not GNU. With it we segfault after calling `basename()`. + + +## `0002-We-dont-have-u_int32_t-but-do-have-uint32_t-so-we-ty.patch` + +We dont have `u_int32_t` but do have `uint32_t`, so we typedef to build successfull. + + +## `0003-Hardcode-paths-to-two-files-that-will-be-compiled-in.patch` + +Hardcode paths to two files that will be compiled inside the binary. Otherwise it gets compiled with the hosts build path prepended. + + +## `0004-Use-generic-default-configuration.patch` + +Use generic default configuration + +Make the installation fully non-interactive and create a sane +default ssmtp.conf + |