x11-misc/xmountains: Fix CFLAGS=-fno-common
authorJeroen Roovers <jer@gentoo.org>
Mon, 27 Jan 2020 04:20:45 +0000 (05:20 +0100)
committerJeroen Roovers <jer@gentoo.org>
Mon, 27 Jan 2020 04:21:15 +0000 (05:21 +0100)
Package-Manager: Portage-2.3.85, Repoman-2.3.20
Closes: https://bugs.gentoo.org/show_bug.cgi?id=706606
Signed-off-by: Jeroen Roovers <jer@gentoo.org>
x11-misc/xmountains/files/xmountains-2.9-fno-common.patch [new file with mode: 0644]
x11-misc/xmountains/files/xmountains-2.9-global.patch [new file with mode: 0644]
x11-misc/xmountains/files/xmountains-2.9-main.patch [new file with mode: 0644]
x11-misc/xmountains/files/xmountains-2.9-string.patch [new file with mode: 0644]
x11-misc/xmountains/xmountains-2.9-r1.ebuild

diff --git a/x11-misc/xmountains/files/xmountains-2.9-fno-common.patch b/x11-misc/xmountains/files/xmountains-2.9-fno-common.patch
new file mode 100644 (file)
index 0000000..e7140ca
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/X_graphics.c
++++ b/X_graphics.c
+@@ -10,7 +10,6 @@
+ #include "paint.h"
+ char X_graphics_Id[]="$Id: X_graphics.c,v 1.26 2009/08/28 09:09:17 spb Exp $";
+-char *display=NULL;       /* name of display to open, NULL for default */
+ char *geom=NULL;          /* geometry of window, NULL for default */
+ Atom wm_protocols;
+@@ -264,7 +263,8 @@
+   graph_height = gptr->graph_height;
+ /*{{{open display*/
+-  dpy = XOpenDisplay(display);
++/* display to open, NULL for default */
++  dpy = XOpenDisplay(NULL);
+   
+   if( ! dpy )
+   {
diff --git a/x11-misc/xmountains/files/xmountains-2.9-global.patch b/x11-misc/xmountains/files/xmountains-2.9-global.patch
new file mode 100644 (file)
index 0000000..77ce47a
--- /dev/null
@@ -0,0 +1,26 @@
+--- a/Makefile.alt.JeR
++++ b/Makefile.alt
+@@ -8,17 +8,17 @@
+ LOCAL_LIBRARIES = -lX11 
+   SYS_LIBRARIES = -lm
+-           SRCS = calcalt.c random.c  artist.c global.c xmountains.c X_graphics.c print_alg.c
+-           OBJS = calcalt.o random.o  artist.o global.o xmountains.o X_graphics.o print_alg.o
+-           HDRS = crinkle.h global.h paint.h patchlevel.h copyright.h
++           SRCS = calcalt.c random.c  artist.c  xmountains.c X_graphics.c print_alg.c
++           OBJS = calcalt.o random.o  artist.o  xmountains.o X_graphics.o print_alg.o
++           HDRS = crinkle.h  paint.h patchlevel.h copyright.h
+ xmountains: $(OBJS)
+       $(CC) $(LDFLAGS) -o xmountains $(OBJS) -lX11 -lm
+ calcalt.o: crinkle.h
+-artist.o: global.h paint.h crinkle.h
+-global.o: crinkle.h paint.h
+-xmountains.o: paint.h global.h patchlevel.h copyright.h crinkle.h
++artist.o:  paint.h crinkle.h
++: crinkle.h paint.h
++xmountains.o: paint.h  patchlevel.h copyright.h crinkle.h
+ X_graphics.o: paint.h crinkle.h
diff --git a/x11-misc/xmountains/files/xmountains-2.9-main.patch b/x11-misc/xmountains/files/xmountains-2.9-main.patch
new file mode 100644 (file)
index 0000000..2629778
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/xmountains.c
++++ b/xmountains.c
+@@ -144,7 +144,7 @@
+ void seed_uni(int ijkl);
+ void plot_column(Graph *g);
+-main (argc,argv)
++int main (argc,argv)
+ int argc;
+ char **argv;
+ {
diff --git a/x11-misc/xmountains/files/xmountains-2.9-string.patch b/x11-misc/xmountains/files/xmountains-2.9-string.patch
new file mode 100644 (file)
index 0000000..c78569a
--- /dev/null
@@ -0,0 +1,8 @@
+--- a/xmountains.c.JeR
++++ b/xmountains.c
+@@ -1,4 +1,5 @@
++#include <string.h> /* strcmp() */
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <strings.h>
index 712987fe73bd1176ca82432eb69c0a54848d437a..3ba1649dc3fdb2d9c0f3b88d193b3c690ff50a09 100644 (file)
@@ -1,43 +1,39 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
-
+EAPI=7
 inherit toolchain-funcs
 
-MY_P=${P/-/_}
-
 DESCRIPTION="Fractal terrains of snow-capped mountains near water"
 HOMEPAGE="https://spbooth.github.io/xmountains/"
-SRC_URI="http://www.epcc.ed.ac.uk/~spb/${PN}/${MY_P}.tar.gz"
+SRC_URI="http://www.epcc.ed.ac.uk/~spb/${PN}/${P/-/_}.tar.gz"
 
 LICENSE="HPND"
 SLOT="0"
 KEYWORDS="amd64 ppc x86"
-IUSE=""
 
 RDEPEND="
        x11-libs/libX11
-       x11-misc/xbitmaps"
-DEPEND="${RDEPEND}
-       x11-base/xorg-proto"
-
+       x11-misc/xbitmaps
+"
+DEPEND="
+       ${RDEPEND}
+       x11-base/xorg-proto
+"
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.9-fno-common.patch
+       "${FILESDIR}"/${PN}-2.9-global.patch
+       "${FILESDIR}"/${PN}-2.9-main.patch
+       "${FILESDIR}"/${PN}-2.9-string.patch
+)
 S=${WORKDIR}
 
-src_prepare() {
-       default
-       # add missing include for strcmp
-       sed -i xmountains.c -e '1a#include <string.h> /* strcmp() */' || die
-       # remove obsolete references to global.*
-       sed -i Makefile.alt README -e 's|global\..||g' || die
-}
-
 src_compile() {
        emake \
                -f Makefile.alt \
                CC="$(tc-getCC)" \
                CFLAGS="${CFLAGS}" \
-               LDFLAGS="${LDFLAGS}" \
+               LDFLAGS="${CFLAGS} ${LDFLAGS}" \
                ${PN}
 }