public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "David Seifert" <soap@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/galib/files/, sci-libs/galib/
Date: Sun, 25 Sep 2016 22:24:00 +0000 (UTC)	[thread overview]
Message-ID: <1474842203.7903e76836b83a49ddac62b9bc9c4aaa1238fbe2.soap@gentoo> (raw)

commit:     7903e76836b83a49ddac62b9bc9c4aaa1238fbe2
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 25 22:22:40 2016 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Sep 25 22:23:23 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7903e768

sci-libs/galib: Allow for compiling with GCC 6

Gentoo-bug: 594504
* Patch by Peter Levine
* EAPI=6
* [QA] Fix -Wformat-security errors
* Fix build system to honour CXX, AR, RANLIB properly

Package-Manager: portage-2.3.1

 .../galib/files/galib-2.4.7-Wformat-security.patch | 79 ++++++++++++++++++++
 .../galib/files/galib-2.4.7-fix-buildsystem.patch  | 65 +++++++++++++++++
 sci-libs/galib/files/galib-2.4.7-fix-c++14.patch   | 85 ++++++++++++++++++++++
 sci-libs/galib/galib-2.4.7-r1.ebuild               | 55 ++++++++++++++
 4 files changed, 284 insertions(+)

diff --git a/sci-libs/galib/files/galib-2.4.7-Wformat-security.patch b/sci-libs/galib/files/galib-2.4.7-Wformat-security.patch
new file mode 100644
index 00000000..faa7dcf
--- /dev/null
+++ b/sci-libs/galib/files/galib-2.4.7-Wformat-security.patch
@@ -0,0 +1,79 @@
+Fix -Wformat-security issues, as we do not want to install potentially
+dangerous example C++ files on user systems:
+* ex18.C: In function ‘int main(int, char**)’:
+* ex18.C:92:27: warning: format not a string literal and no format arguments [-Wformat-security]
+*   sprintf(filename, argv[i]);
+
+--- a/examples/ex18.C
++++ b/examples/ex18.C
+@@ -89,7 +89,7 @@
+         exit(1);
+       }
+       else{
+-	sprintf(filename, argv[i]);
++	sprintf(filename, "%s", argv[i]);
+         continue;
+       }
+     }
+--- a/examples/ex3.C
++++ b/examples/ex3.C
+@@ -71,7 +71,7 @@
+         exit(1);
+       }
+       else{
+-	sprintf(filename, argv[i]);
++	sprintf(filename, "%s", argv[i]);
+         continue;
+       }
+     }
+--- a/examples/ex5.C
++++ b/examples/ex5.C
+@@ -308,7 +308,7 @@
+         exit(1);
+       }
+       else{
+-        sprintf(filename1, argv[i]);
++        sprintf(filename1, "%s", argv[i]);
+         continue;
+       }
+     }
+@@ -318,7 +318,7 @@
+         exit(1);
+       }
+       else{
+-        sprintf(filename2, argv[i]);
++        sprintf(filename2, "%s", argv[i]);
+         continue;
+       }
+     }
+--- a/examples/ex7.C
++++ b/examples/ex7.C
+@@ -68,7 +68,7 @@
+         exit(1);
+       }
+       else{
+-	sprintf(datafile, argv[i]);
++	sprintf(datafile, "%s", argv[i]);
+         continue;
+       }
+     }
+@@ -78,7 +78,7 @@
+         exit(1);
+       }
+       else{
+-	sprintf(parmfile, argv[i]);
++	sprintf(parmfile, "%s", argv[i]);
+ 	params.read(parmfile);
+         continue;
+       }
+--- a/ga/gaerror.C
++++ b/ga/gaerror.C
+@@ -21,7 +21,7 @@
+ static STD_OSTREAM *__gaErrStream = & STD_CERR;
+ #endif
+ static GABoolean __gaErrFlag = gaTrue;
+-static char *__gaErrStr[] = {
++static const char *__gaErrStr[] = {
+   "error reading from file: ",
+   "error writing to file: ",
+   "unexpected EOF encountered during read.",

diff --git a/sci-libs/galib/files/galib-2.4.7-fix-buildsystem.patch b/sci-libs/galib/files/galib-2.4.7-fix-buildsystem.patch
new file mode 100644
index 00000000..3ed7ad8
--- /dev/null
+++ b/sci-libs/galib/files/galib-2.4.7-fix-buildsystem.patch
@@ -0,0 +1,65 @@
+Fix the build system, removing hardcoded values for toolchain variables.
+
+--- a/examples/makefile
++++ b/examples/makefile
+@@ -6,7 +6,6 @@
+ # want to compile.  See the README for a description of what each example does.
+ # -----------------------------------------------------------------------------
+ 
+-include ../makevars
+ 
+ # Set these paths to the location of the GA library and headers.
+ #GA_INC_DIR= /usr/local/include
+@@ -14,8 +13,6 @@
+ GA_INC_DIR= ..
+ GA_LIB_DIR= ../ga
+ 
+-INC_DIRS= -I$(GA_INC_DIR)
+-LIB_DIRS= -L$(GA_LIB_DIR)
+ 
+ EXS=randtest\
+  ex1  ex2  ex3  ex4  ex5  ex6  ex7  ex8  ex9\
+@@ -24,7 +21,7 @@
+ 
+ .SUFFIXES: .C
+ .C.o:
+-	$(CXX) $(CXXFLAGS) $(INC_DIRS) -c $<
++	$(CXX) $(CXXFLAGS) -I.. -c $<
+ 
+ all: $(EXS)
+ 
+@@ -34,7 +31,7 @@
+ 
+ # Use this for gnu make
+ $(EXS): %: %.o
+-	$(CXX) $@.o -o $@ $(LIB_DIRS) -lga -lm $(CXX_LIBS)
++	$(CXX) $@.o -o $@ -L../ga/ -lga -lm $(CXX_LIBS)
+ 
+ clean:
+ 	$(RM) $(EXS)
+--- a/ga/makefile
++++ b/ga/makefile
+@@ -14,7 +14,7 @@
+ 
+ $(LIB): $(OBJS) 
+ 	$(PRELINK)
+-	$(AR) $(LIB) $?
++	$(AR) rv $(LIB) $?
+ 	$(RANLIB) $(LIB)
+ 	echo "$(CXX) $(CXXFLAGS)" > BUILD
+ 	@echo $(LIB) is now up-to-date
+--- a/makevars
++++ b/makevars
+@@ -31,12 +31,7 @@
+ #  verified 06mar07 on linux-x86 (debian with gcc 3.3.5)
+ #  verified 06mar07 on linux-x86 (ubuntu with gcc 4.0.3)
+ #  verified 06mar07 on macosx-ppc (macosx 10.4.8 with gcc 4.0.1)
+-CXX         = g++
+-CXXFLAGS    = -g -Wall
+-LD          = g++ -w
+-AR          = ar rv
+ INSTALL     = install -c
+-RANLIB      = echo no ranlib
+ 
+ # gcc2
+ #  verified 28dec04 on linux-x86 (redhat 6.2 with gcc 2.95.2)

diff --git a/sci-libs/galib/files/galib-2.4.7-fix-c++14.patch b/sci-libs/galib/files/galib-2.4.7-fix-c++14.patch
new file mode 100644
index 00000000..babc84b
--- /dev/null
+++ b/sci-libs/galib/files/galib-2.4.7-fix-c++14.patch
@@ -0,0 +1,85 @@
+Fix building with C++14, which errors out due to stricter two-phase lookup.
+See also: https://bugs.gentoo.org/show_bug.cgi?id=594504
+
+Patch by Peter Levine
+
+--- a/ga/GA1DArrayGenome.C
++++ b/ga/GA1DArrayGenome.C
+@@ -222,8 +222,8 @@
+   aset = new GAAlleleSet<T>[1];
+   aset[0] = s;
+ 
+-  initializer(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_INITIALIZER);
+-  mutator(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_MUTATOR);
++  GAGenome::initializer(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_INITIALIZER);
++  GAGenome::mutator(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_MUTATOR);
+   comparator(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_COMPARATOR);
+   crossover(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_CROSSOVER);
+ }
+@@ -238,8 +238,8 @@
+   for(int i=0; i<naset; i++)
+     aset[i] = sa.set(i);
+ 
+-  initializer(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_INITIALIZER);
+-  mutator(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_MUTATOR);
++  GAGenome::initializer(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_INITIALIZER);
++  GAGenome::mutator(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_MUTATOR);
+   comparator(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_COMPARATOR);
+   crossover(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_CROSSOVER);
+ }
+--- a/ga/GA2DArrayGenome.C
++++ b/ga/GA2DArrayGenome.C
+@@ -269,10 +269,10 @@
+   aset = new GAAlleleSet<T>[1];
+   aset[0] = s;
+ 
+-  initializer(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
+-  mutator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_MUTATOR);
+-  comparator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
+-  crossover(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
++  GAGenome::initializer(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
++  GAGenome::mutator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_MUTATOR);
++  GAGenome::comparator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
++  GAGenome::crossover(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
+ }
+ 
+ template <class T> 
+@@ -286,10 +286,10 @@
+   for(int i=0; i<naset; i++)
+     aset[i] = sa.set(i);
+ 
+-  initializer(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
+-  mutator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_MUTATOR);
+-  comparator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
+-  crossover(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
++  GAGenome::initializer(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
++  GAGenome::mutator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_MUTATOR);
++  GAGenome::comparator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
++  GAGenome::crossover(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
+ }
+ 
+ 
+--- a/ga/GA3DArrayGenome.C
++++ b/ga/GA3DArrayGenome.C
+@@ -322,8 +322,8 @@
+   aset = new GAAlleleSet<T>[1];
+   aset[0] = s;
+ 
+-  initializer(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_INITIALIZER);
+-  mutator(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_MUTATOR);
++  GAGenome::initializer(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_INITIALIZER);
++  GAGenome::mutator(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_MUTATOR);
+   comparator(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_COMPARATOR);
+   crossover(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_CROSSOVER);
+ }
+@@ -339,8 +339,8 @@
+   for(int i=0; i<naset; i++)
+     aset[i] = sa.set(i);
+ 
+-  initializer(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_INITIALIZER);
+-  mutator(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_MUTATOR);
++  GAGenome::initializer(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_INITIALIZER);
++  GAGenome::mutator(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_MUTATOR);
+   comparator(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_COMPARATOR);
+   crossover(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_CROSSOVER);
+ }

diff --git a/sci-libs/galib/galib-2.4.7-r1.ebuild b/sci-libs/galib/galib-2.4.7-r1.ebuild
new file mode 100644
index 00000000..61d387b
--- /dev/null
+++ b/sci-libs/galib/galib-2.4.7-r1.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit toolchain-funcs
+
+MY_PV="${PV//\./}"
+
+DESCRIPTION="Library for genetic algorithms in C++ programs"
+HOMEPAGE="http://lancet.mit.edu/ga/"
+SRC_URI="http://lancet.mit.edu/ga/dist/galib${MY_PV}.tgz"
+
+LICENSE="BSD examples? ( GPL-2 )"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc examples"
+
+S="${WORKDIR}/${PN}${MY_PV}"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-2.4.7-fix-buildsystem.patch"
+	"${FILESDIR}/${PN}-2.4.7-fix-c++14.patch"
+	"${FILESDIR}/${PN}-2.4.7-Wformat-security.patch"
+)
+
+src_prepare() {
+	default
+	sed -e "s:/include:${EPREFIX}/usr/include:" \
+		-e "s:/lib:${EPREFIX}/usr/$(get_libdir):" \
+		-i makevars || die
+}
+
+src_compile() {
+	emake \
+		CXX="$(tc-getCXX)" \
+		AR="$(tc-getAR)" \
+		RANLIB="$(tc-getRANLIB)" \
+		lib
+	emake -C examples clean
+}
+
+src_install() {
+	dodir /usr/$(get_libdir)
+
+	use doc && HTML_DOCS+=( doc/. )
+	if use examples; then
+		dodoc -r examples
+		find "${ED%/}/usr/share/doc/${PF}/examples" -iname 'makefile*' -delete || die
+		docompress -x /usr/share/doc/${PF}/examples
+	fi
+
+	default
+}


             reply	other threads:[~2016-09-25 22:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-25 22:24 David Seifert [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-30  5:11 [gentoo-commits] repo/gentoo:master commit in: sci-libs/galib/files/, sci-libs/galib/ Michael Palimaka
2023-07-29 15:36 David Seifert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474842203.7903e76836b83a49ddac62b9bc9c4aaa1238fbe2.soap@gentoo \
    --to=soap@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox