summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sci-astronomy')
-rw-r--r--sci-astronomy/esomidas/Manifest1
-rw-r--r--sci-astronomy/esomidas/esomidas-15.09.ebuild148
-rw-r--r--sci-astronomy/esomidas/files/esomidas-cleanmidas.patch24
-rw-r--r--sci-astronomy/esomidas/files/esomidas-fitswdb.patch46
-rw-r--r--sci-astronomy/esomidas/files/esomidas-fitswdm_c.patch48
-rw-r--r--sci-astronomy/esomidas/files/esomidas-gentoo-setup.patch14
-rw-r--r--sci-astronomy/esomidas/files/esomidas-log-stdout.patch67
-rw-r--r--sci-astronomy/esomidas/files/esomidas-manpages.patch54
-rw-r--r--sci-astronomy/esomidas/files/esomidas-mdb_put.patch29
-rw-r--r--sci-astronomy/esomidas/files/esomidas-no-sp_pty.patch17
-rw-r--r--sci-astronomy/esomidas/files/esomidas-no-strip.patch29
-rw-r--r--sci-astronomy/esomidas/files/esomidas-propagate-flags.patch86
-rw-r--r--sci-astronomy/esomidas/files/esomidas-rarthm_for.patch43
-rw-r--r--sci-astronomy/esomidas/files/esomidas-selechar_c.patch51
-rw-r--r--sci-astronomy/esomidas/files/esomidas-syskeys.patch23
-rw-r--r--sci-astronomy/esomidas/files/esomidas-system-readline.patch83
-rw-r--r--sci-astronomy/esomidas/files/esomidas-x11-include-path.patch13
-rw-r--r--sci-astronomy/esomidas/metadata.xml16
18 files changed, 792 insertions, 0 deletions
diff --git a/sci-astronomy/esomidas/Manifest b/sci-astronomy/esomidas/Manifest
new file mode 100644
index 000000000000..6d71d144816a
--- /dev/null
+++ b/sci-astronomy/esomidas/Manifest
@@ -0,0 +1 @@
+DIST esomidas-15.09.tar.gz 60770911 SHA256 74f1ea0e4cce958c67f5f2db061a073c9fb05190d9c1f1612e77888282a194be SHA512 774029ac2e79a563a1c94c5de4f7cb74f18695e8f83f3d939208bdde656d1e83783e2ae276ae841a3b5c7eaf81946111c3c02ace1b74899e98f1b1dd15ba320b WHIRLPOOL a7135f9f47fa53dbe60288afbcdf462f3f7327736ae473c43766185b1a57836eb2cf120705d9db495d62a5a26efca533afd6cc5719a7c4c4d224fe301234584e
diff --git a/sci-astronomy/esomidas/esomidas-15.09.ebuild b/sci-astronomy/esomidas/esomidas-15.09.ebuild
new file mode 100644
index 000000000000..7efe5eb54a72
--- /dev/null
+++ b/sci-astronomy/esomidas/esomidas-15.09.ebuild
@@ -0,0 +1,148 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit eutils fortran-2 toolchain-funcs flag-o-matic
+
+# MIDVERS is actually used by MIDAS configuration scripts
+export MIDVERS="15SEPpl1.0"
+
+DESCRIPTION="European Southern Observatory Munich Image Data Analysis System"
+HOMEPAGE="http://www.eso.org/projects/esomidas/"
+SRC_URI="ftp://ftp.eso.org/pub/midaspub/15SEP/sources/${MIDVERS}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0/8"
+KEYWORDS="~amd64 ~x86"
+
+IUSE=""
+
+RDEPEND="
+ sys-libs/readline:0=
+ x11-libs/motif:0=
+ x11-libs/libX11:=
+ x11-libs/libXt:="
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${MIDVERS}"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-gentoo-setup.patch"
+ "${FILESDIR}/${PN}-cleanmidas.patch"
+ "${FILESDIR}/${PN}-fitswdb.patch"
+ "${FILESDIR}/${PN}-fitswdm_c.patch"
+ "${FILESDIR}/${PN}-log-stdout.patch"
+ "${FILESDIR}/${PN}-manpages.patch"
+ "${FILESDIR}/${PN}-mdb_put.patch"
+ "${FILESDIR}/${PN}-no-sp_pty.patch"
+ "${FILESDIR}/${PN}-no-strip.patch"
+ "${FILESDIR}/${PN}-rarthm_for.patch"
+ "${FILESDIR}/${PN}-selechar_c.patch"
+ "${FILESDIR}/${PN}-system-readline.patch"
+ "${FILESDIR}/${PN}-x11-include-path.patch"
+ "${FILESDIR}/${PN}-propagate-flags.patch"
+ "${FILESDIR}/${PN}-syskeys.patch"
+)
+
+src_prepare() {
+ default
+ # variables for all phases and midas internal build system
+ export MIDASHOME="${WORKDIR}"
+ export MID_HOME="${S}"
+ export MID_HOME0="/usr/$(get_libdir)/esomidas/${MIDVERS}"
+ export MID_INSTALL="${MID_HOME}/install/unix"
+ export MID_SYS="${MID_HOME}/system/unix/"
+ export MID_WORK="${MIDASHOME}/midwork"
+
+ # create a gentoo option file
+ mkdir ${MID_INSTALL}/systems/Gentoo || die
+ cat >> ${MID_INSTALL}/systems/Gentoo/make_options <<-EOF
+ CC=$(tc-getCC)
+ LDCC=$(tc-getCC)
+ F77=$(tc-getFC)
+ FC=$(tc-getFC)
+ LD77_CMD=$(tc-getFC)
+ AR=$(tc-getAR)
+ RANLIB=$(tc-getRANLIB)
+ F_OPT=
+ C_OPT=
+ E_OPT=$(use amd64 && echo -Z)
+ SYS=
+ SH_OPT=-fPIC
+ SH_CMD=${MIDASHOME}/${MIDVERS}/local/make_shared
+ GUI_OPT=-DPATH_MAX=1024
+ STRIP=echo
+ EDITFLAGS=-DVOID_SIGHANDLER -DHAVE_ALLOCA -DHAVE_ALLOCA_H -DHAVE_GETPW_DECLS -DHAVE_DIRENT_H -DHAVE_STRING_H -DLinux -DHAVE_UNISTD_H -DHAVE_STDLIB_H
+ EDITLIBS=-lreadline
+ UIMX=uimxR5
+ INSTALL_FLAG=auto
+ EOF
+ sed -e "s|gcc|$(tc-getCC) \${LDFLAGS}|" \
+ ${MID_INSTALL}/systems/Linux/make_shared \
+ > ${MID_INSTALL}/systems/Gentoo/make_shared || die
+ sed -e 's|PC/Linux|Gentoo|' \
+ ${MID_INSTALL}/systems/Linux/setup \
+ > ${MID_INSTALL}/systems/Gentoo/setup || die
+
+ # gentoo readline avoids exporting the xmalloc,xrealloc and xfree
+ append-cppflags -Dxrealloc=_rl_realloc -Dxmalloc=_rl_malloc -Dxfree=_rl_free
+}
+
+src_configure() {
+ ${MID_INSTALL}/select all || die "packages selection failed"
+ ${MID_INSTALL}/preinstall -a || die "preinstallation failed"
+ ${MID_INSTALL}/install2 || die "configuration failed"
+ chmod 755 ${MID_HOME}/local/make_shared
+}
+
+src_compile() {
+ CMND_YES=2 ${MID_INSTALL}/install3 -a || die "compilation failed"
+ [[ -x ${MID_HOME}/monit/midasgo.exe ]] || die "somewhere compilation failed"
+ emake -C monit syskeys.unix
+ ${MID_SYS}/inmidas -m ${MID_WORK} -j "@ compile.all"
+ ${MID_SYS}/inmidas -m ${MID_WORK} -j "@ ascii_bin no ; bye"
+}
+
+src_test() {
+ local test_dir="${WORKDIR}/test_tmp"
+ mkdir ${test_dir} && cd ${test_dir}
+ ${MID_SYS}/inmidas -m ${MID_WORK} -j "@ vericopy ; @@ veriall -nodisplay ; bye" || die
+ test -f ${MID_WORK}/veriall_* || die "tests failed somewhere"
+ rm -rf ${test_dir}
+}
+
+src_install() {
+ yes | ${MID_SYS}/cleanmidas
+ find ${MID_HOME} \( \
+ -name "*.a" -o \
+ -name "makefile" -o \
+ -name "default.mk" -o \
+ -name "*.h" -o \
+ -name "*.inc" -o \
+ -name COPYING -o \
+ -name "*~" -o \
+ -name "*.mod" \) -delete
+ rm -rf ${MID_HOME}/libsrc/ftoc*
+ find ${MID_HOME} -type d -empty -delete
+
+ sed -e "s:^MIDVERS0=.*:MIDVERS0=${MIDVERS}:" \
+ -e "s:^MIDASHOME0=.*:MIDASHOME0=/usr/$(get_libdir)/esomidas:" \
+ -i ${MID_HOME}/system/unix/{inmidas,helpmidas,drs}
+
+ cd "${WORKDIR}"
+ dodir /usr/$(get_libdir)/esomidas
+ mv "${S}" "${ED}"${MID_HOME0}
+ chmod 0644 "${ED}"${MID_HOME0}/contrib/baches/*/*.fit \
+ "${ED}"${MID_HOME0}/contrib/baches/*/*.fmt \
+ "${ED}"${MID_HOME0}/contrib/baches/*/*.datorg \
+ "${ED}"${MID_HOME0}/contrib/baches/*/*.prg \
+ "${ED}"${MID_HOME0}/contrib/baches/*/*.README
+ find "${ED}"${MID_HOME0} -name \*.sh | xargs chmod 0755
+ chmod 0755 "${ED}"${MID_HOME0}/util/bench/brun
+
+ dosym ${MID_HOME0}/system/unix/inmidas /usr/bin/inmidas
+ dosym ${MID_HOME0}/system/unix/gomidas /usr/bin/gomidas
+ dosym ${MID_HOME0}/system/ftoc-new ${MID_HOME0}/system/good-ftoc
+}
diff --git a/sci-astronomy/esomidas/files/esomidas-cleanmidas.patch b/sci-astronomy/esomidas/files/esomidas-cleanmidas.patch
new file mode 100644
index 000000000000..53f234749844
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-cleanmidas.patch
@@ -0,0 +1,24 @@
+Author: Ole Streicher <olebole@debian.org>
+Description: Use predefined MIDVERS and MIDASHOME in cleanmidas
+ Cleanmidas assumes the the parent directory of "15FEBpl1.1" is "midas",
+ which is not required in the installation guide.
+--- a/system/unix/cleanmidas
++++ b/system/unix/cleanmidas
+@@ -54,11 +54,13 @@
+ [ $answer = y ]
+ }
+
+-
+ MID_HERE=`pwd`
+-MIDVERS=`echo $MID_HERE | sed 's/^.*midas\/\([^\/]*\).*$/\1/'`
+-MIDASHOME=`echo $MID_HERE | sed 's/\/'$MIDVERS'.*$//'`
+-
++if [ -z "$MIDVERS" ] ; then
++ MIDVERS=`echo $MID_HERE | sed 's/^.*midas\/\([^\/]*\).*$/\1/'`
++fi
++if [ -z "$MIDASHOME" ] ; then
++ MIDASHOME=`echo $MID_HERE | sed 's/\/'$MIDVERS'.*$//'`
++fi
+ MID_HOME=$MIDASHOME/$MIDVERS
+
+ export MIDASHOME MIDVERS
diff --git a/sci-astronomy/esomidas/files/esomidas-fitswdb.patch b/sci-astronomy/esomidas/files/esomidas-fitswdb.patch
new file mode 100644
index 000000000000..b0459a1317ec
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-fitswdb.patch
@@ -0,0 +1,46 @@
+Author: Ole Streicher <olebole@debian.org>
+Description: Another off-by-one
+ Fixes:
+ .
+ ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff9e7713b1 at pc 0x7f4135c48c7c bp 0x7fff9e770e20 sp 0x7fff9e770e18
+WRITE of size 1 at 0x7fff9e7713b1 thread T0
+ #0 0x7f4135c48c7b in fitswdb prim/dio/libsrc/fitswdb.c:243
+ #1 0x7f4135c4a61c in fitswhd prim/dio/libsrc/fitswhd.c:450
+ #2 0x7f4135caab6e in SCFSAV libsrc/st/scfa.c:157
+ #3 0x7f4135caff75 in SCFCLO libsrc/st/scfb.c:483
+ #4 0x7f4135cba83e in SCSEPI libsrc/st/scs.c:353
+ #5 0x7f4135cc6cd8 in stsepi_ libsrc/ftoc/sts.c:67
+ #6 0x409fb7 in statis prim/display/src/statis.f:1034
+ #7 0x40549c in main prim/display/src/statis.f:1056
+ #8 0x7f4134de2b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
+ #9 0x405a92 (prim/exec/statis.exe+0x405a92)
+
+Address 0x7fff9e7713b1 is located in stack of thread T0 at offset 1265 in frame
+ #0 0x7f4135c45c7f in fitswdb prim/dio/libsrc/fitswdb.c:88
+
+ This frame has 21 object(s):
+ [32, 36) 'nv'
+ [...]
+ [1056, 1137) 'com'
+ [1184, 1265) 'cval' <== Memory access at offset 1265 overflows this variable
+ [1312, 1393) 'line'
+ [1440, 1521) 'help'
+
+--- a/prim/dio/libsrc/fitswdb.c
++++ b/prim/dio/libsrc/fitswdb.c
+@@ -240,12 +240,12 @@
+ if (dtk->ctl==NCTL || dtk->ctl==SCTL) {
+ nc = (MXLB<nbp) ? MXLB : nbp;
+ SCDRDC(mfd,md->name,1,ns,nc,&nv,cval,unit,&null);
+- cval[nv] = '\0';
+- for (nn=0; nn<nv; nn++)
++ cval[nv-1] = '\0';
++ for (nn=0; nn<nv-1; nn++)
+ if (cval[nn]<' ' || '~'<cval[nn])
+ cval[nn] = ' ';
+ if(dtk->ctl==SCTL) {
+- ival = nv-1;
++ ival = nv-2;
+ while (ival && cval[ival]==' ') ival--;
+ cval[++ival] = '\0';
+ }
diff --git a/sci-astronomy/esomidas/files/esomidas-fitswdm_c.patch b/sci-astronomy/esomidas/files/esomidas-fitswdm_c.patch
new file mode 100644
index 000000000000..625208d08eff
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-fitswdm_c.patch
@@ -0,0 +1,48 @@
+Author: Ole Streicher <olebole@debian.org>
+Description: fix nullification of fitswdm.c
+ Fitswdm.c uses toNULLLONG to set an integer to some minimal value
+ (funnily, not 0 but LONG_MIN!). However, this will lead to a wrong
+ result if long!=int, since the argument is an int. On LinuxAMD64, this
+ was fixed, but not generally. This patch make the special case for
+ LinuxAMD64 as the general one.
+--- a/prim/dio/libsrc/fitswdm.c
++++ b/prim/dio/libsrc/fitswdm.c
+@@ -237,12 +237,7 @@
+ { /* NULL fill if needed */
+ pi = p.i + ns;
+ i = n - ns;
+-
+-#ifdef LinuxAMD64
+ while (i--) toNULLINT (*pi++);
+-#else
+- while (i--) toNULLLONG (*pi++);
+-#endif
+ }
+ ioff += n;
+ np = 4 * ns;
+@@ -279,12 +274,7 @@
+ while (n--)
+ if (isNULLFLOAT (*pf))
+ {
+-
+-#ifdef LinuxAMD64
+ toNULLINT (*pi++);
+-#else
+- toNULLLONG (*pi++);
+-#endif
+ *pf++;
+ }
+ else
+@@ -332,12 +322,7 @@
+ while (n--)
+ if (isNULLFLOAT (*pd))
+ {
+-
+-#ifdef LinuxAMD64
+ toNULLINT (*pi++);
+-#else
+- toNULLLONG (*pi++);
+-#endif
+ *pd++;
+ }
+ else
diff --git a/sci-astronomy/esomidas/files/esomidas-gentoo-setup.patch b/sci-astronomy/esomidas/files/esomidas-gentoo-setup.patch
new file mode 100644
index 000000000000..8b894bb2e597
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-gentoo-setup.patch
@@ -0,0 +1,14 @@
+--- a/install/unix/preinstall
++++ b/install/unix/preinstall
+@@ -121,7 +121,10 @@
+ urels=`(uname -r) 2>/dev/null`
+ machine=`(uname -m) 2>/dev/null`
+
+-if [ "$uname" = "Darwin" ]; then
++if [ -d "Gentoo" -a -f "/etc/gentoo-release" ]; then
++ system="Gentoo"
++
++elif [ "$uname" = "Darwin" ]; then
+ system="Darwin"
+
+ elif [ "$machine" = "x86_64" ]; then
diff --git a/sci-astronomy/esomidas/files/esomidas-log-stdout.patch b/sci-astronomy/esomidas/files/esomidas-log-stdout.patch
new file mode 100644
index 000000000000..b7cc37643209
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-log-stdout.patch
@@ -0,0 +1,67 @@
+Author: Ole Streicher <debian@liska.ath.cx>
+Description: Run compilation in foreground and write log to stdout
+ instead of a file.
+--- a/install/unix/install3
++++ b/install/unix/install3
+@@ -112,8 +112,6 @@
+
+ echo ""
+ echo "WARNING: MIDAS installation will delete all dependent files."
+-echo " It will run in background and the output will be sent to"
+-echo " the file <$MID_HOME/tmp/install.$$>"
+ echo ""
+ echo "Do you want to continue [yn]? (y): " $SV_NONL
+ unset answ
+@@ -138,17 +136,9 @@
+
+ # do we have the 'time' command?
+ if [ $CMND_YES = 2 ] ; then
+- /bin/bash $MID_INSTALL/install -i > $MID_HOME/tmp/install.$$ 2>&1 &
++ /bin/bash $MID_INSTALL/install -i
+ else
+- time /bin/bash $MID_INSTALL/install -i > $MID_HOME/tmp/install.$$ 2>&1 &
++ time /bin/bash $MID_INSTALL/install -i
+ fi
+
+-echo "Running install in background"
+-echo "Results are coming in $MID_HOME/tmp/install.$$"
+-if [ "$1" = "-a" ]; then
+- echo "Waiting for MIDAS installation to finish..." $SV_NONL
+- wait
+- echo "Finished."
+- echo ""
+-fi
+ exit 0
+--- a/lib/makefile
++++ b/lib/makefile
+@@ -18,7 +18,7 @@
+
+ include ../local/default.mk
+
+-DEV_NULL = >/dev/null 2>&1
++DEV_NULL =
+
+ LIBMIDAS = $(LIBDIR)/libmidas.a
+ LIBGMIDAS = $(LIBDIR)/libgmidas.a
+--- a/system/ftoc/makefile
++++ b/system/ftoc/makefile
+@@ -12,7 +12,7 @@
+ include ../../local/default.mk
+
+ DEV_NULL= >/dev/null 2>&1
+-# DEV_NULL=
++DEV_NULL=
+
+ M = ../exec
+
+--- a/system/machine/makefile
++++ b/system/machine/makefile
+@@ -16,7 +16,7 @@
+
+ include ../../local/default.mk
+
+-DEV_NULL= >/dev/null 2>&1
++DEV_NULL=
+
+ M = ../exec
+
diff --git a/sci-astronomy/esomidas/files/esomidas-manpages.patch b/sci-astronomy/esomidas/files/esomidas-manpages.patch
new file mode 100644
index 000000000000..466996df399e
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-manpages.patch
@@ -0,0 +1,54 @@
+Author: Ole Streicher <debian@liska.ath.cx>
+Description: Put the manpages in chapter "1" instead of "1L".
+ They are not local in Debian.
+--- a/system/unix/man1/gomidas.1
++++ b/system/unix/man1/gomidas.1
+@@ -2,7 +2,7 @@
+ .\" Copyright (c) 1989 European Southern Observatory.
+ .\" All rights reserved.
+ .\"
+-.TH gomidas 1L "07 July 1993" MIDAS
++.TH gomidas 1 "07 July 1993" MIDAS
+ .SH NAME
+ gomidas \- Resume a MIDAS session.
+ .SH SYNOPSIS
+@@ -56,4 +56,4 @@
+ .IP "\fBMID_WORK\fp"
+ Startup directory for MIDAS containing previous MIDAS saved-session files.
+ .SH SEE ALSO
+-.IR inmidas(1L)
++.IR inmidas(1)
+--- a/system/unix/man1/helpmidas.1
++++ b/system/unix/man1/helpmidas.1
+@@ -2,7 +2,7 @@
+ .\" Copyright (c) 1989 European Southern Observatory.
+ .\" All rights reserved.
+ .\"
+-.TH helpmidas 1L "07 July 1993" MIDAS
++.TH helpmidas 1 "07 July 1993" MIDAS
+ .SH NAME
+ helpmidas \- Standalone GUI help for MIDAS.
+ .SH SYNOPSIS
+@@ -71,4 +71,4 @@
+ .IP "\fBMID_WORK\fp"
+ Startup directory for MIDAS.
+ .SH SEE ALSO
+-.IR inmidas(1L),gomidas(1L)
++.IR inmidas(1),gomidas(1)
+--- a/system/unix/man1/inmidas.1
++++ b/system/unix/man1/inmidas.1
+@@ -2,7 +2,7 @@
+ .\" Copyright (c) 1989 European Southern Observatory.
+ .\" All rights reserved.
+ .\"
+-.TH inmidas 1L "11 November 1994" MIDAS
++.TH inmidas 1 "11 November 1994" MIDAS
+ .SH NAME
+ inmidas \- MIDAS start-up procedure for users.
+ .SH SYNOPSIS
+@@ -145,4 +145,4 @@
+ .IP "\fBMID_WORK\fp"
+ Startup directory for MIDAS.
+ .SH SEE ALSO
+-.IR gomidas(1L)
++.IR gomidas(1)
diff --git a/sci-astronomy/esomidas/files/esomidas-mdb_put.patch b/sci-astronomy/esomidas/files/esomidas-mdb_put.patch
new file mode 100644
index 000000000000..eceb4cbadff1
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-mdb_put.patch
@@ -0,0 +1,29 @@
+Author: Ole Streicher <olebole@debian.org>
+Description: Fix another probably off-by-one error in prim/dio/libsrc/fitsmdb.c
+ This shall fix the following crash:
+ .
+ ERROR: AddressSanitizer: global-buffer-overflow on address 0x7f5ae9867e28 at pc 0x7f5ae979569c bp 0x7fff8c3c744
+ READ of size 1 at 0x7f5ae9867e28 thread T0
+ #0 0x7f5ae979569b in mdb_put prim/dio/libsrc/fitsmdb.c:173
+ #1 0x7f5ae978f489 in fitsckw prim/dio/libsrc/fitsckw.c:872
+ #2 0x7f5ae97a3ee4 in fitsrhd prim/dio/libsrc/fitsrhd.c:258
+ #3 0x401ee4 in main prim/dio/src/infile.c:263
+ #4 0x7f5ae90bab44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
+ #5 0x4024e2 (prim/exec/infile.exe+0x4024e2)
+
+0x7f5ae9867e28 is located 0 bytes to the right of global variable '*.LC46' from 'fitsckw.c' (0x7f5ae9867e20) of size 8
+ '*.LC46' is ascii string 'COMMENT'
+0x7f5ae9867e28 is located 56 bytes to the left of global variable '*.LC47' from 'fitsckw.c' (0x7f5ae9867e60) of size 3
+ '*.LC47' is ascii string 'O_'
+
+--- a/prim/dio/libsrc/fitsmdb.c
++++ b/prim/dio/libsrc/fitsmdb.c
+@@ -170,7 +170,7 @@
+
+ ps = myptr->desc;
+ pc = kwd->desc;
+-for (i=0; i<MXMDN; i++) *ps++ = *pc++;
++strncpy(ps, pc, MXMDN);
+
+ myptr->type = kwd->type;
+ myptr->idx = kwd->idx;
diff --git a/sci-astronomy/esomidas/files/esomidas-no-sp_pty.patch b/sci-astronomy/esomidas/files/esomidas-no-sp_pty.patch
new file mode 100644
index 000000000000..c95893dfff37
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-no-sp_pty.patch
@@ -0,0 +1,17 @@
+Author: Ole Streicher <olebole@debian.org>
+Description: Dont compile gui/GraphLib/libsrc/uimxR5/src/sp_pty.c
+ This file uses either nonportable termio, or sgtty which is not available
+ everywhere (again, Hurd and FreeBSD are the examples here). In principle
+ it could be rewritten to use termios (which is standard today); however
+ the functions from this file are not needed in midas; therefore it is
+ simpler just not to compile this.
+--- a/gui/GraphLib/libsrc/uimxR5/src/makefile
++++ b/gui/GraphLib/libsrc/uimxR5/src/makefile
+@@ -65,7 +65,6 @@
+ subproc.o\
+ sp_utils.o\
+ sp_spmd.o\
+- sp_pty.o\
+ swidget.o \
+ t_error.o\
+ uimx.o\
diff --git a/sci-astronomy/esomidas/files/esomidas-no-strip.patch b/sci-astronomy/esomidas/files/esomidas-no-strip.patch
new file mode 100644
index 000000000000..5a091ad8637c
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-no-strip.patch
@@ -0,0 +1,29 @@
+Author: Ole Streicher <olebole@debian.org>
+Description: Don't strip binaries during build
+ This allows a debugging during packaging. The binaries are stripped
+ later with dh_strip.
+--- a/install/unix/install1
++++ b/install/unix/install1
+@@ -536,9 +536,9 @@
+ fi
+ else
+ echo "NOT FOUND."
+- echo "*** STRIP set to echo."
+- ed_moptions add STRIP=echo >/dev/null
+ fi
++echo "*** STRIP set to echo."
++ed_moptions add STRIP=echo >/dev/null
+ #*************** END: Checking the strip command **************
+
+ #*************** START: Checking the ranlib command ***********
+--- a/install/unix/default_mk
++++ b/install/unix/default_mk
+@@ -32,7 +32,7 @@
+ LD77_OPT = $(LDFLAGS)
+ LD77 = $(LD77_CMD) $(LD77_OPT)
+ RANLIB = ranlib
+-STRIP = strip
++STRIP = echo
+ AR = ar
+ AR_OPT = ruv
+ AR_XOPT = xv
diff --git a/sci-astronomy/esomidas/files/esomidas-propagate-flags.patch b/sci-astronomy/esomidas/files/esomidas-propagate-flags.patch
new file mode 100644
index 000000000000..3c918e22f4da
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-propagate-flags.patch
@@ -0,0 +1,86 @@
+Author: Ole Streicher <olebole@debian.org>
+Description: Propagate CFLAGS, CPPFLAGS, and FFLAGS
+ This is done to enable hardening of the code. Also, use -fPIC only
+ for shared library code.
+--- a/install/unix/install1
++++ b/install/unix/install1
+@@ -303,7 +303,7 @@
+ ed_moptions delete C_OPT >/dev/null
+ ed_moptions delete INSTALL_FLAG >/dev/null
+
+-ed_moptions add "C_OPT=-O $X_OPT" >/dev/null
++ed_moptions add "C_OPT=$X_OPT" >/dev/null
+ ed_moptions add "K_OPT= $X_OPT" >/dev/null
+ ed_moptions add "INSTALL_FLAG=auto" >/dev/null
+
+@@ -331,12 +331,13 @@
+ # 64 bit compiler
+ else
+ echo installing Midas on a 64 bit system
+- MACH="-m64"
++ MACH=" "
+ EO="-Z"
+ fi
+
+ ed_moptions add "F77=gfortran $MACH" >/dev/null
+-ed_moptions add "LD77_CMD=gfortran $MACH" >/dev/null
++ed_moptions add "LD77_CMD=gfortran $MACH $LDFLAGS" >/dev/null
++ed_moptions add "LDCC=gcc $LDFLAGS" >/dev/null
+ ed_moptions add "E_OPT= $EO" >/dev/null
+
+
+--- a/install/unix/default_mk
++++ b/install/unix/default_mk
+@@ -49,10 +49,10 @@
+ E_OPT =
+ SYS =
+ SH_CMD = echo
+-SH_OPT =
++SH_OPT = -fPIC
+ SH_EXT = so.8.1
+ CFLAGS += $(C_OPT) $(DEBUG) $(SYS) $(VARARGS) -I$(INC)
+-FFLAGS = $(F_OPT) $(DEBUG) -c
++FFLAGS += $(F_OPT) $(DEBUG) -c
+ EFLAGS = $(E_OPT) -I$(INC) -I$(LINC) -f
+ EXFLAGS = -f
+ SLIB =
+--- a/libsrc/ftoc-new/makefile
++++ b/libsrc/ftoc-new/makefile
+@@ -21,6 +21,7 @@
+ C_OPT = $(K_OPT)
+
+ CFLAGS += $(C_OPT) $(DEBUG) $(SH_OPT) $(SYS) -I$(INC)
++FFLAGS += $(SH_OPT)
+
+ LIB = $(LIBDIR)/libftoc.a
+
+--- a/libsrc/tbl/makefile
++++ b/libsrc/tbl/makefile
+@@ -22,6 +22,7 @@
+ include ../../local/default.mk
+
+ CFLAGS += $(C_OPT) $(SH_OPT) $(DEBUG) $(SYS) -I$(INC)
++FFLAGS += $(SH_OPT)
+
+ HEADT = $(INC)/tblsys.h $(INC)/tbldef.h $(INC)/tblerr.h
+
+--- a/libsrc/agl/makefile
++++ b/libsrc/agl/makefile
+@@ -28,6 +28,7 @@
+ include ../../local/default.mk
+
+ CFLAGS += $(C_OPT) $(DEBUG) $(SH_OPT) $(OSSYS) $(SYS) -I$(INC) $(X11INC) -DMIDAS
++FFLAGS += $(SH_OPT)
+
+ LIB = $(LIBDIR)/libagl3.a
+ M = ../../system/exec
+--- a/libsrc/plot/makefile
++++ b/libsrc/plot/makefile
+@@ -15,6 +15,7 @@
+ include ../../local/default.mk
+
+ CFLAGS += $(C_OPT) $(SH_OPT) $(DEBUG) $(SYS) -I$(INC)
++FFLAGS += $(SH_OPT)
+
+ LIB = $(LIBDIR)/libplot.a
+
diff --git a/sci-astronomy/esomidas/files/esomidas-rarthm_for.patch b/sci-astronomy/esomidas/files/esomidas-rarthm_for.patch
new file mode 100644
index 000000000000..9d4892a7bbd8
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-rarthm_for.patch
@@ -0,0 +1,43 @@
+Author: Ole Streicher <olebole@debian.org>
+Description: Wild-quess workaround for access violations in prim/general/libsrc/calc.for
+ This is to hide the following problem:
+ .
+ ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffe7377ec4 at pc 0x40fb5c bp 0x7fffe7377350 sp 0x7fffe7377348
+READ of size 4 at 0x7fffe7377ec4 thread T0
+ #0 0x40fb5b in opffw_ prim/general/libsrc/calc.f:129
+ #1 0x40900b in rarthm prim/general/src/rarthm.f:402
+ #2 0x4038ec in main prim/general/src/rarthm.f:456
+ #3 0x7fed23b91b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
+ #4 0x403c42 (prim/exec/rarthm.exe+0x403c42)
+
+Address 0x7fffe7377ec4 is located in stack of thread T0 at offset 1316 in frame
+ #0 0x40512f in rarthm prim/general/src/rarthm.f:1
+
+ This frame has 57 object(s):
+ [32, 36) 'uni'
+ [...]
+ [1184, 1188) 'rownoa'
+ [1248, 1252) 'rownob'
+ [1312, 1316) 'rowsiz' <== Memory access at offset 1316 overflows this variable
+ [1376, 1380) 'stat'
+ [1440, 1448) 'consta'
+ [1504, 1512) 'npixa'
+ [1568, 1576) 'npixb'
+ [1632, 1640) 'npixc'
+
+--- a/prim/general/src/rarthm.for
++++ b/prim/general/src/rarthm.for
+@@ -483,11 +483,11 @@
+ IF (OPERAT(1:1).NE.'Q') THEN
+ CALL OPFFW(OPERAT,MADRID(APNTR),MADRID(BPNTR),
+ + MADRID(PNTRW),APIX,BPIX,CPIX,
+- + ROWSIZ,ROWSIZ,ROWSIZ)
++ + NPIXA,NPIXB,NPIXC)
+ ELSE
+ CALL FN2FFW(OPERA(1:5),MADRID(APNTR),MADRID(BPNTR),
+ + MADRID(PNTRW),APIX,BPIX,CPIX,
+- + ROWSIZ,ROWSIZ,ROWSIZ)
++ + NPIXA,NPIXB,NPIXC)
+ ENDIF
+ C
+ C put resulting row back into relevant ATOM
diff --git a/sci-astronomy/esomidas/files/esomidas-selechar_c.patch b/sci-astronomy/esomidas/files/esomidas-selechar_c.patch
new file mode 100644
index 000000000000..63ff95318340
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-selechar_c.patch
@@ -0,0 +1,51 @@
+Author: Ole Streicher <olebole@debian.org>
+Description: Fix off-by-one initialization in prim/table/libsrc/selechar.c
+ I am, however, not sure whether it is in charfun() in selechar.c or SCFMAP()
+ in scfb.c.
+ .
+ It fixes the following crash:
+ .
+ ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61a00001f76c at pc 0x42ac5b bp 0x7fffb7a62330 sp 0x7fffb7a62328
+ WRITE of size 1 at 0x61a00001f76c thread T0
+ #0 0x42ac5a in charfun prim/table/libsrc/selechar.c:279
+ #1 0x4154f5 in level5 prim/table/libsrc/tbcomsel.c:797
+ #2 0x41572a in level4 prim/table/libsrc/tbcomsel.c:720
+ #3 0x415c57 in level3 prim/table/libsrc/tbcomsel.c:765
+ #4 0x415d1d in level2 prim/table/libsrc/tbcomsel.c:677
+ #5 0x41610e in level1 prim/table/libsrc/tbcomsel.c:636
+ #6 0x4165b0 in level0 prim/table/libsrc/tbcomsel.c:595
+ #7 0x41415d in level00 prim/table/libsrc/tbcomsel.c:555
+ #8 0x4179ff in tbl_comp prim/table/libsrc/tbcomsel.c:204
+ #9 0x4053fd in tk_cexec prim/edit/libsrc/tkeys.c:204
+ #10 0x404979 in main prim/table/src/tdatatbl.c:107
+ #11 0x7f1e97ae3b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
+ #12 0x404d62 (prim/exec/tdatatbl.exe+0x404d62)
+ .
+ 0x61a00001f76c is located 0 bytes to the right of 1260-byte region [0x61a00001f280,0x61a00001f76c)
+allocated by thread T0 here:
+ #0 0x7f1e9858373f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f)
+ #1 0x7f1e98241cf2 in SCFMAP libsrc/st/scfb.c:816
+ #2 0x42a0a3 in charfun prim/table/libsrc/selechar.c:250
+ #3 0x4154f5 in level5 prim/table/libsrc/tbcomsel.c:797
+ #4 0x41572a in level4 prim/table/libsrc/tbcomsel.c:720
+ #5 0x415c57 in level3 prim/table/libsrc/tbcomsel.c:765
+ #6 0x415d1d in level2 prim/table/libsrc/tbcomsel.c:677
+ #7 0x41610e in level1 prim/table/libsrc/tbcomsel.c:636
+ #8 0x4165b0 in level0 prim/table/libsrc/tbcomsel.c:595
+ #9 0x41415d in level00 prim/table/libsrc/tbcomsel.c:555
+ #10 0x4179ff in tbl_comp prim/table/libsrc/tbcomsel.c:204
+ #11 0x4053fd in tk_cexec prim/edit/libsrc/tkeys.c:204
+ #12 0x404979 in main prim/table/src/tdatatbl.c:107
+ #13 0x7f1e97ae3b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
+
+--- a/prim/table/libsrc/selechar.c
++++ b/prim/table/libsrc/selechar.c
+@@ -247,7 +247,7 @@
+ nconst[ibuf[6]] = nchar;
+ items = nchar * ibuf[2];
+ SCFCRE(name,D_I1_FORMAT,F_X_MODE,F_IMA_TYPE,items,&imnoc[ibuf[6]]);
+- SCFMAP(imnoc[ibuf[6]],F_X_MODE,1,items,&act,&cdata[ibuf[6]]);
++ SCFMAP(imnoc[ibuf[6]],F_X_MODE,1,items+1,&act,&cdata[ibuf[6]]);
+ }
+ if (nochar == 0) {
+ for (i=0, k=0; i<items; i+=nchar,k++) {
diff --git a/sci-astronomy/esomidas/files/esomidas-syskeys.patch b/sci-astronomy/esomidas/files/esomidas-syskeys.patch
new file mode 100644
index 000000000000..96187d53a752
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-syskeys.patch
@@ -0,0 +1,23 @@
+Author: Ole Streicher <debian@liska.ath.cx>
+Description: Write correct syskeys instead of patching in install/unix/setup
+--- a/monit/syskeys.datorg
++++ b/monit/syskeys.datorg
+@@ -60,7 +60,8 @@
+ C (31:32) no. of bits for memory addresses (32 or 64)
+ C SECT./END_OF_KEY
+ MID$SYS/C/32/R
+-Vax/VMS $EDIT 32
++PC/Linux $vi
++C Vax/VMS $EDIT 32
+ C Sun/Solaris $vi 32
+ C HP/UX $vi 32
+ C PC/Linux $vi 32
+@@ -426,7 +427,7 @@
+ C $debugger debug_flags MID$EXE:module options
+ C SECT./END_OF_KEY
+ MID$DEBUG/C*40/3/R
+-$dbx
++$gdb
+ ?
+ ?
+ C
diff --git a/sci-astronomy/esomidas/files/esomidas-system-readline.patch b/sci-astronomy/esomidas/files/esomidas-system-readline.patch
new file mode 100644
index 000000000000..da06a564aafa
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-system-readline.patch
@@ -0,0 +1,83 @@
+Author: Ole Streicher <debian@liska.ath.cx>
+Description: Use the system provided readline instead of the copy
+ provided with the sources.
+--- a/install/unix/install1
++++ b/install/unix/install1
+@@ -576,7 +576,7 @@
+ then
+ echo "OK."
+ ed_moptions replace "EDITSWITCH=-DEdit_dummy" >/dev/null
+- ed_moptions replace "EDITLIBS=-lzreadline -lncurses" >/dev/null
++ ed_moptions replace "EDITLIBS=-lreadline" >/dev/null
+ else
+ echo "Not found."
+ echo "*** WARNING: You'll not be able to edit Midas commands in the monitor."
+@@ -596,7 +596,7 @@
+
+ if [ $answ = "c" -o $answ = "C" ]; then
+ ed_moptions replace "EDITSWITCH=-DNO_READLINE" >/dev/null
+- ed_moptions replace "EDITLIBS=-lzreadline" >/dev/null
++ ed_moptions replace "EDITLIBS=-lreadline" >/dev/null
+ else
+ exit 1
+ fi
+--- a/install/unix/install1.sh
++++ b/install/unix/install1.sh
+@@ -575,7 +575,7 @@
+ then
+ echo "OK."
+ ed_moptions replace "EDITSWITCH=-DEdit_dummy" >/dev/null
+- ed_moptions replace "EDITLIBS=-lzreadline -lncurses" >/dev/null
++ ed_moptions replace "EDITLIBS=-lreadline -lncurses" >/dev/null
+ else
+ echo "Not found."
+ echo "*** WARNING: You'll not be able to edit Midas commands in the monitor."
+@@ -595,7 +595,7 @@
+
+ if [ $answ = "c" -o $answ = "C" ]; then
+ ed_moptions replace "EDITSWITCH=-DNO_READLINE" >/dev/null
+- ed_moptions replace "EDITLIBS=-lzreadline" >/dev/null
++ ed_moptions replace "EDITLIBS=-lreadline" >/dev/null
+ else
+ exit 1
+ fi
+--- a/monit/prepa2.c
++++ b/monit/prepa2.c
+@@ -90,6 +90,9 @@
+ #include <osxdef.h> /* MIDAS osx definitions */
+ #include <midback.h> /* Context extructure */
+
++typedef int Function ();
++typedef char **CPPFunction ();
++
+ extern int is_a_tty; /* Is this a terminal, (yes=1) set in prepa.c */
+
+ void using_history();
+@@ -238,7 +241,7 @@
+ if (!xhelp_pid) {
+ if ( (fd = fopen(channame[1],"r")) == (FILE *)NULL) {
+ (void) printf("\n\rTry first: CREATE/GUI HELP \n\r");
+- rl_refresh_line();
++ rl_refresh_line(0,0);
+ return 0;
+ }
+ fscanf(fd,(const char *) "%d\n",&xhelp_pid);
+@@ -247,7 +250,7 @@
+ xhelp_pid = 0;
+ unlink(channame[1]);
+ (void) printf("\n\rTry first: CREATE/GUI HELP \n\r");
+- rl_refresh_line();
++ rl_refresh_line(0,0);
+ return 0;
+ }
+ }
+--- a/install/unix/core.cnf
++++ b/install/unix/core.cnf
+@@ -15,7 +15,6 @@
+ ./libsrc/st
+ ./libsrc/tbl
+ # ./libsrc/tw FO's termwin library not used anymore...
+-./libsrc/readline
+ ./libsrc/agl
+ ./libsrc/plot
+ ./libsrc/display
diff --git a/sci-astronomy/esomidas/files/esomidas-x11-include-path.patch b/sci-astronomy/esomidas/files/esomidas-x11-include-path.patch
new file mode 100644
index 000000000000..06aaab938c4c
--- /dev/null
+++ b/sci-astronomy/esomidas/files/esomidas-x11-include-path.patch
@@ -0,0 +1,13 @@
+Author: Ole Streicher <olebole@debian.org>
+Description: Add /usr/include/X11 to the X11 include paths
+--- a/install/unix/install1
++++ b/install/unix/install1
+@@ -615,7 +615,7 @@
+ x11incl="found"
+ else
+ ed_moptions delete X11INC >/dev/null
+- x11inclpth='/usr/openwin/include /usr/include/X11R6 /usr/include/X11R5 /usr/X11R6/include /usr/X11R6/include/X11 /usr/X11R5/include /usr/local/include /include /usr/X/include /opt/X-local/include'
++ x11inclpth='/usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/X11R6/include /usr/X11R6/include/X11 /usr/X11R5/include /usr/local/include /include /usr/X/include /opt/X-local/include'
+ for dir in $x11inclpth
+ do
+ if [ ! -d $dir ]; then
diff --git a/sci-astronomy/esomidas/metadata.xml b/sci-astronomy/esomidas/metadata.xml
new file mode 100644
index 000000000000..40556383b31c
--- /dev/null
+++ b/sci-astronomy/esomidas/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>sci-astronomy@gentoo.org</email>
+ <name>Gentoo Astronomy Project</name>
+</maintainer>
+<longdescription lang="en">
+ The ESO-MIDAS system provides general tools for image processing and data
+ reduction with emphasis on astronomical applications including imaging and
+ special reduction packages for ESO instrumentation at La Silla and the VLT at
+ Paranal. In addition it contains applications packages for stellar and
+ surface photometry, image sharpening and decomposition, statistics and
+ various others.
+</longdescription>
+</pkgmetadata>