From bsam@bb.ipt.ru  Sun Jan  6 15:04:39 2008
Return-Path: <bsam@bb.ipt.ru>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8C82816A473
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  6 Jan 2008 15:04:39 +0000 (UTC)
	(envelope-from bsam@bb.ipt.ru)
Received: from bb.ipt.ru (bb.ipt.ru [194.62.233.89])
	by mx1.freebsd.org (Postfix) with ESMTP id 150F213C469
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  6 Jan 2008 15:04:38 +0000 (UTC)
	(envelope-from bsam@bb.ipt.ru)
Received: from bb.ipt.ru (localhost [127.0.0.1])
	by bb.ipt.ru (8.14.2/8.14.2) with ESMTP id m06F34xk003092
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 6 Jan 2008 18:03:04 +0300 (MSK)
	(envelope-from bsam@bb.ipt.ru)
Received: (from bsam@localhost)
	by bb.ipt.ru (8.14.2/8.14.2/Submit) id m06F33nN003091;
	Sun, 6 Jan 2008 18:03:03 +0300 (MSK)
	(envelope-from bsam)
Message-Id: <200801061503.m06F33nN003091@bb.ipt.ru>
Date: Sun, 6 Jan 2008 18:03:03 +0300 (MSK)
From: Boris Samorodov <bsam@freebsd.org>
Reply-To: Boris Samorodov <bsam@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] lang/fpc: refine dealing with configuration file
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         119385
>Category:       ports
>Synopsis:       [patch] lang/fpc: refine dealing with configuration file
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    acm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 06 15:10:01 UTC 2008
>Closed-Date:    Sun Jan 06 21:25:14 UTC 2008
>Last-Modified:  Sun Jan 06 21:25:14 UTC 2008
>Originator:     Boris Samorodov
>Release:        FreeBSD 7.0-PRERELEASE i386
>Organization:
InPharmTech, Co.
>Environment:
System: FreeBSD bb.ipt.ru 7.0-PRERELEASE FreeBSD 7.0-PRERELEASE #1: Sat Dec 29 18:52:25 MSK 2007 root@bb.ipt.ru:/usr/obj/usr/src/sys/BB i386

>Description:
	Well, actually I was trying to build editors/lazarus which
	failed. Pointyhat shows the same as well. The main reason
	is that the port lang/fpc does not install a sample configuration
	file while installing from a package. Thus the compiler (fpc)
	does not find the needed (paths to) libraries.

	One minor bug was found at the lang/fpc port: it removes the
	configuration file unconditionally when the port/pachage is
	deletted.

	I propose to patch the script from the distribution so that
	a sample configuration file is installed (not the configuration
	file itself). Then the whole remaining logic becomes standard.

>How-To-Repeat:
	Try to compile editors/lazarus.

>Fix:
	. patch the samplecfg script (a new file files/patch-compiler_utils_samplecfg);
	. fix Makefile and pkg-plist to deal with a configuration file;
	. bump PORTREVISION.

--- fpc.diff begins here ---
? files/patch-compiler_utils_samplecfg
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/fpc/Makefile,v
retrieving revision 1.26
diff -u -r1.26 Makefile
--- Makefile	18 Sep 2007 06:53:23 -0000	1.26
+++ Makefile	6 Jan 2008 14:41:40 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	fpc
 PORTVERSION=	2.2.0
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES?=	lang
 MASTER_SITES=	ftp://ftp.freepascal.org/pub/fpc/dist/source-${PORTVERSION}/:source \
 		ftp://planetmirror.com/pub/fpc/dist/source-${PORTVERSION}/:source \
@@ -107,6 +107,9 @@
 	if [ -e "${PREFIX}/bin/ppc386" ]; then ${RM} -f "${PREFIX}/bin/ppc386"; fi
 	${LN} -s "${PREFIX}/lib/fpc/${PORTVERSION}/ppc386" "${PREFIX}/bin"
 	${SH} "${PREFIX}/lib/fpc/${PORTVERSION}/samplecfg" "${PREFIX}/lib/fpc/${PORTVERSION}" "${PREFIX}/etc"
+	@if [ ! -f ${PREFIX}/etc/fpc.cfg ]; then \
+		${CP} ${PREFIX}/etc/fpc.cfg.sample ${PREFIX}/etc/fpc.cfg; \
+	fi
 	@${CAT} ${PKGMESSAGE}
 
 .else
Index: pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/fpc/pkg-plist,v
retrieving revision 1.8
diff -u -r1.8 pkg-plist
--- pkg-plist	18 Sep 2007 06:53:23 -0000	1.8
+++ pkg-plist	6 Jan 2008 14:41:40 -0000
@@ -1,6 +1,8 @@
 @comment $FreeBSD: ports/lang/fpc/pkg-plist,v 1.8 2007/09/18 06:53:23 acm Exp $
 
-@unexec rm -f %D/etc/fpc.cfg > /dev/null 2>&1 || true
+@unexec if cmp -s %D/etc/fpc.cfg.sample %D/etc/fpc.cfg; then rm -f %D/etc/fpc.cfg; fi
+etc/fpc.cfg.sample
+@exec if [ ! -f %D/etc/fpc.cfg ] ; then cp -p %D/%F %B/fpc.cfg; fi
 bin/fpc
 bin/fpcmkcfg
 bin/fpcsubst
--- fpc.diff ends here ---

--- patch-compiler_utils_samplecfg begins here ---
--- compiler/utils/samplecfg.orig	2008-01-06 01:17:24.468239657 +0300
+++ compiler/utils/samplecfg	2008-01-06 01:36:20.388869514 +0300
@@ -72,7 +72,7 @@
 # Detect if we have write permission in root.
 if [ -w $sysdir ] ; then
   echo Write permission in $sysdir.
-  thefile=$sysdir/fpc.cfg
+  thefile=$sysdir/fpc.cfg.sample
 else
   echo No write premission in $sysdir.
   thefile=$HOME/.fpc.cfg
--- patch-compiler_utils_samplecfg ends here ---

WBR
-- 
bsam
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->acm 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sun Jan 6 15:10:10 UTC 2008 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=119385 
State-Changed-From-To: open->closed 
State-Changed-By: acm 
State-Changed-When: Sun Jan 6 21:24:14 UTC 2008 
State-Changed-Why:  
- Committed thanks, also i updated lazarus to 0.9.24 

http://www.freebsd.org/cgi/query-pr.cgi?pr=119385 
>Unformatted:
