From fcc7bc64ea6c40701e8cffc444cb7ea31414d390 Mon Sep 17 00:00:00 2001
From: David Rothlisberger <david@rothlis.net>
Date: Sun, 23 Jun 2013 11:56:10 +0100
Subject: [PATCH v2] moreutils: New "parallel" variant

The "moreutils" and "parallel" ports both install a utility named
"parallel" (with incompatible command-line interfaces).

This commit allows installing the other moreutils utilities without
conflicting with the "parallel" port. I've chosen to *not* make
+parallel the default, because GNU parallel is more featureful and more
like xargs. This follows the example of Fedora, whose moreutils package
doesn't contain "parallel" at all.
---
 dports/sysutils/moreutils/Portfile                  |  6 +++++-
 dports/sysutils/moreutils/files/patch-Makefile.diff |  4 ++--
 dports/sysutils/moreutils/files/patch-parallel.diff | 11 +++++++++++
 dports/sysutils/parallel/Portfile                   |  2 --
 4 files changed, 18 insertions(+), 5 deletions(-)
 create mode 100644 dports/sysutils/moreutils/files/patch-parallel.diff

diff --git a/dports/sysutils/moreutils/Portfile b/dports/sysutils/moreutils/Portfile
index 3a707da..8b62c4f 100644
--- a/dports/sysutils/moreutils/Portfile
+++ b/dports/sysutils/moreutils/Portfile
@@ -4,7 +4,6 @@
 PortSystem              1.0
 
 name                    moreutils
-conflicts               parallel
 version                 0.48
 categories              sysutils
 platforms               darwin
@@ -74,6 +73,11 @@ variant doc description {Install man pages} {
     }
 }
 
+variant parallel description {Install the "parallel" utility} {
+    conflicts-append    parallel
+    patchfiles-append   patch-parallel.diff
+}
+
 platform darwin 8 {
     # ticket #24279
     pre-fetch {
diff --git a/dports/sysutils/moreutils/files/patch-Makefile.diff b/dports/sysutils/moreutils/files/patch-Makefile.diff
index 2c7db81..82a20e1 100644
--- a/dports/sysutils/moreutils/files/patch-Makefile.diff
+++ b/dports/sysutils/moreutils/files/patch-Makefile.diff
@@ -2,10 +2,10 @@
 +++ Makefile	2013-06-21 17:34:18.000000000 -0500
 @@ -1,13 +1,14 @@
 -BINS=isutf8 ifdata ifne pee sponge mispipe lckdo parallel errno
-+BINS=isutf8 ifne pee sponge mispipe lckdo parallel errno
++BINS=isutf8 ifne pee sponge mispipe lckdo errno
  PERLSCRIPTS=vidir vipe ts combine zrun chronic
 -MANS=sponge.1 vidir.1 vipe.1 isutf8.1 ts.1 combine.1 ifdata.1 ifne.1 pee.1 zrun.1 chronic.1 mispipe.1 lckdo.1 parallel.1 errno.1
-+MANS=sponge.1 vidir.1 vipe.1 isutf8.1 ts.1 combine.1 ifne.1 pee.1 zrun.1 chronic.1 mispipe.1 lckdo.1 parallel.1 errno.1
++MANS=sponge.1 vidir.1 vipe.1 isutf8.1 ts.1 combine.1 ifne.1 pee.1 zrun.1 chronic.1 mispipe.1 lckdo.1 errno.1
  CFLAGS?=-O2 -g -Wall
  INSTALL_BIN?=install -s
  PREFIX?=/usr
diff --git a/dports/sysutils/moreutils/files/patch-parallel.diff b/dports/sysutils/moreutils/files/patch-parallel.diff
new file mode 100644
index 0000000..b8cf6ee
--- /dev/null
+++ b/dports/sysutils/moreutils/files/patch-parallel.diff
@@ -0,0 +1,11 @@
+--- Makefile.orig	2013-06-22 15:38:22.000000000 +0100
++++ Makefile	2013-06-22 15:38:58.000000000 +0100
+@@ -1,6 +1,6 @@
+-BINS=isutf8 ifne pee sponge mispipe lckdo errno
++BINS=isutf8 ifne pee sponge mispipe lckdo parallel errno
+ PERLSCRIPTS=vidir vipe ts combine zrun chronic
+-MANS=sponge.1 vidir.1 vipe.1 isutf8.1 ts.1 combine.1 ifne.1 pee.1 zrun.1 chronic.1 mispipe.1 lckdo.1 errno.1
++MANS=sponge.1 vidir.1 vipe.1 isutf8.1 ts.1 combine.1 ifne.1 pee.1 zrun.1 chronic.1 mispipe.1 parallel.1 lckdo.1 errno.1
+ CFLAGS?=-O2 -g -Wall
+ INSTALL_BIN?=install -s
+ PREFIX?=/usr
diff --git a/dports/sysutils/parallel/Portfile b/dports/sysutils/parallel/Portfile
index 929efcb..5e52697 100644
--- a/dports/sysutils/parallel/Portfile
+++ b/dports/sysutils/parallel/Portfile
@@ -19,8 +19,6 @@ homepage            http://savannah.gnu.org/projects/parallel
 master_sites        gnu
 use_bzip2           yes
 
-conflicts           moreutils
-
 depends_lib         port:perl5
 
 checksums           rmd160  5e248a772814f96cf09527f790d381fc17c5a0a9 \
-- 
1.8.3.1

