Subject: [alpine-aports] [PATCH 1/2] main/fltk: enable opengl and fix Fl_XFont_On_Demand

From: Daniel Sabogal <[email-masked]>
Date: Sat, 1 Oct 2016 20:38:35 -0400

---
 main/fltk/APKBUILD                 | 25 +++++++++----------------
 main/fltk/Fl_XFont_On_Demand.patch | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 16 deletions(-)
 create mode 100644 main/fltk/Fl_XFont_On_Demand.patch

diff --git a/main/fltk/APKBUILD b/main/fltk/APKBUILD
index 8a1dc45..66fffc1 100644
--- a/main/fltk/APKBUILD
+++ b/main/fltk/APKBUILD
@@ -2,32 +2,22 @@
 # Maintainer: ScrumpyJack <[email-masked]>
 pkgname=fltk
 pkgver=1.3.3
-pkgrel=0
+pkgrel=1
 pkgdesc="A cross-platform C++ GUI toolkit"
 url="http://fltk.org"
 arch="all"
 license="GPL"
 depends=""
-depends_dev="libx11-dev libxext-dev libxft-dev"
+depends_dev="libx11-dev libxext-dev libxft-dev mesa-dev"
 makedepends="$depends_dev libpng-dev libjpeg-turbo-dev"
-install=""
 subpackages="$pkgname-doc $pkgname-dev $pkgname-fluid"
 source="http://fltk.org/pub/fltk/$pkgver/$pkgname-$pkgver-source.tar.gz
+	Fl_XFont_On_Demand.patch
 	ewmh-crash.patch"
-
-_builddir=$srcdir/${pkgname}-${pkgver}
-prepare() {
-	local i
-	cd "$_builddir"
-	for i in $source; do
-		case $i in
-		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
-		esac
-	done
-}
+builddir="$srcdir/$pkgname-$pkgver"
 
 build() {
-	cd "$_builddir"
+	cd "$builddir"
 	./configure \
 		--build=$CBUILD \
 		--host=$CHOST \
@@ -42,7 +32,7 @@ build() {

 package() {
-        cd "$_builddir"
+        cd "$builddir"
         make DESTDIR="$pkgdir" install || return 1
 	# remove static libs
 	rm "$pkgdir"/usr/lib/*.a || return 1
@@ -56,8 +46,11 @@ fluid() {
 }
 
 md5sums="9ccdb0d19dc104b87179bd9fd10822e3  fltk-1.3.3-source.tar.gz
+e33e95ed8aacf84048f7b175112f7837  Fl_XFont_On_Demand.patch
 0b1a9c825de9de368550d10728878019  ewmh-crash.patch"
 sha256sums="f8398d98d7221d40e77bc7b19e761adaf2f1ef8bb0c30eceb7beb4f2273d0d97  fltk-1.3.3-source.tar.gz
+afdd3dcbdf0b64bd813c28fb116663762dd81c19f535d8850a7c644b9005c788  Fl_XFont_On_Demand.patch
 15adf29c8d2885bc356943f05b3f22b2db42a5278a9a27d8b1bd3f342f3f4416  ewmh-crash.patch"
 sha512sums="277ba27e35c20e2d4fc5296bf418c5ab78c821870476e21d49f723765b99b3a559eed4ecd5215ac26d53a1091ada003e17f1553194cebaa97dd854809dd2885d  fltk-1.3.3-source.tar.gz
+0f094a3ac5e10f5736ffebb92abf12637b371b3b469f1aac4670114b788c9cd3c8cacf68ebe5d5d29db4d99094f14fdc19777aeacc784c90073659561055b574  Fl_XFont_On_Demand.patch
 7e7c43620c91f83da190227d829ebe652ccf1e02ad40e6b3d2631959716304612f447f2dffba0f19fc2c5191692e23581c438945f61669f4974845a1ac1e9929  ewmh-crash.patch"
diff --git a/main/fltk/Fl_XFont_On_Demand.patch b/main/fltk/Fl_XFont_On_Demand.patch
new file mode 100644
index 0000000..4b51089
--- /dev/null
+++ b/main/fltk/Fl_XFont_On_Demand.patch
@@ -0,0 +1,36 @@
+--- fltk-1.3.3/src/fl_font.cxx
++++ fltk-1.3.3/src/fl_font.cxx
+@@ -55,6 +55,12 @@
+ #  include "fl_font_x.cxx"
+ #endif // WIN32
+ 
++#if ! (defined(WIN32) || defined(__APPLE__))
++XFontStruct *fl_X_core_font()
++{
++  return fl_xfont.value();
++}
++#endif
+ 
+ double fl_width(const char* c) {
+   if (c) return fl_width(c, (int) strlen(c));
+--- fltk-1.3.3/src/gl_draw.cxx
++++ fltk-1.3.3/src/gl_draw.cxx
+@@ -81,7 +81,7 @@
+  * then sorting through them at draw time (for normal X rendering) to find which one can
+  * render the current glyph... But for now, just use the first font in the list for GL...
+  */
+-    XFontStruct *font = fl_xfont;
++    XFontStruct *font = fl_X_core_font();
+     int base = font->min_char_or_byte2;
+     int count = font->max_char_or_byte2-base+1;
+     fl_fontsize->listbase = glGenLists(256);
+--- fltk-1.3.3/FL/x.H
++++ fltk-1.3.3/FL/x.H
+@@ -132,6 +132,7 @@
+   XFontStruct *ptr;
+ };
+ extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
++extern FL_EXPORT XFontStruct* fl_X_core_font();
+ 
+ // this object contains all X-specific stuff about a window:
+ // Warning: this object is highly subject to change!  
-- 
2.10.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Daniel Sabogal <[email-masked]>
Date: Sat, 1 Oct 2016 20:38:36 -0400

https://www.gnu.org/software/octave/
A high-level language, primarily intended for numerical computations
---
 testing/octave/APKBUILD             | 67 +++++++++++++++++++++++++++++++++++++
 testing/octave/abs.patch            | 27 +++++++++++++++
 testing/octave/gnulib.patch         | 11 ++++++
 testing/octave/less-docs.patch      | 11 ++++++
 testing/octave/libinterp-deps.patch | 10 ++++++
 5 files changed, 126 insertions(+)
 create mode 100644 testing/octave/APKBUILD
 create mode 100644 testing/octave/abs.patch
 create mode 100644 testing/octave/gnulib.patch
 create mode 100644 testing/octave/less-docs.patch
 create mode 100644 testing/octave/libinterp-deps.patch

diff --git a/testing/octave/APKBUILD b/testing/octave/APKBUILD
new file mode 100644
index 0000000..a9824c4
--- /dev/null
+++ b/testing/octave/APKBUILD
@@ -0,0 +1,67 @@
+# Contributor: Daniel Sabogal <[email-masked]>
+# Maintainer:
+pkgname=octave
+pkgver=4.0.3
+pkgrel=0
+pkgdesc="A high-level language, primarily intended for numerical computations"
+url="https://www.gnu.org/software/octave/"
+arch="all"
+license="GPL3"
+depends=""
+subpackages="$pkgname-doc"
+makedepends="autoconf automake bison curl fftw-dev fltk-dev fontconfig-dev
+	freetype-dev gfortran glu-dev gnuplot imagemagick-dev hdf5-dev
+	lapack-dev libsm-dev libltdl lcms2-dev pcre-dev perl pkgconf qt-dev
+	readline-dev texinfo zlib-dev"
+source="ftp://ftp.gnu.org/gnu/octave/$pkgname-$pkgver.tar.xz
+	less-docs.patch
+	libinterp-deps.patch
+	abs.patch
+	gnulib.patch"
+builddir="$srcdir/$pkgname-$pkgver"
+
+prepare() {
+	default_prepare || return 1
+
+	cd "$builddir"
+	find -name \*.cc -o -name \*.h -o -name \*.yy | xargs sed -i -e 's/#include <c\(math\|stdlib\)>/#include <\1.h>/'
+	find -name \*.h -o -name \*.cc | xargs sed -i -e 's/<config.h>/"config.h"/' -e 's/<base-list.h>/"base-list.h"/'
+}
+
+build() {
+	cd "$builddir"
+	./configure \
+                --build=$CBUILD \
+                --host=$CHOST \
+                --prefix=/usr \
+                --sysconfdir=/etc \
+		--infodir=/usr/share/info \
+                --mandir=/usr/share/man \
+                --localstatedir=/var \
+		--enable-shared \
+		--disable-static \
+		|| return 1
+	make || return 1
+}
+
+package() {
+	make DESTDIR="$pkgdir/" \
+		-C "$builddir" install || return 1
+	rm -rf "$pkgdir"/usr/lib/charset.alias
+}
+
+md5sums="73b140bc69ac21cfaa3e473b91b6842b  octave-4.0.3.tar.xz
+79635f1a1a0fd1b583a4a01555cc40e8  less-docs.patch
+a9e3611f8526c609751dae3c35afaa8c  libinterp-deps.patch
+e08fd7a3d035fde524dd92ed0603ce57  abs.patch
+e22f7385ef92fab75191c8925455c097  gnulib.patch"
+sha256sums="dc2bec8c68fa5733a5847563634b1729356a84f3a5071008ecdb793293f0aa85  octave-4.0.3.tar.xz
+2f6c87158b73c2d5881d3f5ae5b4e6811398b8868ae9ba9b202631f4b0588296  less-docs.patch
+1cbfb7648783a9320a7a03f0f391074af5d1318bef796ddffd2d9cbacc685d22  libinterp-deps.patch
+28ac40c2e4dbafac313f34a68560da42027815b08a880d44c61f97d9c660ce04  abs.patch
+75562bd81b6cb44e9e5bacf8b1ba556df565001f9dea7960a4346073ed997c33  gnulib.patch"
+sha512sums="bad009235b04be09c051dd27ebef7df2542adec0a0b57c070662deebe33a0cdceb7d6816653f5afc3fc0cc1287ba1ca1a5c50858169004210224039374c9c55d  octave-4.0.3.tar.xz
+d1f1e4c475cbeeac805c5ffefe19e1a65185259dfc55dabc5debc57b184de3573065c3879295ec42101ac3c7a57798c56330793eef84ae361c09e61ed3dc0f0c  less-docs.patch
+5ae08ddcdea63804154f5ba3808369558f717fd696f1a4ee7dccfd96c52cdb8afc85a564522d5b0cdc83c1f0a7f5ef8d509a293af2d227c8f0fe188420349733  libinterp-deps.patch
+52ff16908f5ffb736dfb442bf1950b7595d8999464bbcb8265b754b8a3bdfe4f18fe5194bd4ec8606219d0e70fc82d60429e8c3c4aa33b8eb1fe54c2c5490ca2  abs.patch
+50d9a7cefc0d39b666b646abe26148d7640ed2c4505244e3b5d4ba4348f80fc5d0d08465a575682fcae88d245bf72e7ba13df580003a2c5de6b7b222131a5392  gnulib.patch"
diff --git a/testing/octave/abs.patch b/testing/octave/abs.patch
new file mode 100644
index 0000000..e7059f3
--- /dev/null
+++ b/testing/octave/abs.patch
@@ -0,0 +1,27 @@
+diff -up octave-4.0.0/libinterp/corefcn/pr-output.cc.abs octave-4.0.0/libinterp/corefcn/pr-output.cc
+--- octave-4.0.0/libinterp/corefcn/pr-output.cc.abs	2015-05-23 08:21:53.000000000 -0600
++++ octave-4.0.0/libinterp/corefcn/pr-output.cc	2016-02-21 08:59:30.966291273 -0700
+@@ -21,7 +21,7 @@ along with Octave; see the file COPYING.
+ */
+ 
+ #ifdef HAVE_CONFIG_H
+-#include <config.h>
++#include "config.h"
+ #endif
+ 
+ #include <cfloat>
+@@ -3145,6 +3145,14 @@ PRINT_INT_SCALAR_INTERNAL (uint32_t)
+ PRINT_INT_SCALAR_INTERNAL (int64_t)
+ PRINT_INT_SCALAR_INTERNAL (uint64_t)
+ 
++inline unsigned int abs (unsigned int x) { return x; }
++inline long unsigned int abs (long unsigned int x) { return x; }
++inline long long unsigned int abs (long long unsigned int x) { return x; }
++inline short unsigned int abs (short unsigned int x) { return x; }
++inline unsigned char abs (unsigned char x) { return x; }
++inline signed char abs (signed char x) { return abs((int)x); }
++inline short int abs (short int x) { return abs((int)x); }
++
+ template <class T>
+ /* static */ inline void
+ octave_print_internal_template (std::ostream& os, const intNDArray<T>& nda,
diff --git a/testing/octave/gnulib.patch b/testing/octave/gnulib.patch
new file mode 100644
index 0000000..e83fb15
--- /dev/null
+++ b/testing/octave/gnulib.patch
@@ -0,0 +1,11 @@
+diff -up octave-4.0.0/liboctave/cruft/Faddeeva/Faddeeva.hh.gnulib octave-4.0.0/liboctave/cruft/Faddeeva/Faddeeva.hh
+--- octave-4.0.0/liboctave/cruft/Faddeeva/Faddeeva.hh.gnulib	2015-05-23 08:21:53.000000000 -0600
++++ octave-4.0.0/liboctave/cruft/Faddeeva/Faddeeva.hh	2016-02-19 19:50:04.693811663 -0700
+@@ -27,6 +27,7 @@
+ #ifndef FADDEEVA_HH
+ #define FADDEEVA_HH 1
+ 
++#include <math.h>
+ #include <complex>
+ 
+ namespace Faddeeva {
diff --git a/testing/octave/less-docs.patch b/testing/octave/less-docs.patch
new file mode 100644
index 0000000..c46ee25
--- /dev/null
+++ b/testing/octave/less-docs.patch
@@ -0,0 +1,11 @@
+--- octave-4.0.3/doc/interpreter/Makefile.in.orig
++++ octave-4.0.3/doc/interpreter/Makefile.in
+@@ -3357,7 +3357,7 @@
+ plot-textproperties.texi: genpropdoc.m
+ 	$(AM_V_GEN)$(call gen-propdoc-texi,text)
+ 
+-all-local: dvi html pdf ps doc-cache
++all-local: doc-cache
+ 
+ html: $(HTMLDIR_IMAGES)
+ 
diff --git a/testing/octave/libinterp-deps.patch b/testing/octave/libinterp-deps.patch
new file mode 100644
index 0000000..6fd09a0
--- /dev/null
+++ b/testing/octave/libinterp-deps.patch
@@ -0,0 +1,10 @@
+--- octave-4.0.3/libinterp/link-deps.mk.orig
++++ octave-4.0.3/libinterp/link-deps.mk
+@@ -10,6 +10,7 @@
+   $(FT2_LIBS) \
+   $(HDF5_LIBS) \
+   $(MAGICK_LIBS) \
++  $(Z_LIBS) \
+   $(FFTW_XLIBS) \
+   $(OPENGL_LIBS) \
+   $(X11_LIBS) \
-- 
2.10.0

---