commit:     1f68184f654095bb9337e90a7a674b9658f12959
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 29 09:55:46 2023 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Fri Sep 29 09:55:46 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1f68184f

sci-visualization/grace: Don't overwrite files by default

People can still use -noask option if they want. Also apply some C99 fixes
from Fedora.

Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>

 .../grace/files/grace-5.1.25-honor-noask.patch     |  13 +++
 sci-visualization/grace/files/grace-c99.patch      |  12 +++
 sci-visualization/grace/grace-5.1.25_p13-r2.ebuild | 116 +++++++++++++++++++++
 3 files changed, 141 insertions(+)

diff --git a/sci-visualization/grace/files/grace-5.1.25-honor-noask.patch 
b/sci-visualization/grace/files/grace-5.1.25-honor-noask.patch
new file mode 100644
index 000000000000..24285e478f04
--- /dev/null
+++ b/sci-visualization/grace/files/grace-5.1.25-honor-noask.patch
@@ -0,0 +1,13 @@
+--- a/src/files.c~     2008-04-26 20:25:57.000000000 +0200
++++ b/src/files.c      2023-09-26 11:39:24.232306135 +0200
+@@ -1098,10 +1098,6 @@
+     int noask_save = noask;
+     
+     old_fn = get_docname();
+-    if (compare_strings(old_fn, fn)) {
+-        /* If saving under the same name, don't warn about overwriting */
+-        noask = TRUE;
+-    }
+     
+     if ((cp = grace_openw(fn)) == NULL) {
+         noask = noask_save;

diff --git a/sci-visualization/grace/files/grace-c99.patch 
b/sci-visualization/grace/files/grace-c99.patch
new file mode 100644
index 000000000000..fb87e39848a9
--- /dev/null
+++ b/sci-visualization/grace/files/grace-c99.patch
@@ -0,0 +1,12 @@
+diff -ur grace-5.1.25.orig/src/utils.c grace-5.1.25/src/utils.c
+--- grace-5.1.25.orig/src/utils.c      2022-12-22 10:40:39.391625263 +0100
++++ grace-5.1.25/src/utils.c   2022-12-22 10:41:24.732188992 +0100
+@@ -1391,7 +1391,7 @@
+     update_app_title();
+ }
+ 
+-void lock_dirtystate(flag)
++void lock_dirtystate(int flag)
+ {
+     dirtystate_lock = flag;
+ }

diff --git a/sci-visualization/grace/grace-5.1.25_p13-r2.ebuild 
b/sci-visualization/grace/grace-5.1.25_p13-r2.ebuild
new file mode 100644
index 000000000000..7a5e42ca6de2
--- /dev/null
+++ b/sci-visualization/grace/grace-5.1.25_p13-r2.ebuild
@@ -0,0 +1,116 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+FORTRAN_NEEDED=fortran
+
+inherit desktop fortran-2 toolchain-funcs xdg
+
+DESCRIPTION="Motif based XY-plotting tool"
+HOMEPAGE="https://plasma-gate.weizmann.ac.il/Grace/";
+SRC_URI="
+       ftp://plasma-gate.weizmann.ac.il/pub/${PN}/src/stable/${P/_p*}.tar.gz
+       
mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${PV/_p*}-${PV/*_p}.debian.tar.xz
+"
+
+SLOT="0"
+LICENSE="GPL-2 LGPL-2"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="fftw fortran jpeg netcdf png"
+
+DEPEND="
+       media-libs/t1lib
+       media-libs/tiff:=
+       sys-libs/zlib
+       >=x11-libs/motif-2.3:0
+       x11-libs/xbae
+       fftw? ( sci-libs/fftw:3.0= )
+       jpeg? ( media-libs/libjpeg-turbo:= )
+       netcdf? ( sci-libs/netcdf:= )
+       png? ( media-libs/libpng:0= )"
+RDEPEND="${DEPEND}
+       x11-misc/xdg-utils"
+
+S="${WORKDIR}/${P/_p*}"
+
+PATCHES=(
+       # Fix for missing defines when fortran is disabled
+       "${FILESDIR}"/${PN}-5.1.21-fortran.patch
+       # Fix a leak (from freebsd)
+       "${FILESDIR}"/${PN}-5.1.22-dlmodule.patch
+       # Honor -noask option and avoid accidentally overwritting files
+       "${FILESDIR}"/${PN}-5.1.25-honor-noask.patch
+       # Fix C99 compat (from Fedora)
+       "${FILESDIR}"/${PN}-c99.patch
+)
+
+pkg_setup() {
+       fortran-2_pkg_setup
+}
+
+src_prepare() {
+       default
+
+       # Debian patches
+       for p in $(<"${WORKDIR}"/debian/patches/series) ; do
+               eapply -p1 "${WORKDIR}/debian/patches/${p}"
+       done
+
+       # don't strip if not asked for
+       sed -i \
+               -e 's:$(INSTALL_PROGRAM) -s:$(INSTALL_PROGRAM):g' \
+               {auxiliary,grconvert,src}/Makefile || die
+
+       sed -i \
+               -e 's:$(GRACE_HOME)/bin:$(PREFIX)/bin:g' \
+               -e "s:\$(GRACE_HOME)/lib:\$(PREFIX)/$(get_libdir):g" \
+               -e 's:$(GRACE_HOME)/include:$(PREFIX)/include:g' \
+               -e 's:$(PREFIX)/man:$(PREFIX)/share/man:g' \
+               Makefile */Makefile || die "sed failed"
+
+       sed -i \
+               -e 's:bin/grconvert:grconvert:' \
+               -e 's:auxiliary/fdf2fit:fdf2fit:' \
+               gracerc || die
+}
+
+src_configure() {
+       tc-export CC AR
+
+       # the configure script just produces a basic Make.conf
+       # and a config.h
+       econf \
+               --disable-pdfdrv \
+               --disable-xmhtml \
+               --without-bundled-xbae \
+               --without-bundled-t1lib \
+               --enable-grace-home="${EPREFIX}"/usr/share/${PN} \
+               --with-helpviewer="xdg-open %s" \
+               --with-editor="xdg-open %s" \
+               --with-printcmd="lpr" \
+               --x-includes="${EPREFIX}"/usr/include \
+               --x-libraries="${EPREFIX}"/usr/$(get_libdir) \
+               $(use_with fftw) \
+               $(use_enable fortran f77-wrapper) \
+               $(use_enable netcdf) \
+               $(use_enable jpeg jpegdrv) \
+               $(use_enable png pngdrv) \
+               $(use_with fortran f77 $(tc-getFC))
+}
+
+src_install() {
+       default
+
+       dosym ../../${PN}/examples /usr/share/doc/${PF}/examples
+       dosym ../../${PN}/doc /usr/share/doc/${PF}/html
+
+       doman "${ED}"/usr/share/doc/${PF}/html/*.1
+       rm -f "${ED}"/usr/share/doc/${PF}/html/*.1 || die
+
+       domenu "${FILESDIR}"/${PN}.desktop
+       for size in 16 22 24 32; do
+               newicon -s "${size}" 
"${WORKDIR}"/debian/icons/grace"${size}".png "${PN}.png"
+       done
+       doicon -s 48 "${WORKDIR}"/debian/icons/grace.png
+       doicon -s scalable "${WORKDIR}"/debian/grace.svg
+}

Reply via email to