aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2017-09-20 09:48:32 +0200
committerCarlo Landmeter <clandmeter@gmail.com>2017-09-20 09:48:37 +0200
commit051d004769a15c00bf368d44475c16c2cb0966cd (patch)
tree2fa9b8c645ce737f95ff7e42a6912a1be217825b /main
parent67566773d498d1209b1f3c09cd1e268b16753712 (diff)
downloadaports-051d004769a15c00bf368d44475c16c2cb0966cd.tar.bz2
aports-051d004769a15c00bf368d44475c16c2cb0966cd.tar.xz
main/libmilter: moved from community due to clamav
Diffstat (limited to 'main')
-rw-r--r--main/libmilter/APKBUILD66
-rw-r--r--main/libmilter/default-pthread-stacksize.patch42
-rw-r--r--main/libmilter/libmilter-sharedlib.patch55
3 files changed, 163 insertions, 0 deletions
diff --git a/main/libmilter/APKBUILD b/main/libmilter/APKBUILD
new file mode 100644
index 0000000000..e4ffa3577c
--- /dev/null
+++ b/main/libmilter/APKBUILD
@@ -0,0 +1,66 @@
+# Maintainer: Valery Kartel <valery.kartel@gmail.com>
+# Contributor: Valery Kartel <valery.kartel@gmail.com>
+# Contributor: Stefan Wagner <stw@bit-strickerei.de>
+pkgname=libmilter
+_pkgname=sendmail
+# This library is part of sendmail, but it does not share the version number with it.
+# In order to find the right libmilter version number, check SMFI_VERSION definition
+# that can be found in ${S}/include/libmilter/mfapi.h (see also SM_LM_VRS_* defines).
+# For example, version 1.0.1 has a SMFI_VERSION of 0x01000001.
+pkgver=1.0.2
+_pkgver=8.15.2
+pkgrel=5
+pkgdesc="Sendmail Mail Filter API (Milter)"
+url="http://www.sendmail.com/sm/open_source"
+arch="all"
+license="custom"
+makedepends="m4 linux-headers bsd-compat-headers"
+subpackages="$pkgname-dev $pkgname-doc"
+source="ftp://ftp.sendmail.org/pub/$_pkgname/$_pkgname.$_pkgver.tar.gz
+ libmilter-sharedlib.patch
+ default-pthread-stacksize.patch"
+builddir="$srcdir/$_pkgname-$_pkgver"
+
+prepare() {
+ default_prepare || return 1
+
+ cd "$builddir"
+ cat >> devtools/Site/site.config.m4 <<-EOF
+ dnl enable ipv6
+ APPENDDEF(\`conf_libmilter_ENVDEF',\`-DNETINET6=1')
+ dnl getipnodebyname/getipnodebyaddr is deprecated and not part of musl libc
+ APPENDDEF(\`conf_libmilter_ENVDEF',\`-DNEEDSGETIPNODE=1')
+ EOF
+}
+
+build() {
+ cd "$builddir"
+ make -j1 -C libmilter MILTER_SOVER=$pkgver
+}
+
+package() {
+ cd "$builddir"
+
+ mkdir -p "$pkgdir"/usr/lib
+ make -j1 -C libmilter \
+ INCOWN=root INCGRP=root INCMODE=644 \
+ LIBOWN=root LIBGRP=root LIBMODE=644 UBINMODE=755 \
+ MILTER_SOVER=$pkgver \
+ DESTDIR="$pkgdir" \
+ install || return 1
+
+ install -m 644 -D libmilter/README \
+ "$pkgdir"/usr/share/doc/$pkgname/README || return 1
+ cp -r libmilter/docs "$pkgdir"/usr/share/doc/$pkgname/ || return 1
+ install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/license
+}
+
+md5sums="a824fa7dea4d3341efb6462ccd816f00 sendmail.8.15.2.tar.gz
+49558fc2c9e38f433e0dc64d76705c05 libmilter-sharedlib.patch
+c1aa7f5db24f0d8cd19f6b71f2c23695 default-pthread-stacksize.patch"
+sha256sums="24f94b5fd76705f15897a78932a5f2439a32b1a2fdc35769bb1a5f5d9b4db439 sendmail.8.15.2.tar.gz
+3a753b0881fe622814b471ee5f9037905c7cc3ed08ef74908464ab5307e59d5a libmilter-sharedlib.patch
+d04f6f653c64857843f84a76991cdc3cbbff84093e43cc0baf5485b2f726056c default-pthread-stacksize.patch"
+sha512sums="04feb37316c13b66b1518596507a7da7c16cb0bf1abf10367f7fd888a428fadb093a9efa55342fa55b936c3f0cbdc63b9e2505cd99201a69a0c05b8ad65f49f9 sendmail.8.15.2.tar.gz
+31c36b57739946c1b9c7c85307fe5c53c45d7f8cbf427a0f2248db8b74871a6f5a30ef1af524915821aeca54310d28272bcd0a587cb918192214fa5c30e4a8da libmilter-sharedlib.patch
+d3e12943fe7e9babdf700a2d8c0229bc16fa2ea16097615600341dee13f137b157ffa4b03f76c92ba9c5552ca3bf01cb598f6a6201720408df3a37247001a219 default-pthread-stacksize.patch"
diff --git a/main/libmilter/default-pthread-stacksize.patch b/main/libmilter/default-pthread-stacksize.patch
new file mode 100644
index 0000000000..9993adfece
--- /dev/null
+++ b/main/libmilter/default-pthread-stacksize.patch
@@ -0,0 +1,42 @@
+Set default pthread stack size to 256 KB
+
+This patch tries to fix various crashes for applications depending on libmilter
+by setting the stack size for pthreads to 256 KB. The default stack size for
+musl libc is set to 80 KB whereas glibc has it set to 8 MB. This causes problems
+when a large amount of memory is allocated on the stack.
+
+For example, opendkim allocates blocks of 64 KB multiple times, which causes
+libmilter (and therefore opendkim) to crash. For now, a stack size of 256 KB
+looks sufficient and makes opendkim stop crashing.
+
+Fixes https://bugs.alpinelinux.org/issues/6360
+
+--- a/libmilter/libmilter.h
++++ b/libmilter/libmilter.h
+@@ -127,10 +127,10 @@
+ # define MI_SOCK_READ(s, b, l) read(s, b, l)
+ # define MI_SOCK_READ_FAIL(x) ((x) < 0)
+ # define MI_SOCK_WRITE(s, b, l) write(s, b, l)
+-
+-# define thread_create(ptid,wr,arg) pthread_create(ptid, NULL, wr, arg)
+ # define sthread_get_id() pthread_self()
+
++extern int thread_create(pthread_t *ptid, void *(*wr) (void *), void *arg);
++
+ typedef pthread_mutex_t smutex_t;
+ # define smutex_init(mp) (pthread_mutex_init(mp, NULL) == 0)
+ # define smutex_destroy(mp) (pthread_mutex_destroy(mp) == 0)
+--- a/libmilter/main.c
++++ b/libmilter/main.c
+@@ -16,6 +16,12 @@
+ #include <fcntl.h>
+ #include <sys/stat.h>
+
++int thread_create(pthread_t *ptid, void *(*wr) (void *), void *arg) {
++ pthread_attr_t attr;
++ pthread_attr_init(&attr);
++ pthread_attr_setstacksize(&attr,256*1024);
++ return pthread_create(ptid, &attr, wr, arg);
++}
+
+ static smfiDesc_ptr smfi = NULL;
diff --git a/main/libmilter/libmilter-sharedlib.patch b/main/libmilter/libmilter-sharedlib.patch
new file mode 100644
index 0000000000..43ec786121
--- /dev/null
+++ b/main/libmilter/libmilter-sharedlib.patch
@@ -0,0 +1,55 @@
+diff -Nru sendmail-8.14.3.orig/devtools/M4/UNIX/milterlibrary.m4 sendmail-8.14.3/devtools/M4/UNIX/milterlibrary.m4
+--- sendmail-8.14.3.orig/devtools/M4/UNIX/milterlibrary.m4 1970-01-01 01:00:00.000000000 +0100
++++ sendmail-8.14.3/devtools/M4/UNIX/milterlibrary.m4 2009-08-22 21:51:10.000000000 +0200
+@@ -0,0 +1,39 @@
++divert(-1)
++#
++# Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
++# All rights reserved.
++#
++# By using this file, you agree to the terms and conditions set
++# forth in the LICENSE file which can be found at the top level of
++# the sendmail distribution.
++#
++#
++# Definitions for Makefile construction for sendmail
++#
++divert(0)dnl
++include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/links.m4')dnl
++bldLIST_PUSH_ITEM(`bldC_PRODUCTS', bldCURRENT_PRODUCT)dnl
++bldPUSH_TARGET(bldCURRENT_PRODUCT`.so' bldCURRENT_PRODUCT`.a')dnl
++bldPUSH_INSTALL_TARGET(`install-'bldCURRENT_PRODUCT)dnl
++bldPUSH_CLEAN_TARGET(bldCURRENT_PRODUCT`-clean')dnl
++
++include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/defines.m4')
++divert(bldTARGETS_SECTION)
++bldCURRENT_PRODUCT.so: ${BEFORE} ${bldCURRENT_PRODUCT`OBJS'}
++ ${CCLINK} ${LDOPTS_SO} -o bldCURRENT_PRODUCT.so -Wl,confSONAME,bldCURRENT_PRODUCT.so.${MILTER_SOVER} ${bldCURRENT_PRODUCT`OBJS'} -lc ${LIBS}
++bldCURRENT_PRODUCT.a: ${BEFORE} ${bldCURRENT_PRODUCT`OBJS'}
++ ${AR} ${AROPTS} bldCURRENT_PRODUCT.a ${bldCURRENT_PRODUCT`OBJS'}
++ ${RANLIB} ${RANLIBOPTS} bldCURRENT_PRODUCT.a
++ifdef(`bldLINK_SOURCES', `bldMAKE_SOURCE_LINKS(bldLINK_SOURCES)')
++
++install-`'bldCURRENT_PRODUCT: bldCURRENT_PRODUCT.so bldCURRENT_PRODUCT.a
++ifdef(`bldINSTALLABLE', ` ifdef(`confMKDIR', `if [ ! -d "${DESTDIR}${bldINSTALL_DIR`'LIBDIR}" ]; then confMKDIR -p "${DESTDIR}${bldINSTALL_DIR`'LIBDIR}"; else :; fi ')
++ ${INSTALL} -c -o ${LIBOWN} -g ${LIBGRP} -m ${UBINMODE} bldCURRENT_PRODUCT.so "${DESTDIR}${LIBDIR}/bldCURRENT_PRODUCT.so.${MILTER_SOVER}"
++ ${LN} ${LNOPTS} bldCURRENT_PRODUCT.so.${MILTER_SOVER} "${DESTDIR}${LIBDIR}/bldCURRENT_PRODUCT.so"
++ ${INSTALL} -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} bldCURRENT_PRODUCT.a "${DESTDIR}${LIBDIR}"')
++
++bldCURRENT_PRODUCT-clean:
++ rm -f ${OBJS} bldCURRENT_PRODUCT.so bldCURRENT_PRODUCT.a ${MANPAGES}
++
++divert(0)
++COPTS+= confCCOPTS_SO
+diff -Nru sendmail-8.14.3.orig/libmilter/Makefile.m4 sendmail-8.14.3/libmilter/Makefile.m4
+--- sendmail-8.14.3.orig/libmilter/Makefile.m4 2008-04-08 07:23:44.000000000 +0200
++++ sendmail-8.14.3/libmilter/Makefile.m4 2009-08-22 21:53:35.000000000 +0200
+@@ -9,7 +9,7 @@
+ SMSRCDIR=ifdef(`confSMSRCDIR', `confSMSRCDIR', `${SRCDIR}/sendmail')
+ PREPENDDEF(`confINCDIRS', `-I${SMSRCDIR} ')
+
+-bldPRODUCT_START(`library', `libmilter')
++bldPRODUCT_START(`milterlibrary', `libmilter')
+ define(`bldINSTALLABLE', `true')
+ define(`LIBMILTER_EXTRAS', `errstring.c strl.c')
+ APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL -Dsm_snprintf=snprintf')