app-text/msort: New package
authorConrad Kostecki <conrad@kostecki.com>
Tue, 30 Oct 2018 11:24:00 +0000 (12:24 +0100)
committerMichał Górny <mgorny@gentoo.org>
Sat, 10 Nov 2018 19:18:10 +0000 (20:18 +0100)
Msort is a program for sorting files in sophisticated ways.

Closes: https://bugs.gentoo.org/154528
Signed-off-by: Conrad Kostecki <conrad@kostecki.com>
Package-Manager: Portage-2.3.51, Repoman-2.3.11
Closes: https://github.com/gentoo/gentoo/pull/9986
Signed-off-by: Michał Górny <mgorny@gentoo.org>
app-text/msort/Manifest [new file with mode: 0644]
app-text/msort/files/msort-8.53-find-utf8proc-headers.patch [new file with mode: 0644]
app-text/msort/files/msort-8.53-fix-icu-build.patch [new file with mode: 0644]
app-text/msort/files/msort-8.53-fix-missing-limits-header.patch [new file with mode: 0644]
app-text/msort/files/msort-8.53-fix-segfault-on-certain-input.patch [new file with mode: 0644]
app-text/msort/files/msort-8.53-respect-users-cflags.patch [new file with mode: 0644]
app-text/msort/metadata.xml [new file with mode: 0644]
app-text/msort/msort-8.53.ebuild [new file with mode: 0644]

diff --git a/app-text/msort/Manifest b/app-text/msort/Manifest
new file mode 100644 (file)
index 0000000..9e30de5
--- /dev/null
@@ -0,0 +1 @@
+DIST msort-8.53.tar.bz2 440307 BLAKE2B 024fa62c9424dd7f994fd9aabdb2414116ba78c2f6bbbfd88c11cde4ed1688260d7bb7f7a18dd36822f4725817df93d218c4382e8b15232fc6d3583098d44db0 SHA512 9afba189d8b703cd6668065ace86733b52a39f6783272849b3582308da5a33db8ae6747501846523ba3671c9fb38a7584fe0db2462cff446b15d79200055a573
diff --git a/app-text/msort/files/msort-8.53-find-utf8proc-headers.patch b/app-text/msort/files/msort-8.53-find-utf8proc-headers.patch
new file mode 100644 (file)
index 0000000..9b3845b
--- /dev/null
@@ -0,0 +1,33 @@
+--- a/configure.ac     2010-01-11 01:56:36.000000000 +0100
++++ b/configure.ac     2018-09-27 15:05:20.205734233 +0200
+@@ -94,7 +94,7 @@
+ AC_CHECK_HEADERS([alloca.h ctype.h errno.h gnu/libc-version.h langinfo.h libintl.h limits.h locale.h stdargs.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/stat.h time.h tre/tre.h unicode/umachine.h unicode/unorm.h  uninum/unicode.h uninum/nsdefs.h uninum/uninum.h unistd.h wchar.h wctype.h])
+ if ${utf8proc}; then
+-AC_CHECK_HEADER([utf8proc.h],[AC_DEFINE([HAVE_UTF8PROC_H], [1],[Define to 1 if you have <utf8proc.h>.])],[AC_MSG_ERROR([LIB UTF8PROC and its header is obligatory. See http://www.flexiguided.de/publications.utf8proc.en.html])])
++AC_CHECK_HEADER([libutf8proc/utf8proc.h],[AC_DEFINE([HAVE_UTF8PROC_H], [1],[Define to 1 if you have <libutf8proc/utf8proc.h>.])],[AC_MSG_ERROR([LIB UTF8PROC and its header is obligatory. See http://www.flexiguided.de/publications.utf8proc.en.html])])
+ fi
+ if ${uninum}; then
+--- a/misc.c   2009-08-05 05:09:21.000000000 +0200
++++ b/misc.c   2018-09-27 15:10:37.355738021 +0200
+@@ -41,7 +41,7 @@
+ #include <unicode/umachine.h>
+ #include <unicode/unorm.h>
+ #else
+-#include <utf8proc.h>
++#include <libutf8proc/utf8proc.h>
+ #include "unorm.h"
+ #endif
+ #include <tre/regex.h>
+--- a/msort.c  2010-01-11 01:53:32.000000000 +0100
++++ b/msort.c  2018-09-27 15:10:30.275737936 +0200
+@@ -57,7 +57,7 @@
+ #ifndef USEUTF8PROC
+ #include <unicode/unorm.h>
+ #else
+-#include <utf8proc.h>
++#include <libutf8proc/utf8proc.h>
+ #include "unorm.h"
+ #endif
+ #ifdef HAVE_UNINUM_UNICODE_H
diff --git a/app-text/msort/files/msort-8.53-fix-icu-build.patch b/app-text/msort/files/msort-8.53-fix-icu-build.patch
new file mode 100644 (file)
index 0000000..658be28
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.am      2009-08-05 05:09:21.000000000 +0200
++++ b/Makefile.am      2018-09-27 15:41:10.685759919 +0200
+@@ -22,7 +22,7 @@
+ LIBS+=-lutf8proc
+ AM_CFLAGS += -DUSEUTF8PROC
+ else
+-LIBS+=-licutu
++LIBS+=-licutu -licuuc
+ endif
+ msg:  msg.tcl
diff --git a/app-text/msort/files/msort-8.53-fix-missing-limits-header.patch b/app-text/msort/files/msort-8.53-fix-missing-limits-header.patch
new file mode 100644 (file)
index 0000000..14459d1
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.am      2009-08-05 05:09:21.000000000 +0200
++++ b/Makefile.am      2018-09-27 15:32:28.685753684 +0200
+@@ -6,7 +6,7 @@
+ noinst_HEADERS = comparisons.h compdefs.h dstr.h ex_codes.h exitcode.h input.h key.h limits.h record.h retcodes.h unicode.h  unorm.h utf8error.h
+ LOCALEDIR=/usr/local/share/locale
+ EXTRA_DIST = $(docs) msg.tcl CREDITS msort-${VERSION}.lsm RegressionTests SortOrders
+-AUTOMAKE_OPTIONS = dist-zip dist-bzip2
++AUTOMAKE_OPTIONS = dist-zip dist-bzip2 nostdinc
+ if ALLOCAOK
+ AM_CFLAGS = -DLOCALEDIR=\"${LOCALEDIR}\" -DALLOCAOK -std=gnu99
diff --git a/app-text/msort/files/msort-8.53-fix-segfault-on-certain-input.patch b/app-text/msort/files/msort-8.53-fix-segfault-on-certain-input.patch
new file mode 100644 (file)
index 0000000..01edc69
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/dstr.c   2009-08-05 05:09:21.000000000 +0200
++++ b/dstr.c   2018-09-27 15:43:52.815761856 +0200
+@@ -79,7 +79,7 @@
+ #ifdef SAFECALL
+   if(length == 0) return(ERROR);
+ #endif
+-  if (length > tgt->c) {
++  if (length + 1 > tgt->c) {
+     if(tgt->s != NULL) free( (void *) tgt->s);
+     tgt->s = (wchar_t *) malloc((length + 1) * sizeof(wchar_t));
+     if(tgt->s == NULL) return(ERROR);
diff --git a/app-text/msort/files/msort-8.53-respect-users-cflags.patch b/app-text/msort/files/msort-8.53-respect-users-cflags.patch
new file mode 100644 (file)
index 0000000..aefe847
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure.ac     2010-01-11 01:56:36.000000000 +0100
++++ b/configure.ac     2018-09-27 15:36:41.425756703 +0200
+@@ -78,8 +78,6 @@
+ AC_PROG_CC
+ if ${debugbuild}; then
+    CFLAGS="-ggdb -g3" 
+-else
+-   CFLAGS="-g -O2" 
+ fi
+ AC_PROG_INSTALL
diff --git a/app-text/msort/metadata.xml b/app-text/msort/metadata.xml
new file mode 100644 (file)
index 0000000..f7bd381
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="person">
+               <email>ck+gentoo@bl4ckb0x.de</email>
+               <name>Conrad Kostecki</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>proxy-maint@gentoo.org</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <longdescription>
+               Msort is a program for sorting files in sophisticated ways.
+               It was originally developed for alphabetizing dictionaries of "exotic" languages
+               in formats like those used by Shoebox and Toolbox, for which it has been extensively used,
+               but is useful for many other purposes.
+               Msort differs from typical sort utilities in providing greater flexibility in parsing
+               the input into records and identifying key fields and greater control over the sort order.
+       </longdescription>
+       <use>
+               <flag name="heap">Use heap instead of alloca()</flag>
+               <flag name="icu">Use <pkg>dev-libs/icu</pkg> instead of <pkg>dev-libs/libutf8proc</pkg>.</flag>
+               <flag name="libuninum">Use <pkg>dev-libs/libuninum</pkg> for conversion.</flag>
+       </use>
+</pkgmetadata>
diff --git a/app-text/msort/msort-8.53.ebuild b/app-text/msort/msort-8.53.ebuild
new file mode 100644 (file)
index 0000000..d401053
--- /dev/null
@@ -0,0 +1,47 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools
+
+DESCRIPTION="A program for sorting files in sophisticated ways"
+HOMEPAGE="https://billposer.org/Software/msort.html"
+SRC_URI="https://billposer.org/Software/Downloads/${P}.tar.bz2"
+
+KEYWORDS="~amd64 ~x86"
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+IUSE="heap +icu +libuninum"
+
+RDEPEND="dev-libs/tre
+       icu? ( dev-libs/icu:= )
+       !icu? ( dev-libs/libutf8proc:= )
+       libuninum? ( dev-libs/libuninum:= )"
+
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+       "${FILESDIR}/${P}-find-utf8proc-headers.patch"
+       "${FILESDIR}/${P}-fix-icu-build.patch"
+       "${FILESDIR}/${P}-fix-missing-limits-header.patch"
+       "${FILESDIR}/${P}-fix-segfault-on-certain-input.patch"
+       "${FILESDIR}/${P}-respect-users-cflags.patch"
+       )
+
+src_prepare() {
+       default
+
+       eautoreconf
+}
+
+src_configure() {
+       local myeconfargs=(
+               $(use_enable !heap allocaok)
+               $(use_enable !icu utf8proc)
+               $(use_enable libuninum uninum)
+               --disable-debugbuild
+       )
+
+       econf "${myeconfargs[@]}"
+}