Date: Thu, 6 Sep 2001 15:18:35 -0500 (CDT) From: Glenn Johnson <gjohnson@srrc.ars.usda.gov> To: FreeBSD-gnats-submit@freebsd.org Subject: ports/30406: Make rasmol work at all color depths Message-ID: <200109062018.f86KIZv75210@node7.cluster.srrc.usda.gov>
next in thread | raw e-mail | index | archive | help
>Number: 30406 >Category: ports >Synopsis: Make rasmol work at all color depths >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Sep 06 13:20:04 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Glenn Johnson >Release: FreeBSD 4.4-RC i386 >Organization: USDA, ARS, SRRC >Environment: System: FreeBSD node7.cluster.srrc.usda.gov 4.4-RC FreeBSD 4.4-RC #4: Tue Sep 4 16:55:10 CDT 2001 root@node7.cluster.srrc.usda.gov:/usr/obj/usr/src/sys/CLUSTER-UP i386 >Description: The rasmol program can only work at a specific color depth. This makes recompilation necessary when changing color depth and is also a problem when machines across an NFS mount are running the respective X servers at different color depths. This patch builds all 3 depth versions of rasmol and includes a wrapper script to automatically determine which binary to use based on the reported color depth of the X server being connected to. >How-To-Repeat: >Fix: Apply the enclosed patch to the biology/rasmol port. diff -ruN rasmol.old/Makefile rasmol/Makefile --- rasmol.old/Makefile Thu Sep 6 12:57:49 2001 +++ rasmol/Makefile Thu Sep 6 15:08:49 2001 @@ -13,16 +13,28 @@ MAINTAINER= ports@FreeBSD.org -WRKSRC= $(WRKDIR)/RasMol_2.7.2/src/ -USE_IMAKE= yes +WRKSRC= $(WRKDIR)/RasMol_2.7.2/src + +USE_X_PREFIX= yes + +.if ${XFREE86_VERSION} == 3 +BUILD_DEPENDS+= imake:${PORTSDIR}/devel/imake +.elif ${XFREE86_VERSION} == 4 +BUILD_DEPENDS+= imake:${PORTSDIR}/devel/imake-4 +.endif MAN1= rasmol.1 -pre-extract: - @${ECHO} "" - @${ECHO} You can set the color depth to match your X server in - @${ECHO} ${WRKSRC}Imakefile - @${ECHO} before building. - @${ECHO} "" +do-build: + ${SETENV} ${SCRIPTS_ENV} ${SH} ${SCRIPTDIR}/build_viewer + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/rasmol-* ${PREFIX}/bin + ${INSTALL_SCRIPT} ${FILESDIR}/rasmol ${PREFIX}/bin + ${INSTALL_MAN} ${WRKSRC}/rasmol.man ${PREFIX}/man/man1/rasmol.1 + ${MKDIR} ${PREFIX}/lib/X11/rasmol + ${INSTALL_DATA} ${WRKSRC}/rasmol.hlp ${PREFIX}/lib/X11/rasmol + ${INSTALL_DATA} ${WRKSRC}/../data/1crn.pdb ${PREFIX}/lib/X11/rasmol + ${INSTALL_DATA} ${WRKSRC}/../data/3cro.pdb ${PREFIX}/lib/X11/rasmol .include <bsd.port.mk> diff -ruN rasmol.old/files/rasmol rasmol/files/rasmol --- rasmol.old/files/rasmol Wed Dec 31 18:00:00 1969 +++ rasmol/files/rasmol Thu Sep 6 13:23:03 2001 @@ -0,0 +1,21 @@ +#!/bin/sh + +# Determine if X is running +if [ -z $DISPLAY ]; then + echo You must be running X for this. +else +# Try to determine the color depth of the X server + + DEPTH=`xwininfo -root | grep Depth | awk '{print $2}'` + + if [ $DEPTH = 24 -o $DEPTH = 32 ]; then + PROGRAM=rasmol-32 + elif [ $DEPTH = 16 ]; then + PROGRAM=rasmol-16 + elif [ $DEPTH = 8 ]; then + PROGRAM=rasmol-8 + else + echo Can not determine color depth of Display $DISPLAY + fi + exec $PROGRAM $@ +fi diff -ruN rasmol.old/pkg-plist rasmol/pkg-plist --- rasmol.old/pkg-plist Thu Sep 6 12:57:49 2001 +++ rasmol/pkg-plist Thu Sep 6 13:28:22 2001 @@ -1,4 +1,7 @@ bin/rasmol +bin/rasmol-16 +bin/rasmol-32 +bin/rasmol-8 lib/X11/rasmol/1crn.pdb lib/X11/rasmol/3cro.pdb lib/X11/rasmol/rasmol.hlp diff -ruN rasmol.old/scripts/build_viewer rasmol/scripts/build_viewer --- rasmol.old/scripts/build_viewer Wed Dec 31 18:00:00 1969 +++ rasmol/scripts/build_viewer Thu Sep 6 14:57:20 2001 @@ -0,0 +1,46 @@ +#!/bin/sh + +# This builds the rasmol molecular viewer. One of the problems with +# rasmol is that is only works at one color depth. This script will +# build three viewers at different color depths, 8-bit, 16-bit, +# and 32-bit. The binaries are called rasmol-8, rasmol-16, and +# rasmol-32 respectively. A wrapper script installed with the port will +# automatically select the right one. + +cd ${WRKSRC} + +cp Imakefile Imakefile.temp + + +sed s@'ComplexProgramTarget(rasmol)'@'ComplexProgramTarget(rasmol-32)'@ \ + Imakefile.temp > Imakefile + +xmkmf -a + +make clean && make + +sed -e s@'DEPTHDEF = -DTHIRTYTWOBIT'@'# DEPTHDEF = -DTHIRTYTWOBIT'@ \ + -e s@'# DEPTHDEF = -DSIXTEENBIT'@'DEPTHDEF = -DSIXTEENBIT'@ \ + -e s@'ComplexProgramTarget(rasmol)'@'ComplexProgramTarget(rasmol-16)'@ \ + Imakefile.temp > Imakefile + +xmkmf -a + +make clean && make + +sed -e s@'DEPTHDEF = -DTHIRTYTWOBIT'@'# DEPTHDEF = -DTHIRTYTWOBIT'@ \ + -e s@'# DEPTHDEF = -DEIGHTBIT'@'DEPTHDEF = -DEIGHTBIT'@ \ + -e s@'ComplexProgramTarget(rasmol)'@'ComplexProgramTarget(rasmol-8)'@ \ + Imakefile.temp > Imakefile + +xmkmf -a + +make clean && make + +# Restore Imakefile to original state so that rerunning this script does +# the right thing. +mv Imakefile.temp Imakefile +xmkmf -a +make clean && make rasmol.man + +exit 0 >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109062018.f86KIZv75210>