Subject: [alpine-aports] [PATCH] testing/vice: new aport

From: Jean-Louis Fuchs <[email-masked]>
Date: Fri, 20 Jan 2017 22:38:42 +0100

---
 testing/vice/APKBUILD               | 54 +++++++++++++++++++++++++++++++++++++
 testing/vice/disable-fc-cache.patch | 16 +++++++++++
 testing/vice/fix__u_char.patch      | 13 +++++++++
 3 files changed, 83 insertions(+)
 create mode 100644 testing/vice/APKBUILD
 create mode 100644 testing/vice/disable-fc-cache.patch
 create mode 100644 testing/vice/fix__u_char.patch

diff --git a/testing/vice/APKBUILD b/testing/vice/APKBUILD
new file mode 100644
index 0000000000..93357acf64
--- /dev/null
+++ b/testing/vice/APKBUILD
@@ -0,0 +1,54 @@
+# Contributor: Jean-Louis Fuchs <[email-masked]>
+# Maintainer: Jean-Louis Fuchs <[email-masked]>
+pkgname=vice
+pkgver=3.0
+pkgrel=0
+pkgdesc="emulates the C64/DTV, C128, VIC20, almost all PETs, PLUS4 and CBM-II"
+url="http://vice-emu.sourceforge.net/"
+arch="all"
+license="GPL"
+depends=""
+makedepends="sdl2-dev giflib-dev ffmpeg-dev jpeg-dev alsa-lib-dev
+	linux-headers texinfo automake autoconf bison flex"
+install=""
+subpackages="$pkgname-doc"
+source="http://downloads.sourceforge.net/vice-emu/vice-$pkgver.tar.gz
+	disable-fc-cache.patch
+	fix__u_char.patch"
+builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+	cd "$builddir"
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+	sed -i 's/lib64/lib/g' configure.ac
+	autoreconf -fi
+}
+
+build() {
+	cd "$builddir"
+	./configure --prefix=/usr \
+		--libdir=/usr/lib \
+		--enable-sdlui2 \
+		--disable-no-pic \
+		--enable-external-ffmpeg \
+		|| return 1
+	make || return 1
+}
+
+package() {
+	cd "$builddir"
+	make DESTDIR="$pkgdir" realdocdir="/usr/share/doc/vice" install || return 1
+}
+md5sums="c732d76a70ac1232a43456dae540b43a  vice-3.0.tar.gz
+b1dee4fef59f835534683fabbe1fbbce  disable-fc-cache.patch
+938c5f35c0318f87f88ccca5708c45ee  fix__u_char.patch"
+sha256sums="bc56811381920d43ab5f2f85a5e08f21ab5bdf6190dd5dfe9f500a745d14972b  vice-3.0.tar.gz
+8058210e092c4943a55baeff47e6d5f3661aeb3686fd1f75e07f47888da9cc98  disable-fc-cache.patch
+d60bfda7dcf6e384a4fda09f789e9230cca2bafb542487e24141d2e9f186ad7a  fix__u_char.patch"
+sha512sums="60d33e644d9977df81ffbdceff8c4feec750de9597cfa9f37c4aa236eabbf507373e6f936e2cc3b06f3e7298e0390d1e098242bfacd6435e628a13991a6a452b  vice-3.0.tar.gz
+ed6fee34eefcb04c42b4575591dfeffca8548eae354dee66dabdbc4abac0311cbbedcdc07cdfcb01da4840d57ab331a31583e17160820462a2c064835a75d75d  disable-fc-cache.patch
+66f416ebb9fb7e1d9ac35c31a8d784acc48cefa4b72c7a9de4e2dc110ed39a5fa46642a0db56ee4e8a3fc84c61cd2584bc0cfe792318b2fd34adf606ebb5be69  fix__u_char.patch"
diff --git a/testing/vice/disable-fc-cache.patch b/testing/vice/disable-fc-cache.patch
new file mode 100644
index 0000000000..c685b676d4
--- /dev/null
+++ b/testing/vice/disable-fc-cache.patch
@@ -0,0 +1,16 @@
+--- a/configure.ac.orig	2016-12-15 04:44:32.000000000 +0100
++++ b/configure.ac	2017-01-05 23:24:59.072247182 +0100
+@@ -2998,12 +2998,7 @@ if test x"$enable_lame" != "xno" ; then
+ 
+ fi
+ 
+-AC_PATH_PROGS(FCCACHE, fc-cache, false)
+-if test x"$FCCACHE" = "xfalse"; then
+-  AM_CONDITIONAL(HAVE_FC_CACHE, false)
+-else
+-  AM_CONDITIONAL(HAVE_FC_CACHE, true)
+-fi
++AM_CONDITIONAL(HAVE_FC_CACHE, false)
+ 
+ if test x"$is_amigaos4" = "xyes"; then
+   if test x"$enable_sdlui" != "xyes" -a x"$enable_sdlui2" != "xyes"; then
diff --git a/testing/vice/fix__u_char.patch b/testing/vice/fix__u_char.patch
new file mode 100644
index 0000000000..bd59b81818
--- /dev/null
+++ b/testing/vice/fix__u_char.patch
@@ -0,0 +1,13 @@
+diff -ru a/src/opencbm.h b/src/opencbm.h
+--- a/src/opencbm.h	2016-11-14 00:23:10.000000000 +0100
++++ b/src/opencbm.h	2017-01-20 19:54:12.098939871 +0100
+@@ -131,6 +131,9 @@
+ 
+ #endif
+ 
++/* There is no __u_char on alpine linux */
++#define __u_char unsigned char /*!< __u_char as unsigned char */
++
+ /* specifiers for the IEC bus lines */
+ #define IEC_DATA   0x01 /*!< Specify the DATA line */
+ #define IEC_CLOCK  0x02 /*!< Specify the CLOCK line */
-- 
2.11.0

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

---

From: Leonardo Arena <[email-masked]>
Date: Mon, 23 Jan 2017 12:12:50 +0100

Hi,

>  testing/vice/APKBUILD               | 54

Would you please use here "default_prepare || return 1" ?

Other than this it looks good.

Thanks!

-|_eo

---

From: Jean-Louis Fuchs <[email-masked]>
Date: Tue, 24 Jan 2017 16:15:36 +0100

---
Since ocaml can use the library either at run-time (interpreter) like a
python-module or to do native compile: I disabled the -dev split. Please review.

 testing/lablgtk/APKBUILD | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 testing/lablgtk/APKBUILD

diff --git a/testing/lablgtk/APKBUILD b/testing/lablgtk/APKBUILD
new file mode 100644
index 0000000000..81dce38d9e
--- /dev/null
+++ b/testing/lablgtk/APKBUILD
@@ -0,0 +1,44 @@
+# Contributor: Jean-Louis Fuchs <[email-masked]>
+# Maintainer: Jean-Louis Fuchs <[email-masked]>
+pkgname=lablgtk
+pkgver=2.18.5
+pkgrel=0
+pkgdesc="LablGtk - an OCaml interface to GTK+ 2.x"
+url="http://lablgtk.forge.ocamlcore.org/"
+arch="all"
+license="GPL"
+# Most files are used for run-time and/or native-compile, so we don't do
+# a dev split
+depends="ocaml-findlib camlp4 ocaml gtk+-dev gtkspell-dev librsvg-dev
+	gtksourceview2-dev"
+makedepends="$depends"
+install=""
+subpackages="$pkgname-doc"
+source="https://forge.ocamlcore.org/frs/download.php/1627/lablgtk-$pkgver.tar.gz"
+builddir="$srcdir/lablgtk-$pkgver"
+
+build() {
+	cd "$builddir"
+	./configure --prefix=/usr || return 1
+	make world || return 1
+	make opt || return 1
+	make doc || return 1
+}
+
+
+doc() {
+    pkgdesc="$pkgdesc (documentation)"
+    _docdir="$subpkgdir"/usr/share/doc/$pkgname/
+    mkdir -p "$_docdir"
+    cp -r "$builddir"/doc/html/* "$_docdir"
+}
+
+package() {
+	cd "$builddir"
+	make DESTDIR="$pkgdir" install || return 1
+	rm -f "$pkgdir"/usr/lib/ocaml/ld.conf
+}
+
+md5sums="43eb7062439f7ddd0d8ad96c3e3b87dd  lablgtk-2.18.5.tar.gz"
+sha256sums="2bf251db21c077fdd26c035ea03edd8fe609187f908e520e87a8ffdd9c36d233  lablgtk-2.18.5.tar.gz"
+sha512sums="7b6ba1a4dfa82cc3bbc502082ff4fccc23cc06ee4f30d01a2e423f3f99e945a4befe450d230b5aa19c5b810e9f46f2838655099d49da2db7c8a2e52eac213024  lablgtk-2.18.5.tar.gz"
-- 
2.11.0

---

---

From: Leonardo Arena <[email-masked]>
Date: Wed, 25 Jan 2017 13:46:02 +0100

Hi,

> python-module or to do native compile: I disabled the -dev split.

The dev stuff is ~5 MB, half of the package size (10MB).
I'm not familiar with ocaml. What would be the inconvenience in having
a separate -dev pkg? Would a user just want to use it at run-time only
or it's an unlikely scenario?
From Alpine packaging perspective only, 5 MB less in the system are
definitely worthy a pkg separation.

Thanks!

-|_eo

---

From: Jean-Louis Fuchs <[email-masked]>
Date: Wed, 25 Jan 2017 14:25:47 +0100

Hi |_eo

On Wed, Jan 25, 2017 at 01:46:02PM +0100, Leonardo Arena wrote:

I'm not familiar with ocaml, except for building unison.

> a separate -dev pkg?

If you do a native install you need lablgtk and lablgtk-dev. I thought
it might lead to confusion. I think we have these options:

1. Have the dev split and develeopers just have to remember installing
   both packages if they want to do a native-compile.

2. Add lablgtk to depends_dev, so if you intend to do a native-compile
   you will automatically get lablgtk.

3. My current solution.

I first wanted to go for 2. And then thought it might be considered a
hack.

> Would a user just want to use it at run-time only

I guess a user never wants run-time only, since the distribution
usually does a native-compile. For example the native-compile package
of unison doesn't need lablgtk at run-time since its all linked into
unison.

But a ocaml developer probably wants run-time only, because he is
using the interpreter during development.

> definitely worthy a pkg separation.

So I guess we have to go for 1. or 2. let me know if 2. is ok.

Best,
    Jean-Louis

---

From: Leonardo Arena <[email-masked]>
Date: Fri, 27 Jan 2017 14:35:43 +0100

> So I guess we have to go for 1. or 2. let me know if 2. is ok.

Solution 2 sounds good to me.

I'm merged this patch and unison with this modification.

Thanks!

|_eo

---

From: Jean-Louis Fuchs <[email-masked]>
Date: Mon, 23 Jan 2017 13:05:42 +0100

---
Changes v2:

* Using default_prepare
* return 1 on sed and autoreconf failure

 testing/vice/APKBUILD               | 49 +++++++++++++++++++++++++++++++++++++
 testing/vice/disable-fc-cache.patch | 16 ++++++++++++
 testing/vice/fix__u_char.patch      | 13 ++++++++++
 3 files changed, 78 insertions(+)
 create mode 100644 testing/vice/APKBUILD
 create mode 100644 testing/vice/disable-fc-cache.patch
 create mode 100644 testing/vice/fix__u_char.patch

index 0000000000..c183325c0b
@@ -0,0 +1,49 @@
+	default_prepare || return 1
+	sed -i 's/lib64/lib/g' configure.ac || return 1
+	autoreconf -fi || return 1

---

---

From: Leonardo Arena <[email-masked]>
Date: Mon, 23 Jan 2017 13:42:52 +0100

sorry but patching fails:

>>> vice: fix__u_char.patch
patching file src/opencbm.h
Hunk #1 FAILED at 131 (different line endings).
1 out of 1 hunk FAILED -- saving rejects to file src/opencbm.h.rej

Can you send an updated patch? Also please note that APKBUILD checksums
are not updated.

Thanks!

-|_eo

---

From: Jean-Louis Fuchs <[email-masked]>
Date: Mon, 23 Jan 2017 14:12:56 +0100

Hi |_eo

> Can you send an updated patch? Also please note that APKBUILD checksums

I'm not 100% sure, but I think the problem lies on your end. According
to this stackoverflow article:

http://stackoverflow.com/questions/6289001/git-am-format-patch-control-format-of-line-endings/6677017#6677017

you should use:

git am --keep-cr

The whole problem is caused by opencbm.h using DOS line endings.

Please let me know if I am wrong. I'll then research the problem
further.

Best,
    Jean-Louis

---

From: Jean-Louis Fuchs <[email-masked]>
Date: Tue, 24 Jan 2017 21:54:55 +0100

---
Prevent unexpected error applying this commit by:

* Removing \r from the fix__u_char.patch
* Removing \r from opencbm.h in prepare()

 testing/vice/APKBUILD               | 50 +++++++++++++++++++++++++++++++++++++
 testing/vice/disable-fc-cache.patch | 16 ++++++++++++
 testing/vice/fix__u_char.patch      | 13 ++++++++++
 3 files changed, 79 insertions(+)
 create mode 100644 testing/vice/APKBUILD
 create mode 100644 testing/vice/disable-fc-cache.patch
 create mode 100644 testing/vice/fix__u_char.patch

index 0000000000..cba38c709c
@@ -0,0 +1,50 @@
+	sed -i 's/\r//' "$builddir"/src/opencbm.h || return 1
+f562fcd4ce5b6a72008cc46d9ed19881  fix__u_char.patch"
+6e888ea744659e1da2f1d4df57e0bf9bf031b8ad8414b08581f085c6336c9a77  fix__u_char.patch"
+3132be50c402068865b530ed9df71a073012623ce48e3fa162f33af7bdcdd6d890590955868bb5591e018c17359e860ccff9eb0cde9bfd99582ac921400e8f2f  fix__u_char.patch"
index 0000000000..046ae82a05

---