# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils DESCRIPTION="Maple is a symbolic algebra maths package" HOMEPAGE="http://www.maplesoft.com/" SRC_URI="${P}-resource1.zip" LICENSE="maple" SLOT="0" KEYWORDS="~x86" IUSE="tetex X" DEPEND="app-arch/unzip" RDEPEND="=virtual/jre-1.4*" RESTRICT="fetch nostrip" S="${WORKDIR}" # Ebuild specific varibles BIN_DIR="bin.IBM_INTEL_LINUX" DESTINATION="/opt/${PN}" DOC_DIR="doc" OPT_DIR="opt" SHARE_DIR="share" pkg_nofetch() { einfo "Please copy the file \"Resource1.zip\" from your copy of ${P}" einfo "and move it to ${DISTDIR}/${A}" } src_unpack() { unpack ${A} # Constants in all the source JAR's JAREXT="manifest_zg_ia_sf.jar" JARSRC="\$IA_PROJECT_DIR\$/manifests" # Unconsistent file naming mv "${JARSRC}/bin.ibm_intel_linux.${JAREXT}" \ "${JARSRC}/bin.IBM_INTEL_LINUX.${JAREXT}" mv "${JARSRC}/etc.${JAREXT}" "${JARSRC}/latex.${JAREXT}" mv "${JARSRC}/afm_unix.${JAREXT}" "${JARSRC}/afm.${JAREXT}" # JAR names and which type they are local BIN_JAR=( "bin" "bin.IBM_INTEL_LINUX" "data" "lib" "java" ) local DOC_JAR=( "man" "readmes" ) local SHARE_JAR=( "examples" "extern" "samples" ) # Extract only requested features if use tetex ; then SHARE_JAR=( ${SHARE_JAR[@]} "latex" ) fi if use X ; then BIN_JAR=( ${BIN_JAR[@]} "afm" "X11_defaults" ) fi # Extract the JAR's for JAR in ${BIN_JAR[@]} ; do extract_file ${OPT_DIR} ${JAR} done for JAR in ${DOC_JAR[@]} ; do extract_file ${DOC_DIR} ${JAR} done for JAR in ${SHARE_JAR[@]} ; do extract_file ${SHARE_DIR} ${JAR} done } src_install() { # Fix paths # Uses java-config-1 to locate a 1.4 JRE cd ${OPT_DIR}/bin sed -i -e "s:\${MAPLE_JRE_BIN}:\$(java-config-1 -o)/bin/:" maple sed -i -e "s:/usr/local/maple:${DESTINATION}:" maple xmaple mint cd ${S} # Configure maple cat << EOF > "${OPT_DIR}/${BIN_DIR}/maplesys.ini" [user-settings] MultiUserProfile=1 Network=0 EOF # Configure license mv "\$DAY\$/internal/bin.IBM_INTEL_LINUX/dectool" ${OPT_DIR}/${BIN_DIR} mkdir -p ${OPT_DIR}/license mv "\$DAY\$/license/Network/license.dat" ${OPT_DIR}/license || die \ "Unable to copy license file" # Install documentation/ dodoc ${DOC_DIR}/readmes/* doman ${DOC_DIR}/man/man1/* # Install everything else insinto ${DESTINATION} doins -r ${OPT_DIR}/* insinto /usr/share/${PN} doins -r ${SHARE_DIR}/* # Fix permissions and sym-links chmod -R +x ${D}/${DESTINATION}/bin* dosym "libgmp.so.3.3.0" "${DESTINATION}/${BIN_DIR}/libgmp.so.3" dosym "${DESTINATION}/${BIN_DIR}/libgmp.so.3" \ "${DESTINATION}/${BIN_DIR}/libgmp.so" # /op/bin sym-links dosym "${DESTINATION}/bin/maple" "/opt/bin/maple" dosym "${DESTINATION}/bin/mint" "/opt/bin/mint" dosym "${DESTINATION}/bin/xmaple" "/opt/bin/xmaple" } pkg_postinst() { einfo "In order to use ${P} the copy must be registered" einfo "by running the following command as root:" einfo "${DESTINATION}/${BIN_DIR}/dectool SERIALNUM ${DESTINATION}/license/license.dat" einfo "Where SERIALNUM is valid ${P} serial number" } extract_file() { mkdir -p "${1}/${2}" einfo "Unpacking ${2}..." unzip -q "${JARSRC}/${2}.${JAREXT}" -d "${1}/${2}" || die \ "Unable to extract ${JARSRC}/${2}.${JAREXT}" }