# New ports collection makefile for:	StarOffice 3.1
# Version required:     3.1
# Date created:		09 April 1997
# Whom:			msmith
#
# $Id: Makefile,v 1.9 1998/11/24 13:19:32 asami Exp $
#

DISTNAME=       staroffice-3.1
CATEGORIES=	editors
# They used to have lots of mirrors, but they seem to have disappeared.
# Maybe this was one of the conditions that Caldera required to distribute
# the "cmmercial" version?
MASTER_SITES=   ftp://ftp.gwdg.de/pub/linux/staroffice/
# Our german friends might want to grab other bits; suggestions?
DISTARCHIVES=	StarOffice31-common.tar.gz \
		StarOffice31-statbin.tar.gz \
		StarOffice31-english.tar.gz
DISTDOCUMENTS=	README.StarOffice
DISTFILES=	${DISTARCHIVES} ${DISTDOCUMENTS}


MAINTAINER=     msmith@FreeBSD.ORG

# Argh, we want to depend on libc.so.5.4.4 or greater; 5.4.23 is in
# linux_lib-2.4, hopefully we will be updated if/when that changes.
RUN_DEPENDS=    /compat/linux/lib/libc.so.5.4.23:${PORTSDIR}/emulators/linux_lib

NO_CDROM=	free of change only for non-commercial use

NO_MTREE=	yes
NO_BUILD=	yes
NO_EXTRACT=	yes
NO_WRKDIR=	yes

# Stuff comes in handy tarfiles all ready to go, we add the README
# as per their request and a script to run the applications.
do-install:
	@${MKDIR} ${PREFIX}/bin
	@for i in ${DISTARCHIVES}; do				\
		zcat ${DISTDIR}/$$i | (cd ${PREFIX}; tar -xpf -)\
	done
	@for i in ${DISTDOCUMENTS}; do					\
		${INSTALL_DATA} ${DISTDIR}/$$i ${PREFIX}/StarOffice-3.1;\
	done
	@${SED} -e s%PUT_PREFIX_HERE%${PREFIX}%			\
		< ${FILESDIR}/srun 				\
		> ${PREFIX}/StarOffice-3.1/srun.tmp
	${INSTALL_SCRIPT} ${PREFIX}/StarOffice-3.1/srun.tmp	\
			  ${PREFIX}/StarOffice-3.1/srun
	${RM} ${PREFIX}/StarOffice-3.1/srun.tmp
	
# Now a couple of tiny patches to the startup script templates to
# recognise FreeBSD as Linux, and install some links to the startup
# script we installed above.
#
# What happened to the soffice3 program?  Finding these may be hard.
post-install:
	-@cat ${FILESDIR}/sd.sh.patch | (cd ${PREFIX}/StarOffice-3.1; ${PATCH} -Ns)
	-@cat ${FILESDIR}/sd.csh.patch | (cd ${PREFIX}/StarOffice-3.1; ${PATCH} -Ns)
	ln -sf ${PREFIX}/StarOffice-3.1/srun ${PREFIX}/bin/scalc3
	ln -sf ${PREFIX}/StarOffice-3.1/srun ${PREFIX}/bin/schart3
	ln -sf ${PREFIX}/StarOffice-3.1/srun ${PREFIX}/bin/sdraw3
	ln -sf ${PREFIX}/StarOffice-3.1/srun ${PREFIX}/bin/simage3
	ln -sf ${PREFIX}/StarOffice-3.1/srun ${PREFIX}/bin/smath3
	ln -sf ${PREFIX}/StarOffice-3.1/srun ${PREFIX}/bin/swriter3
	@cat ${PKGDIR}/MESSAGE

.include <bsd.port.mk>
