Browse Source

figlet package update

Signed-off-by: tuibuilder_pel7x64builder0 <tuibuilder@powerel.org>
master
tuibuilder_pel7x64builder0 5 years ago
parent
commit
b3f9aa4c54
  1. 38
      SOURCES/0001-Make-test-script-a-bit-more-portable.patch
  2. 61
      SOURCES/0002-Add-Kannada-ttha-character-to-Standard-font.patch
  3. 39
      SOURCES/0003-Fix-build-with-musl-libc.patch
  4. 29
      SOURCES/0004-Adjust-compiler-flags-for-modern-gcc.patch
  5. 103
      SOURCES/0005-Test-script-cleanup.patch
  6. 29
      SOURCES/0006-Initialize-uninitialized-string.patch
  7. 51
      SOURCES/0007-Fix-memory-corruption-with-invalid-smush-amount.patch
  8. 120
      SPECS/figlet.spec

38
SOURCES/0001-Make-test-script-a-bit-more-portable.patch

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
From 1c1293b3e31a9e4156ae7a0d099951c56f582da6 Mon Sep 17 00:00:00 2001
From: Claudio Matsuoka <cmatsuoka@gmail.com>
Date: Sun, 3 Jun 2012 13:36:38 -0300
Subject: [PATCH 1/3] Make test script a bit more portable

Replaced mktemp which can be different/absent in some systems with
static filenames which should be good enough for our tests.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
---
run-tests.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/run-tests.sh b/run-tests.sh
index 26d2581..e6e1e3b 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -4,7 +4,7 @@ LC_ALL=POSIX
export LC_ALL
TESTDIR=tests
-OUTPUT=`mktemp`
+OUTPUT=.test-output.txt
LOGFILE=tests.log
CMD=./figlet
FONTDIR="$1"
@@ -67,7 +67,7 @@ run_test 018 "tlf2 overlap centered mode" "$cmd -oc -f tests/emboss"
run_test 019 "tlf2 full-width flush-left right-to-left mode" \
"$cmd -WRl -f tests/emboss"
run_test 020 "specify font directory" \
- "X=`mktemp -d`;cp fonts/script.flf \$X/foo.flf;$cmd -d\$X -ffoo;rm -Rf \$X"
+ "X=.t;mkdir \$X;cp fonts/script.flf \$X/foo.flf;$cmd -d\$X -ffoo;rm -Rf \$X"
run_test 021 "paragraph mode long line output" "$cmd -p -w250"
run_test 022 "short line output" "$cmd -w5"
run_test 023 "kerning paragraph centered mode (small)" "$cmd -kpc -fsmall"
--
2.1.0

61
SOURCES/0002-Add-Kannada-ttha-character-to-Standard-font.patch

@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
From 3c3b5596a5d094c8942979dee6013ce1c9099e7a Mon Sep 17 00:00:00 2001
From: Patrick Gillespie <patorjk@gmail.com>
Date: Tue, 12 Jun 2012 09:59:17 -0300
Subject: [PATCH 2/3] Add Kannada ttha character to Standard font
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add support for unicode character #3232. This character is of note because
it's commonly used to create the "look of disapproval" ASCII Art face: ಠ_ಠ.
You can see a FIGlet look of disapproval here:
_____) _____)
/_ ___/ /_ ___/
/ _ \ / _ \
| (_) | | (_) |
\___/ _____ \___/
|_____|

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
---
fonts/standard.flf | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/fonts/standard.flf b/fonts/standard.flf
index 1dc6fbf..bb15241 100644
--- a/fonts/standard.flf
+++ b/fonts/standard.flf
@@ -1,4 +1,4 @@
-flf2a$ 6 5 16 15 11 0 24463 229
+flf2a$ 6 5 16 15 15 0 24463 229
Standard by Glenn Chappell & Ian Chai 3/93 -- based on Frank's .sig
Includes ISO Latin-1
figlet release 2.1 -- 12 Aug 1994
@@ -7,9 +7,13 @@ Modified for figlet 2.2 by John Cowan <cowan@ccil.org>
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
+---
+
Modified by Paul Burton <solution@earthlink.net> 12/96 to include new parameter
supported by FIGlet and FIGWin. May also be slightly modified for better use
of new full-width/kern/smush alternatives, but default output is NOT changed.
+
+Modified 2012-05 by Patrick Gillespie (patorjk@gmail.com) to add the 0xCA0 character.
$@
$@
$@
@@ -2225,3 +2229,10 @@ of new full-width/kern/smush alternatives, but default output is NOT changed.
$@
$@
$@@
+0xCA0 KANNADA LETTER TTHA
+ _____)@
+ /_ ___/@
+ / _ \ @
+ | (_) | @
+ $\___/$ @
+ @@
--
2.1.0

39
SOURCES/0003-Fix-build-with-musl-libc.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From 88428a728e1f99dcdc63d7c5ff0cd8b6cda37576 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 3 Jun 2014 10:59:40 +0000
Subject: [PATCH 3/3] Fix build with musl libc

Avoid using the glibc internal macros __BEGIN/__END_DECLS.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
utf8.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/utf8.h b/utf8.h
index 0631b8a..a3e09bd 100644
--- a/utf8.h
+++ b/utf8.h
@@ -27,13 +27,17 @@
#define UTF8_IGNORE_ERROR 0x01
#define UTF8_SKIP_BOM 0x02
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
size_t utf8_to_wchar(const char *in, size_t insize, wchar_t *out,
size_t outsize, int flags);
size_t wchar_to_utf8(const wchar_t *in, size_t insize, char *out,
size_t outsize, int flags);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif /* !_UTF8_H_ */
--
2.1.0

29
SOURCES/0004-Adjust-compiler-flags-for-modern-gcc.patch

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
From 95e3dc5430e25c7c695dded9842af69ba5f6a9b2 Mon Sep 17 00:00:00 2001
From: Claudio Matsuoka <cmatsuoka@gmail.com>
Date: Sun, 10 May 2015 16:28:24 -0300
Subject: [PATCH 4/8] Adjust compiler flags for modern gcc

The gcc compiler has unused value warnings enabled by default, so add
-Wno-unused-value flag to reduce noise in the compiler output.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 5a51d51..dd31bf7 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ SHELL = /bin/sh
# The C compiler and linker to use
CC = gcc
-CFLAGS = -g -O2 -Wall
+CFLAGS = -g -O2 -Wall -Wno-unused-value
LD = gcc
LDFLAGS =
--
2.5.0

103
SOURCES/0005-Test-script-cleanup.patch

@ -0,0 +1,103 @@ @@ -0,0 +1,103 @@
From ab98e5ea0b2f3949b1c90d93cd6969171cd37562 Mon Sep 17 00:00:00 2001
From: Claudio Matsuoka <cmatsuoka@gmail.com>
Date: Sun, 10 May 2015 16:45:58 -0300
Subject: [PATCH 5/8] Test script cleanup

Auto-increment the test number instead of passing it as a parameter.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
---
run-tests.sh | 64 ++++++++++++++++++++++++++++++++----------------------------
1 file changed, 34 insertions(+), 30 deletions(-)

diff --git a/run-tests.sh b/run-tests.sh
index e6e1e3b..77e613b 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -6,13 +6,15 @@ export LC_ALL
TESTDIR=tests
OUTPUT=.test-output.txt
LOGFILE=tests.log
-CMD=./figlet
+CMD="./figlet"
FONTDIR="$1"
run_test() {
- test_num=$1
- test_dsc=$2
- test_cmd=$3
+ test_dsc=$1
+ test_cmd=$2
+
+ total=`expr $total + 1`
+ test_num=`printf %03d $total`
echo >> $LOGFILE
printf "Run test $test_num: ${test_dsc}... " | tee -a $LOGFILE
@@ -45,35 +47,37 @@ printf "Current font dir: "; $CMD -I2
printf "Default font: "; $CMD -I3
$CMD -f small "Test results" | tee -a $LOGFILE
-run_test 001 "showfigfonts output" "./showfigfonts"
-run_test 002 "text rendering in all fonts" \
+total=0
+
+run_test "showfigfonts output" "./showfigfonts"
+run_test "text rendering in all fonts" \
"for i in fonts/*.flf; do $cmd -f \$i; done"
-run_test 003 "long text rendering" "cat tests/longtext.txt|./figlet"
-run_test 004 "left-to-right text" "$cmd -L"
-run_test 005 "right-to-left text" "$cmd -R"
-run_test 006 "flush-left justification" "$cmd -l"
-run_test 007 "flush-right justification" "$cmd -r"
-run_test 008 "center justification" "$cmd -c"
-run_test 009 "kerning mode" "$cmd -k"
-run_test 010 "full width mode" "$cmd -W"
-run_test 011 "overlap mode" "$cmd -o"
-run_test 012 "tlf2 font rendering" "$cmd -f tests/emboss"
-run_test 013 "kerning flush-left right-to-left mode" "$cmd -klR"
-run_test 014 "kerning centered right-to-left mode (slant)" "$cmd -kcR -f slant"
-run_test 015 "full-width flush-right right-to-left mode" "$cmd -WrR"
-run_test 016 "overlap flush-right mode (big)" "$cmd -or -f big"
-run_test 017 "tlf2 kerning flush-right mode" "$cmd -kr -f tests/emboss"
-run_test 018 "tlf2 overlap centered mode" "$cmd -oc -f tests/emboss"
-run_test 019 "tlf2 full-width flush-left right-to-left mode" \
+run_test "long text rendering" "cat tests/longtext.txt|$CMD"
+run_test "left-to-right text" "$cmd -L"
+run_test "right-to-left text" "$cmd -R"
+run_test "flush-left justification" "$cmd -l"
+run_test "flush-right justification" "$cmd -r"
+run_test "center justification" "$cmd -c"
+run_test "kerning mode" "$cmd -k"
+run_test "full width mode" "$cmd -W"
+run_test "overlap mode" "$cmd -o"
+run_test "tlf2 font rendering" "$cmd -f tests/emboss"
+run_test "kerning flush-left right-to-left mode" "$cmd -klR"
+run_test "kerning centered right-to-left mode (slant)" "$cmd -kcR -f slant"
+run_test "full-width flush-right right-to-left mode" "$cmd -WrR"
+run_test "overlap flush-right mode (big)" "$cmd -or -f big"
+run_test "tlf2 kerning flush-right mode" "$cmd -kr -f tests/emboss"
+run_test "tlf2 overlap centered mode" "$cmd -oc -f tests/emboss"
+run_test "tlf2 full-width flush-left right-to-left mode" \
"$cmd -WRl -f tests/emboss"
-run_test 020 "specify font directory" \
+run_test "specify font directory" \
"X=.t;mkdir \$X;cp fonts/script.flf \$X/foo.flf;$cmd -d\$X -ffoo;rm -Rf \$X"
-run_test 021 "paragraph mode long line output" "$cmd -p -w250"
-run_test 022 "short line output" "$cmd -w5"
-run_test 023 "kerning paragraph centered mode (small)" "$cmd -kpc -fsmall"
-run_test 024 "list of control files" "ls fonts/*flc"
-run_test 025 "uskata control file" "printf 'ABCDE'|$CMD -fbanner -Cuskata"
-run_test 026 "jis0201 control file" "printf '\261\262\263\264\265'|$CMD -fbanner -Cjis0201"
+run_test "paragraph mode long line output" "$cmd -p -w250"
+run_test "short line output" "$cmd -w5"
+run_test "kerning paragraph centered mode (small)" "$cmd -kpc -fsmall"
+run_test "list of control files" "ls fonts/*flc"
+run_test "uskata control file" "printf 'ABCDE'|$CMD -fbanner -Cuskata"
+run_test "jis0201 control file" "printf '\261\262\263\264\265'|$CMD -fbanner -Cjis0201"
rm -f "$OUTPUT"
--
2.5.0

29
SOURCES/0006-Initialize-uninitialized-string.patch

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
From 89693cb2ab6248d1d996e5c34a473bf6fac471c9 Mon Sep 17 00:00:00 2001
From: Claudio Matsuoka <cmatsuoka@gmail.com>
Date: Sun, 10 May 2015 17:56:12 -0300
Subject: [PATCH 6/8] Initialize uninitialized string

Local string buffer was being operated without proper initialization, causing
wcslen() to operate on invalid values.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
---
figlet.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/figlet.c b/figlet.c
index 3de795a..9274f7f 100644
--- a/figlet.c
+++ b/figlet.c
@@ -1141,6 +1141,8 @@ inchr theord;
fcharlist->thechar = (outchr**)myalloc(sizeof(outchr*)*charheight);
fcharlist->next = fclsave;
+ outline[0] = 0;
+
for (row=0;row<charheight;row++) {
if (myfgets(templine,MAXLEN,file)==NULL) {
templine[0] = '\0';
--
2.5.0

51
SOURCES/0007-Fix-memory-corruption-with-invalid-smush-amount.patch

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
From 58eec2948f12d0f92f4804c72d92448b2369b8ec Mon Sep 17 00:00:00 2001
From: Lorenzo Gatti <lorenzo.gatti@gmail.com>
Date: Sun, 10 May 2015 18:03:35 -0300
Subject: [PATCH 7/8] Fix memory corruption with invalid smush amount

https://github.com/cmatsuoka/figlet/issues/4
lorenzogatti commented on Oct 28, 2014:

Another case of buffer overrun in the same function, again for right to left
layout: smushing away more characters that are contained in the outputline[]
buffers, with STRCAT being passed an invalid pointer (past the end of an
outputline[] buffer).

How is it possible to smush more characters than the length of the buffer? A
single character can be wider than the current line, but smushamt() doesn't
limit the amount of smushing to the length of the current line. Enormous
amounts of smushing are possible with space-rich fonts, such as the Obanner
collection.

Fixed in smushamt() by limiting the range of the result.

Test case:

$ figlet -f obanner132.flf -R -x -o -p -w 77 "Banner, o Banner"

--

Original fix by Lorenzo Gatti, reworked by Claudio Matsuoka.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
---
figlet.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/figlet.c b/figlet.c
index 9274f7f..04ba6d0 100644
--- a/figlet.c
+++ b/figlet.c
@@ -1452,6 +1452,9 @@ int smushamt()
maxsmush = currcharwidth;
for (row=0;row<charheight;row++) {
if (right2left) {
+ if (maxsmush>STRLEN(outputline[row])) {
+ maxsmush=STRLEN(outputline[row]);
+ }
for (charbd=STRLEN(currchar[row]);
ch1=currchar[row][charbd],(charbd>0&&(!ch1||ch1==' '));charbd--) ;
for (linebd=0;ch2=outputline[row][linebd],ch2==' ';linebd++) ;
--
2.5.0

120
SPECS/figlet.spec

@ -0,0 +1,120 @@ @@ -0,0 +1,120 @@
Name: figlet
Summary: A program for making large letters out of ordinary text
Version: 2.2.5
Release: 9%{?dist}
License: BSD and MIT
Group: Applications/Text
URL: http://www.figlet.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

# Source repository at https://github.com/cmatsuoka/figlet
Source0: ftp://ftp.figlet.org/pub/figlet/program/unix/%{name}-%{version}.tar.gz

Patch0: 0001-Make-test-script-a-bit-more-portable.patch
Patch1: 0002-Add-Kannada-ttha-character-to-Standard-font.patch
Patch2: 0003-Fix-build-with-musl-libc.patch
Patch3: 0004-Adjust-compiler-flags-for-modern-gcc.patch
Patch4: 0005-Test-script-cleanup.patch
Patch5: 0006-Initialize-uninitialized-string.patch
Patch6: 0007-Fix-memory-corruption-with-invalid-smush-amount.patch


%description
FIGlet prints its input using large characters (called "FIGcharacters") made
up of ordinary screen characters (called "sub-characters"). FIGlet output is
generally reminiscent of the sort of "signatures" many people like to put at
the end of e-mail and UseNet messages. It is also reminiscent of the output of
some banner programs, although it is oriented normally, not sideways.


%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1

sed -i -e 's@usr/local@usr/@g' \
-e 's@showfig/usr/share/figlet/@@g' \
-e 's@$(prefix)/man@$(prefix)/share/man@g' Makefile


%build
make %{?_smp_mflags} CFLAGS="%{optflags}"


%check
make check

%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} install


%clean
rm -rf %{buildroot}


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc CHANGES README FAQ
%{_mandir}/man6/*
%{_bindir}/*
%{_datadir}/%{name}/


%changelog
* Fri Dec 11 2015 Simone Caronni <negativo17@gmail.com> - 2.2.5-9
- Add additional patches from upstream

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.5-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Wed Feb 25 2015 Simone Caronni <negativo17@gmail.com> - 2.2.5-7
- Add license macro.
- Add upstream patches.

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Thu Jun 14 2012 Simone Caronni <negativo17@gmail.com> - 2.2.5-1
- Updated to 2.2.5.

* Mon May 21 2012 Simone Caronni <negativo17@gmail.com> - 2.2.4-7
- Removed ms-dos fonts.
- Added check.
- Replace make macro with actual command.
- Added compile flags to make command.

* Mon May 14 2012 Simone Caronni <negativo17@gmail.com> - 2.2.4-6
- Review fixes.
- Removed contributed fonts as per review.

* Thu May 10 2012 Simone Caronni <negativo17@gmail.com> - 2.2.4-5
- Small changes.

* Wed Oct 26 2011 Simone Caronni <negativo17@gmail.com> - 2.2.4-4
- rpmlint fixes.

* Fri Oct 21 2011 Simone Caronni <negativo17@gmail.com> - 2.2.4-3
- Updated.
- Added additional fonts, reworked setup.

* Wed Nov 29 2006 Simone Caronni <slaanesh@fastwebnet.it> - 2.2.2-1.sla
- First build
Loading…
Cancel
Save