Update agg recipe, still broken

Tested on gcc2h:
* agg: examples can't find symbol agg_main__FiPPc
* agg_x86: some examples run, but the lib crashes in ~pod_bvector
This commit is contained in:
Kacper Kasper
2014-04-25 20:28:35 +00:00
parent eeca43ef14
commit f57795b8a0
3 changed files with 304 additions and 38 deletions

View File

@@ -3,67 +3,103 @@ DESCRIPTION="
Anti-Grain Geometry (AGG) is an Open Source, free of charge graphic library, \
written in industrially standard C++.
"
HOMEPAGE="http://antigrain.com"
SRC_URI="http://www.antigrain.com/agg-2.5.tar.gz"
HOMEPAGE="http://en.wikipedia.org/wiki/Anti-Grain_Geometry"
SRC_URI="http://gnashdev.org/tools/ltib/agg-2.5.tar.gz"
CHECKSUM_SHA256="ab1edc54cc32ba51a62ff120d501eecd55fceeedf869b9354e7e13812289911f"
REVISION="1"
REVISION="2"
LICENSE="GNU GPL v2"
COPYRIGHT="2002-2006 Maxim Shemanarev"
ARCHITECTURES="?x86_gcc2 ?x86"
SECONDARY_ARCHITECTURES="?x86_gcc2 ?x86"
ARCHITECTURES="!x86_gcc2 !x86"
SECONDARY_ARCHITECTURES="!x86_gcc2 !x86"
PROVIDES="
lib:libagg$secondaryArchSuffix = $portVersion
agg$secondaryArchSuffix = $portVersion
lib:libagg$secondaryArchSuffix = 2.0.4 compat >= 2
lib:libaggfontfreetype$secondaryArchSuffix = 2.0.4 compat >= 2
lib:libagggpc$secondaryArchSuffix = 2.0.4 compat >= 2
lib:libaggplatformHaiku$secondaryArchSuffix = 2.0.4 compat >= 2
"
REQUIRES="
haiku$secondaryArchSuffix >= $haikuVersion
lib:libsdl$secondaryArchSuffix
lib:libz$secondaryArchSuffix
lib:libbz2$secondaryArchSuffix
lib:libpng$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel >= $haikuVersion
devel:libsdl$secondaryArchSuffix
devel:libsdl_1.2$secondaryArchSuffix
devel:libz$secondaryArchSuffix
devel:libbz2$secondaryArchSuffix
devel:libpng$secondaryArchSuffix
devel:libfreetype$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:autoconf
cmd:autoheader
cmd:automake
cmd:ld$secondaryArchSuffix
cmd:libtoolize
cmd:sed
cmd:pkg_config$secondaryArchSuffix
"
SOURCE_DIR="agg-2.5"
PATCHES="agg-2.5.patchset"
BUILD()
{
#libtoolize --force --copy --install
#aclocal
#autoheader
#autoconf
#automake --foreign --add-missing --ignore-deps
#./configure --prefix=$prefix
#make
cd src
g++ -o libagg.so -shared -fPIC *.cpp ctrl/*.cpp -I../include -lbe -ltranslation
if [ -d src/platform/BeOS ]; then
mv src/platform/BeOS src/platform/Haiku
fi
aclocal
autoheader
autoconf
libtoolize --force
automake --foreign --add-missing --ignore-deps
runConfigure ./configure \
--enable-ctrl \
--enable-gpc \
--enable-platform \
--enable-examples
make $jobArgs
}
INSTALL()
{
mkdir -p $libDir
mkdir -p $includeDir/agg
mkdir -p $developLibDir
make install
cp src/libagg.so $libDir
cp src/libagg.so $developLibDir
cp -r include/* $includeDir/agg/
packageEntries devel \
$developDir
prepareInstalledDevelLibs libagg libagggpc libaggfontfreetype \
libaggplatformHaiku libaggplatformsdl
fixPkgconfig
# fix include path in pkgconfig
sed -i -e 's#^includedir=\(.*\)#includedir=\1/agg2#g' \
$developLibDir/pkgconfig/libagg.pc
packageEntries devel $developDir $dataRootDir/aclocal
packageEntries sdl $libDir/libaggplatformsdl*
}
PROVIDES_devel="
devel:libagg$secondaryArchSuffix = $portVersion
agg${secondaryArchSuffix}_devel = $portVersion
devel:libagg$secondaryArchSuffix = 2.0.4 compat >= 2
devel:libaggfontfreetype$secondaryArchSuffix = 2.0.4 compat >= 2
devel:libagggpc$secondaryArchSuffix = 2.0.4 compat >= 2
devel:libaggplatformHaiku$secondaryArchSuffix = 2.0.4 compat >= 2
devel:libaggplatformsdl$secondaryArchSuffix = 2.0.4 compat >= 2
"
REQUIRES_devel="
lib:libagg$secondaryArchSuffix == $portVersion base
agg$secondaryArchSuffix == $portVersion base
"
PROVIDES_sdl="
agg${secondaryArchSuffix}_sdl = $portVersion
lib:libaggplatformsdl$secondaryArchSuffix = 2.0.4 compat >= 2
"
REQUIRES_sdl="
agg$secondaryArchSuffix == $portVersion base
haiku$secondaryArchSuffix >= $haikuVersion
lib:libsdl_1.2$secondaryArchSuffix
lib:libGL$secondaryArchSuffix
"

View File

@@ -1,9 +0,0 @@
diff -urN agg-2.5/Makefile.am agg-2.5-haiku/Makefile.am
--- agg-2.5/Makefile.am 2006-10-09 04:06:36.031719424 +0000
+++ agg-2.5-haiku/Makefile.am 2011-01-05 16:03:11.000000000 +0000
@@ -1,4 +1,4 @@
-SUBDIRS = gpc src font_freetype font_win32_tt include examples
+SUBDIRS = gpc src font_freetype font_win32_tt include
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libagg.pc

View File

@@ -0,0 +1,239 @@
From 7a5199ab842d8aa425590ffc5419ad3015abbc10 Mon Sep 17 00:00:00 2001
From: Kacper Kasper <kacperkasper@gmail.com>
Date: Thu, 24 Apr 2014 20:00:29 +0000
Subject: Haiku support
diff --git a/configure.in b/configure.in
index fceca82..d06dc7f 100644
--- a/configure.in
+++ b/configure.in
@@ -8,7 +8,7 @@ dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_ISC_POSIX
-AM_C_PROTOTYPES
+
if test "x$U" != "x"; then
AC_MSG_ERROR(Compiler not ANSI compliant)
fi
@@ -58,9 +58,18 @@ dnl #### Check if we are compiling for win32 #####
AC_SUBST(WINDOWS_LIBS)
PREFERED_PLATFORM=win32
;;
+ *haiku*)
+ haiku_host=yes
+ HAIKU_LIBS="-lbe -ltranslation"
+ HAIKU_CFLAGS=
+ AC_SUBST(HAIKU_CFLAGS)
+ AC_SUBST(HAIKU_LIBS)
+ PREFERED_PLATFORM=Haiku
+ ;;
esac
AM_CONDITIONAL(ENABLE_WIN32,[test x$win32_host = xyes -a x$enable_platform != xno ])
AM_CONDITIONAL(ENABLE_OSX,[test x$osx_host = xyes -a x$enable_platform != xno ])
+AM_CONDITIONAL(ENABLE_HAIKU,[test x$haiku_host = xyes -a x$enable_platform != xno ])
dnl then enable font_win32tt
AC_ARG_ENABLE(win32tt,
AC_HELP_STRING([--enable-win32tt],[Win32 TrueType font support library]),
@@ -154,7 +163,7 @@ AC_OUTPUT(
src/platform/sdl/Makefile
src/platform/mac/Makefile
src/platform/win32/Makefile
- src/platform/BeOS/Makefile
+ src/platform/Haiku/Makefile
src/platform/AmigaOS/Makefile
include/Makefile
include/ctrl/Makefile
diff --git a/src/platform/BeOS/Makefile.am b/src/platform/BeOS/Makefile.am
index 474153c..2095717 100644
--- a/src/platform/BeOS/Makefile.am
+++ b/src/platform/BeOS/Makefile.am
@@ -1 +1,10 @@
-EXTRA_DIST=agg_platform_support.cpp
+if ENABLE_HAIKU
+
+lib_LTLIBRARIES = libaggplatformHaiku.la
+
+libaggplatformHaiku_la_LDFLAGS = -version-info @AGG_LIB_VERSION@
+libaggplatformHaiku_la_SOURCES = agg_platform_support.cpp
+libaggplatformHaiku_la_CXXFLAGS = -I$(top_srcdir)/include @HAIKU_CFLAGS@
+libaggplatformHaiku_la_LIBADD = @HAIKU_LIBS@
+endif
+
diff --git a/src/platform/Makefile.am b/src/platform/Makefile.am
index ebe5e7e..c6622bc 100644
--- a/src/platform/Makefile.am
+++ b/src/platform/Makefile.am
@@ -1 +1 @@
-SUBDIRS = X11 sdl win32 AmigaOS BeOS mac
+SUBDIRS = X11 sdl win32 AmigaOS Haiku mac
--
1.8.3.4
From 6aadf8ccb0db0ba33c33220ed9c70d078163ee02 Mon Sep 17 00:00:00 2001
From: Kacper Kasper <kacperkasper@gmail.com>
Date: Fri, 25 Apr 2014 12:52:34 +0000
Subject: fix unsigned integer overflows
diff --git a/include/agg_array.h b/include/agg_array.h
index 5c6d390..c25947a 100644
--- a/include/agg_array.h
+++ b/include/agg_array.h
@@ -366,9 +366,10 @@ namespace agg
void add_array(const T* ptr, unsigned num_elem)
{
- while(num_elem--)
+ while(num_elem > 0)
{
add(*ptr++);
+ --num_elem;
}
}
@@ -526,10 +527,11 @@ namespace agg
if(m_num_blocks)
{
T** blk = m_blocks + m_num_blocks - 1;
- while(m_num_blocks--)
+ while(m_num_blocks > 0)
{
pod_allocator<T>::deallocate(*blk, block_size);
--blk;
+ --m_num_blocks;
}
}
pod_allocator<T*>::deallocate(m_blocks, m_max_blocks);
@@ -802,10 +804,11 @@ namespace agg
if(m_num_blocks)
{
block_type* blk = m_blocks + m_num_blocks - 1;
- while(m_num_blocks--)
+ while(m_num_blocks > 0)
{
pod_allocator<int8u>::deallocate(blk->data, blk->size);
--blk;
+ --m_num_blocks;
}
pod_allocator<block_type>::deallocate(m_blocks, m_max_blocks);
}
diff --git a/include/agg_pixfmt_rgba.h b/include/agg_pixfmt_rgba.h
index 79d10dc..73937d0 100644
--- a/include/agg_pixfmt_rgba.h
+++ b/include/agg_pixfmt_rgba.h
@@ -703,9 +703,9 @@ namespace agg
}
if(sa)
{
- calc_type dr = p[Order::R] - sr;
- calc_type dg = p[Order::G] - sg;
- calc_type db = p[Order::B] - sb;
+ calc_type dr = (sr > p[Order::R]) ? 0 : p[Order::R] - sr;
+ calc_type dg = (sg > p[Order::G]) ? 0 : p[Order::G] - sg;
+ calc_type db = (sb > p[Order::B]) ? 0 : p[Order::B] - sb;
p[Order::R] = (dr > base_mask) ? 0 : dr;
p[Order::G] = (dg > base_mask) ? 0 : dg;
p[Order::B] = (db > base_mask) ? 0 : db;
diff --git a/include/agg_rasterizer_cells_aa.h b/include/agg_rasterizer_cells_aa.h
index d3bb138..6aa3852 100644
--- a/include/agg_rasterizer_cells_aa.h
+++ b/include/agg_rasterizer_cells_aa.h
@@ -140,10 +140,11 @@ namespace agg
if(m_num_blocks)
{
cell_type** ptr = m_cells + m_num_blocks - 1;
- while(m_num_blocks--)
+ while(m_num_blocks > 0)
{
pod_allocator<cell_type>::deallocate(*ptr, cell_block_size);
ptr--;
+ --m_num_blocks;
}
pod_allocator<cell_type*>::deallocate(m_cells, m_max_blocks);
}
@@ -666,23 +667,26 @@ namespace agg
cell_type* cell_ptr;
unsigned nb = m_num_cells >> cell_block_shift;
unsigned i;
- while(nb--)
+ while(nb > 0)
{
cell_ptr = *block_ptr++;
i = cell_block_size;
- while(i--)
+ while(i > 0)
{
m_sorted_y[cell_ptr->y - m_min_y].start++;
++cell_ptr;
+ --i;
}
+ --nb;
}
cell_ptr = *block_ptr++;
i = m_num_cells & cell_block_mask;
- while(i--)
+ while(i > 0)
{
m_sorted_y[cell_ptr->y - m_min_y].start++;
++cell_ptr;
+ --i;
}
// Convert the Y-histogram into the array of starting indexes
@@ -697,27 +701,30 @@ namespace agg
// Fill the cell pointer array sorted by Y
block_ptr = m_cells;
nb = m_num_cells >> cell_block_shift;
- while(nb--)
+ while(nb > 0)
{
cell_ptr = *block_ptr++;
i = cell_block_size;
- while(i--)
+ while(i > 0)
{
sorted_y& curr_y = m_sorted_y[cell_ptr->y - m_min_y];
m_sorted_cells[curr_y.start + curr_y.num] = cell_ptr;
++curr_y.num;
++cell_ptr;
+ --i;
}
+ --nb;
}
cell_ptr = *block_ptr++;
i = m_num_cells & cell_block_mask;
- while(i--)
+ while(i > 0)
{
sorted_y& curr_y = m_sorted_y[cell_ptr->y - m_min_y];
m_sorted_cells[curr_y.start + curr_y.num] = cell_ptr;
++curr_y.num;
++cell_ptr;
+ --i;
}
// Finally arrange the X-arrays
diff --git a/include/agg_rendering_buffer.h b/include/agg_rendering_buffer.h
index 3a39caa..1fddb4e 100644
--- a/include/agg_rendering_buffer.h
+++ b/include/agg_rendering_buffer.h
@@ -191,10 +191,11 @@ namespace agg
T** rows = &m_rows[0];
- while(height--)
+ while(height > 0)
{
*rows++ = row_ptr;
row_ptr += stride;
+ --height;
}
}
--
1.8.3.4