Merged in TimothyGu/haikuports/caca (pull request #365)

Add libcaca port
This commit is contained in:
Adrien Destugues
2014-12-19 22:08:43 +01:00
3 changed files with 302 additions and 0 deletions

View File

@@ -0,0 +1,124 @@
SUMMARY="libcaca ASCII art rendering library"
DESCRIPTION="
libcaca is a software library which allows applications to automatically \
convert still and moving images into colored ASCII art.
"
HOMEPAGE="http://caca.zoy.org/wiki/libcaca"
# FIXME: the offical website is down right now. Using mirror provided by the
# MXE project.
SRC_URI="
http://caca.zoy.org/raw-attachment/wiki/libcaca/libcaca-$portVersion.tar.gz
http://s3.amazonaws.com/mxe-pkg/libcaca-$portVersion.tar.gz
"
CHECKSUM_SHA256="128b467c4ed03264c187405172a4e83049342cc8cc2f655f53a2d0ee9d3772f4"
SOURCE_DIR="libcaca-$portVersion"
REVISION="1"
LICENSE="
WTFPL
GNU GPL v2
"
COPYRIGHT="
1998, 1999, 2001 Jan Hubicka <hubicka@freesoft.cz>
2003-2008 Sam Hocevar <sam@zoy.org>
2003-2008 Jean-Yves Lamoureux <jylam@lnxscene.org>
2004-2005 John Beppu <beppu@lbox.org>
2006-2007 Ben Wiley Sittler <bsittler@gmail.com>
2007-2008 Pascal Terjan <pterjan@linuxfr.org>
"
ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"
PROVIDES="
libcaca$secondaryArchSuffix = $portVersion compat >= 0
lib:libcaca$secondaryArchSuffix = 0.99.19 compat >= 0
lib:libcaca++$secondaryArchSuffix = 0.99.19 compat >= 0
cmd:cacaclock$secondaryArchSuffix = $portVersion compat >= 0
cmd:cacademo$secondaryArchSuffix = $portVersion compat >= 0
cmd:cacafire$secondaryArchSuffix = $portVersion compat >= 0
cmd:cacaserver$secondaryArchSuffix = $portVersion compat >= 0
cmd:cacaview$secondaryArchSuffix = $portVersion compat >= 0
cmd:cacaplay$secondaryArchSuffix = $portVersion compat >= 0
cmd:img2txt$secondaryArchSuffix = $portVersion compat >= 0
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libncursesw$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
if [ "$effectiveTargetArchitecture" != 'x86_gcc2' ]; then
REQUIRES="
$REQUIRES
lib:libgcc_s$secondaryArchSuffix
lib:libstdc++$secondaryArchSuffix
"
fi
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libncursesw$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:aclocal
cmd:autoconf
cmd:automake
cmd:doxygen
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:libtoolize
cmd:make
cmd:pkg_config
cmd:ranlib
"
PATCHES="libcaca-${portVersion}.patchset"
PATCH()
{
sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g' configure.ac
}
BUILD()
{
autoreconf -fi
runConfigure ./configure \
--enable-ncurses \
--enable-cxx \
--disable-python \
--htmldir=${developDocDir}
make $jobArgs
}
INSTALL()
{
make install
prepareInstalledDevelLibs libcaca libcaca++
fixPkgconfig
# devel package
packageEntries devel \
$binDir/caca-config \
$developDir \
$manDir/man3
}
# ----- devel package -------------------------------------------------------
PROVIDES_devel="
libcaca${secondaryArchSuffix}_devel = $portVersion compat >= 0
devel:libcaca$secondaryArchSuffix = $portVersion compat >= 0
devel:libcaca++$secondaryArchSuffix = $portVersion compat >= 0
cmd:caca_config$secondaryArchSuffix = $portVersion compat >= 0
"
REQUIRES_devel="
haiku$secondaryArchSuffix
libcaca$secondaryArchSuffix == $portVersion base
lib:libncursesw$secondaryArchSuffix
devel:libncursesw$secondaryArchSuffix
"

View File

@@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@@ -0,0 +1,164 @@
From fb47040266da2f0e74cc36cdf407afe2d8fa6ee8 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Thu, 18 Dec 2014 23:45:35 +0000
Subject: [PATCH 1/3] Fix network detection
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
diff --git a/configure.ac b/configure.ac
index 641dd17..e06cb74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -491,8 +491,12 @@ fi
# Build cacaserver?
ac_cv_my_have_network="no"
-AC_CHECK_HEADERS(sys/socket.h,
- [ac_cv_my_have_network="yes"])
+AC_CHECK_HEADERS(sys/socket.h, [
+ # On Haiku the socket() function and friends are in libnetwork
+ AC_SEARCH_LIBS([socket], [network], [
+ ac_cv_my_have_network="yes"
+ ])
+])
AM_CONDITIONAL(USE_NETWORK, test "${ac_cv_my_have_network}" = "yes")
# Use Imlib2?
--
1.8.3.4
From b4a3afb4b37257e6f18aa31511df9615ea39418e Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Fri, 19 Dec 2014 02:19:19 +0000
Subject: [PATCH 2/3] doc: use standard PDF and HTML installation directories
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 5598ce3..77720e7 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -7,11 +7,9 @@ doxygen_DOX = libcaca.dox user.dox migrating.dox tutorial.dox canvas.dox font.do
man_MANS = caca-config.1 cacafire.1 cacaview.1 cacaserver.1 img2txt.1 cacaplay.1
if BUILD_DOCUMENTATION
-htmldoc_DATA = html/doxygen.css
-htmldocdir = $(datadir)/doc/libcaca-dev/html
+html_DATA = html/doxygen.css
if USE_LATEX
-pdfdoc_DATA = latex/libcaca.pdf
-pdfdocdir = $(datadir)/doc/libcaca-dev/pdf
+pdf_DATA = latex/libcaca.pdf
endif
endif
@@ -42,10 +40,10 @@ clean-local:
install-data-local:
if BUILD_DOCUMENTATION
- mkdir -p $(DESTDIR)$(datadir)/doc
- $(mkinstalldirs) $(DESTDIR)$(datadir)/doc/libcaca-dev/html
+ mkdir -p $(DESTDIR)$(htmldir)
+ $(mkinstalldirs) $(DESTDIR)$(htmldir)
cp `find html -name '*.html' -o -name '*.gif' -o -name '*.png'` \
- $(DESTDIR)$(datadir)/doc/libcaca-dev/html
+ $(DESTDIR)$(htmldir)
$(mkinstalldirs) $(DESTDIR)$(mandir)/man3
for man in $$(find man -name '*.3caca'); do \
sed -e 's/man3caca/man3/g' -e "s/fC'\([a-zA-Z0-9]*\)'/fC\"\1\"/g" \
--
1.8.3.4
From 28016da0b3e6c2d001455bb49b0b24fde3e9edc5 Mon Sep 17 00:00:00 2001
From: Scott McCreary <scottmc2@gmail.com>
Date: Thu, 18 Dec 2014 22:46:50 -0800
Subject: [PATCH 3/3] Fix gcc2 issues in 3 files
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
diff --git a/caca/file.c b/caca/file.c
index 27e4e83..51e127b 100644
--- a/caca/file.c
+++ b/caca/file.c
@@ -63,6 +63,10 @@ struct caca_file
*/
caca_file_t *caca_file_open(char const *path, const char *mode)
{
+# if defined HAVE_ZLIB_H
+ uint8_t buf[4];
+ unsigned int skip_size = 0;
+#endif
#if defined __KERNEL__
seterrno(ENOSYS);
return NULL;
@@ -72,8 +76,6 @@ caca_file_t *caca_file_open(char const *path, const char *mode)
fp->readonly = !!strchr(mode, 'r');
# if defined HAVE_ZLIB_H
- uint8_t buf[4];
- unsigned int skip_size = 0;
fp->gz = gzopen(path, fp->readonly ? "rb" : "wb");
if(!fp->gz)
diff --git a/examples/trifiller.c b/examples/trifiller.c
index 5a06f23..fab3cd7 100644
--- a/examples/trifiller.c
+++ b/examples/trifiller.c
@@ -45,6 +45,7 @@ int main(int argc, char *argv[])
int quit = 0;
int update = 1;
int px, py;
+ int p;
float angle = 0;
@@ -198,7 +199,6 @@ int main(int argc, char *argv[])
/* 2D Rotation around screen center */
- int p;
for (p = 0; p < 4; p++)
{
rotated[p][0] =
diff --git a/src/cacaclock.c b/src/cacaclock.c
index 3a405ea..63b35af 100644
--- a/src/cacaclock.c
+++ b/src/cacaclock.c
@@ -67,6 +67,10 @@ int main(int argc, char *argv[]) {
caca_canvas_t *figcv;
caca_display_t *dp;
uint32_t w, h, fw, fh;
+ char *d;
+ uint32_t o;
+ uint32_t x;
+ uint32_t y;
char *format = "%R:%S";
char *font = "/usr/share/figlet/mono12.tlf";
@@ -143,8 +147,8 @@ int main(int argc, char *argv[]) {
if(caca_get_event_type(&ev))
goto end;
}
- char *d = get_date(format);
- uint32_t o = 0;
+ d = get_date(format);
+ o = 0;
// figfont API is not complete, and does not allow us to put a string
// at another position than 0,0
@@ -164,8 +168,8 @@ int main(int argc, char *argv[]) {
fw = caca_get_canvas_width (figcv);
fh = caca_get_canvas_height(figcv);
- uint32_t x = (w/2) - (fw/2);
- uint32_t y = (h/2) - (fh/2);
+ x = (w/2) - (fw/2);
+ y = (h/2) - (fh/2);
caca_blit(cv, x, y, figcv, NULL);
caca_refresh_display(dp);
--
1.8.3.4