summaryrefslogtreecommitdiff
path: root/biology
diff options
context:
space:
mode:
Diffstat (limited to 'biology')
-rw-r--r--biology/rasmol/Makefile29
-rw-r--r--biology/rasmol/files/rasmol21
-rw-r--r--biology/rasmol/pkg-plist3
-rw-r--r--biology/rasmol/scripts/build_viewer46
4 files changed, 91 insertions, 8 deletions
diff --git a/biology/rasmol/Makefile b/biology/rasmol/Makefile
index 62792838e29d..32f73ae06619 100644
--- a/biology/rasmol/Makefile
+++ b/biology/rasmol/Makefile
@@ -7,22 +7,35 @@
PORTNAME= rasmol
PORTVERSION= 2.7.2
+PORTREVISION= 1
CATEGORIES= biology
MASTER_SITES= ftp://ftp.bernstein-plus-sons.com/software/RasMol_2.7.2/
DISTNAME= RasMol
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 --git a/biology/rasmol/files/rasmol b/biology/rasmol/files/rasmol
new file mode 100644
index 000000000000..6a0531e1bda5
--- /dev/null
+++ b/biology/rasmol/files/rasmol
@@ -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 --git a/biology/rasmol/pkg-plist b/biology/rasmol/pkg-plist
index ecd759fbeef7..61dbd0b40e42 100644
--- a/biology/rasmol/pkg-plist
+++ b/biology/rasmol/pkg-plist
@@ -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 --git a/biology/rasmol/scripts/build_viewer b/biology/rasmol/scripts/build_viewer
new file mode 100644
index 000000000000..1b0c1a2fd0da
--- /dev/null
+++ b/biology/rasmol/scripts/build_viewer
@@ -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