Skip to content

Commit

Permalink
add(main): new package procmail
Browse files Browse the repository at this point in the history
closes termux#10638

Signed-off-by: Aditya Alok <[email protected]>
  • Loading branch information
MrAdityaAlok committed May 26, 2022
1 parent e377e64 commit eb1b117
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 0 deletions.
62 changes: 62 additions & 0 deletions packages/procmail/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
TERMUX_PKG_HOMEPAGE=https://github.com/BuGlessRB/procmail
TERMUX_PKG_DESCRIPTION="Versatile e-mail processor"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=3.24
TERMUX_PKG_SRCURL=https://github.com/BuGlessRB/procmail/archive/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=514ea433339783e95df9321e794771e4887b9823ac55fdb2469702cf69bd3989
TERMUX_PKG_BUILD_IN_SRC=true

TERMUX_PKG_EXTRA_MAKE_ARGS="BASENAME=${TERMUX_PREFIX}
MANDIR=${TERMUX_PREFIX}/share/man
LIBPATHS=${TERMUX_PREFIX}/lib
"

termux_step_pre_configure() {
# Tests cannot be run while cross-compiling, so hardcode the results.
echo "exit 0" >src/autoconf
cat <<-EOF >autoconf.h
/* 2 moves in 64 steps of size 16384 when reallocing */
#define WMACROS_NON_POSIX
#define NOpw_passwd
#define NOpw_class
#define NOpw_gecos
#define NOsetrgid
#define NOsetegid
#define endhostent()
#define endprotoent()
#define MAX_argc 83725
/* Your system's strstr() is 38.00 times FASTER than my C-routine */
#define NO_COMSAT
#ifndef MAILSPOOLDIR
#define MAILSPOOLDIR "${TERMUX_PREFIX}/var/spool/mail/"
#endif
#define SENDMAIL ""
#define DEFflagsendmail ""
#define CF_no_procmail_yet
#define buggy_SENDMAIL
#define defPATH "PATH=${TERMUX_ANDROID_HOME}/bin:${TERMUX_ANDROID_HOME}/.local/bin:${TERMUX_PREFIX}/bin"
#define defSPATH "PATH=${TERMUX_ANDROID_HOME}/.local/bin:${TERMUX_PREFIX}/bin"
#define PM_VERSION "${TERMUX_PKG_VERSION}"
/*locktype: 4, countlocks: 0, timeout 0, watchdog 8,
* /data/data/com.termux/files/home/dev/procmail-3.24.mod/test/_locktest*/
/*locktype: 6, countlocks: 0, timeout 0, watchdog 8,
* /data/data/com.termux/files/home/dev/procmail-3.24.mod/test/_locktest*/
/*locktype: 7, countlocks: 0, timeout 0, watchdog 8,
* /data/data/com.termux/files/home/dev/procmail-3.24.mod/test/_locktest*/
/* Hotwire LOCKINGTEST=111 */
/* Procmail will lock via: dotlocking, fcntl(), lockf(), flock() */
#define USElockf
#define USEflock
/* autoconf completed */
EOF
}

termux_step_make() {
# shellcheck disable=SC2086 # We want splitting of TERMUX_PKG_EXTRA_MAKE_ARGS.
make CFLAGS0="${CFLAGS}" LDFLAGS0="${LDFLAGS}" STRIP="${STRIP}" $TERMUX_PKG_EXTRA_MAKE_ARGS
}

termux_step_make_install() {
make install
}
63 changes: 63 additions & 0 deletions packages/procmail/config.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
--- procmail-3.24/config.h 2022-03-02 15:22:56.000000000 +0530
+++ procmail-3.24.mod/config.h 2022-05-26 14:29:35.139156671 +0530
@@ -46,7 +46,7 @@
*/
#define PRESTENV {"IFS","ENV","PWD",0}

-/*#define GROUP_PER_USER /* uncomment this if each
+#define GROUP_PER_USER /* uncomment this if each
user has his or her own
group and procmail can therefore trust a $HOME/.procmailrc that
is group writable or contained in a group writable home directory
@@ -108,25 +108,25 @@
recipes will not work. One reasonable candidate is "/etc/mta/send"
on systems that support the MTA configuration switch. */

-#define DEFmaildir "$HOME" /* default value for the MAILDIR variable;
+#define DEFmaildir "@TERMUX_ANDROID_HOME@" /* default value for the MAILDIR variable;
this must be an absolute path */

-#define PROCMAILRC "$HOME/.procmailrc" /* default rcfile for every
+#define PROCMAILRC "@TERMUX_ANDROID_HOME@/.procmailrc" /* default rcfile for every
recipient; if this file
is not found, maildelivery will proceed as normal to the default
system mailbox. This also must be an absolute path */

-#define ETCRC "/etc/procmailrc" /* optional global procmailrc startup
+#define ETCRC "@TERMUX_PREFIX@/etc/procmailrc" /* optional global procmailrc startup
file (will only be read if procmail
is started with no rcfile on the command line). */

-#define ETCRCS "/etc/procmailrcs/" /* optional trusted path prefix for
+#define ETCRCS "@TERMUX_PREFIX@/etc/procmailrcs/" /* optional trusted path prefix for
rcfiles which will be executed with
the uid of the owner of the rcfile (this only happens if procmail is
called with the -m option, without variable assignments on the command
line). */

-#define CONFRC "/etc/procmail.conf" /* optional global procmail
+#define CONFRC "@TERMUX_PREFIX@/etc/procmail.conf" /* optional global procmail
configuration file. It is processed
after all variable except ORGMAIL are preset. Filtering and delivering
actions will not be processed in this rcfile. */
@@ -175,7 +175,7 @@
#define INEFFICIENTrealloc /* don't pussy-foot around */
#endif
#define MAXinMEM (1024*1024) /* when to switch to mmap() */
-#define MMAP_DIR "/var/spool/procmail/" /* where to put */
+#define MMAP_DIR "@TERMUX_PREFIX@/var/spool/procmail/" /* where to put */
#endif /* the files */
#define MINlogbuf 81 /* fit an entire line */
#define MAXlogbuf 1000 /* in case someone abuses LOG */
@@ -227,9 +227,9 @@
#define DEFcomsat offvalue /* when an rcfile has been specified */
/* set to either "offvalue" or "empty" */

-#define BinSh "/bin/sh"
+#define BinSh "@TERMUX_PREFIX@/bin/sh"
#define ROOT_DIR "/"
-#define DEAD_LETTER "/tmp/dead.letter" /* $ORGMAIL if no passwd entry */
+#define DEAD_LETTER "@TERMUX_PREFIX@/tmp/dead.letter" /* $ORGMAIL if no passwd entry */
#define DevNull "/dev/null"
#define NICE_RANGE 39 /* maximal nice difference */
#define chCURDIR '.' /* the current directory */

0 comments on commit eb1b117

Please sign in to comment.