# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sci-geosciences/gempak/gempak-5.7.4.ebuild,v 1.3 2005/06/02 15:43:01 ribosome Exp $ inherit eutils # They can't seem to retain a normal naming scheme, so hacks are required. # Often the hacks change on every bump. MY_PV="${PV/_}" MY_P="${PN}_upc${MY_PV}" DESCRIPTION="GEMPAK Meteorological Plotting and Analysis Package" HOMEPAGE="http://www.unidata.ucar.edu/packages/gempak" SRC_URI="${MY_P}.tar.gz" LICENSE="as-is" DEPEND="virtual/motif" SLOT="0" IUSE="" KEYWORDS="~x86" RESTRICT="fetch" # More inconsistencies, this sometimes changes on bumps. S="${WORKDIR}/GEMPAK${MY_PV}" pkg_setup() { # Define this here so we don't have to have it more than once. GENTOO_VARS="NAWIPS GARPHOME GARP_PATH NA_OS GEMPAK GEMPAKHOME GEMLIB GEMEXE GEMPDF GEMTBL GEMERR GEMHLP GEMMAPS GEMNTS GEMPARM GEMPTXT GEMGTXT NAWIPS_EXE NAWIPS_LIB NAWIPS_INC NAWIPS_HELP NAWIPS_TABLES NWX_TABLES NMAP_RESTORE MEL_BUFR MEL_BUFR_TABLES BRDGDIR xresources SCRIPTS_EXE GEMDATA OBS NTRANS_META TEXT_DATA SAT RAD RADDIR LDMDATA GOES8 GOES9 HDS MODEL SAO UPA RAW_SAO RAW_SYN RAW_UPA NLDN TORN_WARN TSTRM_WARN TEXT_WARN RBKGPH LP XUSERFILESEARCHPATH grids" } pkg_nofetch() { einfo "Please visit ${HOMEPAGE}" einfo "and place ${A} in ${DISTDIR}." } src_unpack() { einfo "" einfo "WARNING: This application WILL NOT COMPILE with gcc4." einfo "You MUST have gcc 3.x installed and set as your default" einfo "compiler to install this program. To change your" einfo "default gcc version, use gcc-config, e.g.," einfo "\"gcc-config i686-pc-linux-gnu-3.4.6\"." einfo "" sleep 10 setup_vars unpack ${A} ebegin "Applying miscellaneous fixes" # Include statement is missing, since there's only one, just copy a # couple headers to the appropriate location. cp ${S}/gempak/include/*gpc.h ${S}/extlibs/GPC/libgpc/ eend 0 # Fix changed header header_replace varargs.h stdarg.h # Can't install to /usr/local ebegin "Fixing bad install locations" for BADFILE in `grep -lr '/usr/local' ${S}` do sed -i "s:/usr/local:/usr:g" ${BADFILE} ; done eend 0 } src_compile() { setup_vars # This is necessary to fix a version mismatch cd ${S}/extlibs/xslt/libxslt aclocal libtoolize --copy --force cd ${S} make || die } src_install() { setup_vars einfo "Pre-installing GEMPAK..." make install || die # This eliminates all the Makefiles, source code, header files, # and sundry other useless files. ebegin "Removing unnecessary files" rm -rf ${S}/{config,extlibs,include,ldm,lib,netcdf,nprogs,unidata,gempak/source} rm -rf ${S}/comet/{dcshef,etamap,garp/{gempak,gui,include,init,object,util}} rm ${S}/{,gempak/,comet/{,garp/}}Makefile eend 0 # Create the directory to install GEMPAK to. dodir /usr/gempak # Create the skeleton directory hierarchy for GEMPAK data. dodir /usr/gempak/data/images/radar/nids keepdir usr/gempak/data/images/radar/nids dodir /usr/gempak/data/images/sat/GOES-East keepdir usr/gempak/data/images/sat/GOES-East dodir /usr/gempak/data/meta keepdir usr/gempak/data/meta dodir /usr/gempak/data/model keepdir usr/gempak/data/model dodir /usr/gempak/data/nldn keepdir usr/gempak/data/nldn dodir /usr/gempak/data/nwx keepdir usr/gempak/data/nwx dodir /usr/gempak/data/redbook keepdir usr/gempak/data/redbook dodir /usr/gempak/data/surface keepdir usr/gempak/data/surface dodir /usr/gempak/data/upperair keepdir usr/gempak/data/upperair dosym /usr/gempak/data/model /usr/gempak/data/model/hds dosym /usr/gempak/data/model /usr/gempak/data/model/hrs # Put all the necessary files in the correct place. einfo "Installing GEMPAK..." cp -Rfv ${S}/* ${D}/usr/gempak # This is necessary, because otherwise some of the files will not be # world-readable ebegin "Fixing permissions to ensure world-readability" chmod +r -Rf ${D} eend 0 # Install env.d file insinto /etc/env.d newins ${FILESDIR}/gempak.env.d 10gempak } pkg_postinst() { einfo "" einfo "A skeleton directory hierarchy has been automatically" einfo "created in /usr/gempak/data. If you wish to use a" einfo "different path you will need to edit /etc/env.d/10gempak" einfo "to reflect the change. If you already have a directory" einfo "hierarchy of your own, then simply remove /usr/gempak/data" einfo "and create a symbolic link from your data path to" einfo "/usr/gempak/data. Updates/uninstalls of GEMPAK will not" einfo "affect the symlinked directories, so long as they have data" einfo "inside them." einfo "" einfo "NOTE: Some of the programs in the GEMPAK suite have paths" einfo "hardcoded into the executables. It is ill-advised" einfo "to start playing around with paths unless you know" einfo "what you are doing." einfo "" einfo "NOTE: With the latest version of Xorg moving files from" einfo "/usr/X11R6 to /usr, the file rgb.txt may not be found by" einfo "your old /etc/X11/XF86Config. Symptoms of this are" einfo "missing icons in programs such as Nsharp and Garp, as well" einfo "as errors printed to stdout such as \"Color grey75" einfo "undefined\". To solve this problem you can simply link" einfo "this file to the old location by running the command" einfo "\"ln -s /usr/share/X11/rgb.txt /usr/lib/X11/rgb.txt\"." einfo "Alternatively, you can modify your XF86Config or xorg.conf" einfo "in /etc/X11 to reflect this change." einfo "" } header_replace() { # Replace obsoleted header # Usage: header_fix oldheader newheader ebegin "Replacing obsolete header references" for OLDFILE in `grep -lr "${1}" ${S}` do sed -i "s:${1}:${2}:g" ${OLDFILE} ; done eend 0 } setup_vars() { # All GEMPAK paths need to be unset before attempting to compile. unset ${GENTOO_VARS} # These GEMPAK paths must be set to their new values before # compiling. export CONFIGDIR="${S}/config" export GARPHOME="${S}/comet/garp" export NA_OS="linux" export NAWIPS="${S}" export GEMPAK="${NAWIPS}/gempak" export GEMPAKHOME="${GEMPAK}" export GEMLIB="${NAWIPS}/os/linux/lib" export GEMEXE="${NAWIPS}/os/linux/bin" export GEMPDF="${GEMPAK}/pdf" export GEMTBL="${GEMPAK}/tables" export GEMERR="${GEMPAK}/error" export GEMHLP="${GEMPAK}/help" export GEMMAPS="${GEMPAK}/maps" export GEMPARM="${GEMPAK}/parm" export GEMPTXT="${GEMPAK}/txt/programs" export GEMGTXT="${GEMPAK}/txt/gemlib" }