system/unac: Added (remove accents from text).

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2015-10-28 23:48:46 +07:00 committed by Willy Sudiarto Raharjo
parent 80aa8990f9
commit 908d2798bc
6 changed files with 189 additions and 0 deletions

7
system/unac/README Normal file
View file

@ -0,0 +1,7 @@
unac (remove accents from text)
unac is a C library and command that removes accents from a string. For
instance the string été will become ete. It provides a command line
interface that removes accents from an input flow or a string given in
argument (unaccent command). In the library function and the command,
the charset of the input is specified as an argument.

View file

@ -0,0 +1,11 @@
diff -Naur unac-1.8.0.orig/unaccent-local-map.perl unac-1.8.0.orig.patched/unaccent-local-map.perl
--- unac-1.8.0.orig/unaccent-local-map.perl 2003-10-13 06:24:25.000000000 -0400
+++ unac-1.8.0.orig.patched/unaccent-local-map.perl 2015-10-26 17:01:49.000000000 -0400
@@ -23,5 +23,7 @@
%::localmap = (
"LATIN SMALL LETTER AE" => [ "LATIN SMALL LETTER A", "LATIN SMALL LETTER E" ],
"LATIN CAPITAL LETTER AE" => [ "LATIN CAPITAL LETTER A", "LATIN CAPITAL LETTER E" ],
+ "LATIN SMALL LIGATURE OE" => [ "LATIN SMALL LETTER O", "LATIN SMALL LETTER E" ],
+ "LATIN CAPITAL LIGATURE OE" => [ "LATIN CAPITAL LETTER O", "LATIN CAPITAL LETTER E" ],
);

45
system/unac/size_t.diff Normal file
View file

@ -0,0 +1,45 @@
diff -r fd7eb0d70970 unac-1.8.0/unac.c
--- a/unac-1.8.0/unac.c Fri Sep 17 10:35:14 2010 +0200
+++ b/unac-1.8.0/unac.c Fri Sep 17 10:36:07 2010 +0200
@@ -13873,9 +13873,9 @@
*out_lengthp = 0;
} else {
char* utf16 = 0;
- int utf16_length = 0;
+ size_t utf16_length = 0;
char* utf16_unaccented = 0;
- int utf16_unaccented_length = 0;
+ size_t utf16_unaccented_length = 0;
if(convert(charset, utf16be(), in, in_length, &utf16, &utf16_length) < 0) {
return -1;
diff -r fd7eb0d70970 unac-1.8.0/unaccent.c
--- a/unac-1.8.0/unaccent.c Fri Sep 17 10:35:14 2010 +0200
+++ b/unac-1.8.0/unaccent.c Fri Sep 17 10:40:34 2010 +0200
@@ -90,7 +90,7 @@
const char* charset = argv[optind++];
char* unaccented = 0;
- int unaccented_length = 0;
+ size_t unaccented_length = 0;
if(optind >= argc) {
#define BUFFER_SIZE 10240
@@ -101,7 +101,7 @@
perror("");
exit(1);
}
- printf("%.*s", unaccented_length, unaccented);
+ printf("%.*s", (int)unaccented_length, unaccented);
}
} else {
const char* string = argv[optind++];
@@ -114,7 +114,7 @@
if(debug_level > UNAC_DEBUG_NONE)
fprintf(stderr, "unaccented version is ");
- printf("%.*s\n", unaccented_length, unaccented);
+ printf("%.*s\n", (int)unaccented_length, unaccented);
if(optind < argc) {
const char* expected = argv[optind++];

19
system/unac/slack-desc Normal file
View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
unac: unac (remove accents from text)
unac:
unac: unac is a C library and command that removes accents from a
unac: string. For instance the string été will become ete. It provides
unac: a command line interface that removes accents from a input flow or a
unac: string given in argument (unaccent command). In the library function
unac: and the command, the charset of the input is specified as an argument.
unac:
unac:
unac:
unac:

View file

@ -0,0 +1,97 @@
#!/bin/sh
# Slackware build script for unac
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
PRGNAM=unac
VERSION=${VERSION:-1.8.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
TARBALL=${PRGNAM}_${VERSION}.orig.tar.gz
DIRNAME=${PRGNAM}-${VERSION}.orig
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $DIRNAME
tar xvf $CWD/$TARBALL
cd $DIRNAME
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# patch taken from http://http.debian.net/debian/pool/main/u/unac/unac_1.8.0-6.diff.gz
# (yes, it needs -p2)
patch -p2 < $CWD/size_t.diff
# patch by slackbuild author, add support for OE ligature
patch -p1 < $CWD/oe_ligature.diff
touch config.rpath # shut up, autocrap
autoreconf -if
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--disable-static \
--enable-shared \
--build=$ARCH-slackware-linux
# this is needed for the OE ligature also
make -B $PRGNAM.c
make
make install-strip DESTDIR=$PKG
gzip $PKG/usr/man/man?/*.?
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYING ChangeLog NEWS README THANKS $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

10
system/unac/unac.info Normal file
View file

@ -0,0 +1,10 @@
PRGNAM="unac"
VERSION="1.8.0"
HOMEPAGE="http://www.nongnu.org/unac/"
DOWNLOAD="http://http.debian.net/debian/pool/main/u/unac/unac_1.8.0.orig.tar.gz"
MD5SUM="8670c920969a199dec37f15c197602bf"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"