Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Sep 2000 18:07:48 +0300
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        Espen Skoglund <esk@ira.uka.de>
Cc:        ports@FreeBSD.org
Subject:   Re: Modifying linkopts in libtool
Message-ID:  <39CB75C4.FD5FA957@FreeBSD.org>
References:  <14795.15262.123604.865457@i30nb2.ira.uka.de> <39CB6ADF.2976F4EF@FreeBSD.org> <14795.28046.251154.85719@i30nb2.ira.uka.de> <39CB72B3.4B256183@FreeBSD.org> <14795.29665.324923.882046@i30nb2.ira.uka.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Espen Skoglund wrote:

> [Maxim Sobolev]
> > Espen Skoglund wrote:
> >> [Maxim Sobolev]
> >>> Espen Skoglund wrote:
> >>>> Hi,
> >>>>
> >>>> I was trying to create a port containing a shared library using
> >>>> the _fini() function for cleanup.  The package was also using
> >>>> libtool, and it had put `linkopts=-nostdlib' in its ltmain.sh in
> >>>> order avoid conflicts with the _fini() function in crtbeginS.o.
> >>>> However, when I specify USE_LIBTOOL in the port-makefile, the
> >>>> port-version of libtool is used instead of the one inside the
> >>>> package.  Does anyone have any suggestion of how to cope with
> >>>> this?  I thought about modifying the package makefile or
> >>>> something, but this is sort of troublesome because libtool
> >>>> ignores most of the command line options that you pass to it.
> >>>> The soultion that I've currently come up with is to add a
> >>>> pre-build target that patches the produced libtool script to
> >>>> include the linkopts line above, but I would prefer something
> >>>> that could be incorporated into the package.
> >>
> >>> Add `CONFIGURE_ENV= LDFLAGS="linkopts=-nostdlib"' into port's
> >>> Makefile or patch appropriate Makefile.in.
> >>
> >> Well, this won't work.  First of all, the linkopts is a shell
> >> variable which is defined in the generated libtool script.  Second,
> >> setting LDFLAGS or anything in the Makefile won't work because the
> >> libtool script tends to ignore most of the arguments given to gcc.
> >> As far as I can tell by a quick look through the script, the
> >> command line for linking is produced by:
> >>
> >> archive_cmds="\$CC -shared \$compile_rpath \$libobjs \$deplibs \
> >>   \$linkopts \${wl}-soname \$wl \$soname -o \$lib"
> >>
> >> which does not really give any room for extra flags.
>
> > Oh, I see my error. Here is right version:
> > `CONFIGURE_ENV= LDFLAGS="-nostdlib"'
>
> Does not work since the libtool script ignores the -nostdlib flag when
> producing the actual command line.

Oh, ok:
post-configure:
    ${PERL} -pi -e 's|\$$linkopts|\$$linkopts -nostdlib|' ${WRKSRC}/libtool

-Maxim



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?39CB75C4.FD5FA957>