Subject: Re: New pkg submit: pkgsrc/sysutils/logrotate
To: Brian A. Seklecki <lavalamp@spiritual-machines.org>
From: Juan RP <jrp@hispabsd.org>
List: tech-pkg
Date: 08/02/2003 09:16:33
--B?2)ZzGb=.n=:z1d
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

On 02 Aug 2003 02:59:42 -0400
"Brian A. Seklecki" <lavalamp@spiritual-machines.org> wrote:

> There's a logrotate(8) (as seen in some GNU/Linux distros) that I
> frequently use in place of newsyslog(8) for a number of flexibility
> reasons. I normally source compile, but I figure I'd rather have someone
> commit it to pkgsrc instead. And so here it is:
> 
> pkglink(8) checks out on it for sanity checks, but there are two serious
> problems I need advice on:
> 
> The NetBSD pkg i've compiled is at:
> 
> 	http://digitalfreaks.org/~lavalamp/logrotate-netbsd-pkgsrc.tar
> 
> Shall I submit it another way? perhaps send-pr(1) ?..pkgsrc-wip?
> 
> 
> 1) The name of the package is "logrotate-3.6.5" but the name of the
> source distribution tarball is "logrotate_3.6.5.orig.tar.gz"
> 
> So I set:
> 
> DISTNAME=       ${PKGNAME:S/-/_/}.orig
> PKGNAME=        logrotate-3.6.5
> 


Looks ok to me.

> ...based on some other package's Makefiles, but that isn't being useful
> or more likely I'm using it wrong.  Plus I'm not sure how to use a
> sed(1) regex to insert into a string, so maybe someone can offer some
> insign there
> 
> The URL of the file is:
> 
> http://http.us.debian.org/debian/pool/main/l/logrotate/logrotate_3.6.5.orig.tar.gz
> 
> So I set:
> 
> MASTER_SITES=   ${MASTER_SITE_DEBIAN:=pool/main/l/logrotate/}

Good.

> 
> ...and that seems to work.
> 
> 2) I had to completely re-write the Makefile (included in my tar file as
> ./Makefile-logrotate_src) included with the original package tarball (to
> the point where it would be silly to submit a patch file, it would make
> more sense to have a "pre-build:" targate and ${CP} the working one from
> ${FILES}/Makefile to ${WRKDIR}/${DISTNAME}/Makefile and overwrite the
> inclded one).  I also had to setup a "do-install:" target because the
> Makefile would have been overkill.  


Don't use ${CP}, use the variables provideds by pkgsrc ( bsd.pkg.mk )
INSTALL_PROGRAM, INSTALL_SCRIPT, etc .


> 
> I was running into some ld(1) errors at that point, so I had to
> statically pound -L/usr/pkg/lib into the CFLAGS variable (an obvious
> error), but now I'm getting:
> 
> *** The above programs/libs will not find the listed shared libraries
>     at runtime. Please fix the package (add -Wl,-R.../lib in the right
> places)!
> *** Error code 1

Looking at the Makefile of logrotate:


CFLAGS += -Wl,-R.../lib -lpopt -lintl -D_GNU_SOURCE -DVERSION=\"$(VERSION)\"
-L/usr/pkg/lib
^^^^^^^^^^^^^

Don't use harcoded paths, use LDFLAGS instead, you can see the contents of this
variable with ( make show-var VARNAME=LDFLAGS ).


> 
> And indeed, the sbin/ binary is not linking properly:
> 
> # ldd /usr/pkg/sbin/logrotate 
> /usr/pkg/sbin/logrotate:
>          -lpopt.0 => not found
>          -lintl.0 => /usr/lib/libintl.so.0
>          -lc.12 => /usr/lib/libc.so.12
> 
> ...which seems odd that it would link to libintl but not lpopt.  So
> maybe someone can enlighten me on the voodoo behind our ld(1) ?  I can
> only assume statically setting $LDFLAGS would be further erroneous.  I
> thought buildlink2.mk took care of setting all those environmentals!
> 

Good luck.

-- 
Juan RP		<jrp@hispabsd.org>
--

--B?2)ZzGb=.n=:z1d
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (NetBSD)

iD8DBQE/K2PqmOEpHEa5ttcRAuxNAJ9ElNAYPPEHVQhfQxhMFjNX+JPvjwCdHnEM
j6URFzm3rCKIjXQlgLyJne0=
=YZfs
-----END PGP SIGNATURE-----

--B?2)ZzGb=.n=:z1d--