Re: [patch] Add static FLAVOR to www/cgit-8.3.5p1 (OPENBSD_5_1)

2012-09-18 Thread Todd T. Fries
Penned by Landry Breuil on 20120916 14:16.02, we have:
| On Sun, Sep 16, 2012 at 12:11:10PM +0100, Stuart Henderson wrote:
| > On 2012/09/16 10:56, Olivier Mehani wrote:
| > > Hi all,
| > > 
| > > Cgit in ports seems to be a ligtweight web interface to Git. However, to
| > > run its binary from ports in a chroot requires to copy a bunch of
| > > libraries in the chroot (or ???Premature end of script headers:
| > > /cgi-bin/cgit.cgi??? will ensue; `ldd /var/www/cgi-bin/cgit.cgi` is your
| > > friend), which I'd rather not.
| > > 
| > > The attached patch to the Makefile fixes this by adding a static flavour
| > > to the port. I have it running on my 5.1 server at the moment, without
| > > shared libs, and it seems to behave fine, but I haven't tested it
| > > thoroughly yet.
| > 
| > Is there any point in making this a flavour, wouldn't this be a
| > sane thing to do by default?
| > 
| > > There might be a mistake in the way I handled the MODULES variable (it's
| > > unconditionally set), which might result in the -static package to have
| > > a spurious dependency. I'm happy to be corrected on that (:
| > 
| > That's ok, you should have the dependency listed.
| > 
| > For statically linked things I would also continue to use the WANTLIB
| > on c/crypto/pthread/z even though it shows as "extra" in check-lib-depends,
| > otherwise fixes in the base libraries won't trigger the package getting
| > updated.
| > 
| > btw this needs testing on -current before it can go in, 5.1 (and even
| > 5.2) is too old for a valid test.
| 
| Here's a (simpler?) diff for -current that seems to work here.
| 
| Landry

This sounds like a fine idea, ok todd@ .. I'd like to use it in the future ;-)

| Index: Makefile
| ===
| RCS file: /cvs/ports/www/cgit/Makefile,v
| retrieving revision 1.5
| diff -u -r1.5 Makefile
| --- Makefile  6 Mar 2012 17:17:09 -   1.5
| +++ Makefile  16 Sep 2012 19:15:03 -
| @@ -3,6 +3,7 @@
|  COMMENT =web frontend for git repositories
|  
|  DISTNAME =   cgit-0.9.0.2
| +REVISION =   0
|  CATEGORIES = www devel
|  
|  DISTFILES =  cgit-0.9.0.2.tar.gz:0 \
| @@ -26,7 +27,7 @@
|  WANTLIB +=   c crypto pthread z
|  
|  PREFIX = /var/www
| -MAKE_FLAGS +=V=1 NEEDS_LIBICONV=1 LDFLAGS+=-L${LOCALBASE}/lib
| +MAKE_FLAGS +=V=1 NEEDS_LIBICONV=1 LDFLAGS+='-static 
-L${LOCALBASE}/lib'
|  
|  post-extract:
|   rmdir ${WRKSRC}/git


-- 
Todd Fries .. t...@fries.net

 _
| \  1.636.410.0632 (voice)
| Free Daemon Consulting, LLC \  1.405.227.9094 (voice)
| http://FreeDaemonConsulting.com \  1.866.792.3418 (FAX)
| 2525 NW Expy #525, Oklahoma City, OK 73112  \  sip:freedae...@ekiga.net
| "..in support of free software solutions."  \  sip:4052279...@ekiga.net
 \\
 
  37E7 D3EB 74D0 8D66 A68D  B866 0326 204E 3F42 004A
http://todd.fries.net/pgp.txt



Re: [patch] Add static FLAVOR to www/cgit-8.3.5p1 (OPENBSD_5_1)

2012-09-16 Thread Landry Breuil
On Sun, Sep 16, 2012 at 12:11:10PM +0100, Stuart Henderson wrote:
> On 2012/09/16 10:56, Olivier Mehani wrote:
> > Hi all,
> > 
> > Cgit in ports seems to be a ligtweight web interface to Git. However, to
> > run its binary from ports in a chroot requires to copy a bunch of
> > libraries in the chroot (or ???Premature end of script headers:
> > /cgi-bin/cgit.cgi??? will ensue; `ldd /var/www/cgi-bin/cgit.cgi` is your
> > friend), which I'd rather not.
> > 
> > The attached patch to the Makefile fixes this by adding a static flavour
> > to the port. I have it running on my 5.1 server at the moment, without
> > shared libs, and it seems to behave fine, but I haven't tested it
> > thoroughly yet.
> 
> Is there any point in making this a flavour, wouldn't this be a
> sane thing to do by default?
> 
> > There might be a mistake in the way I handled the MODULES variable (it's
> > unconditionally set), which might result in the -static package to have
> > a spurious dependency. I'm happy to be corrected on that (:
> 
> That's ok, you should have the dependency listed.
> 
> For statically linked things I would also continue to use the WANTLIB
> on c/crypto/pthread/z even though it shows as "extra" in check-lib-depends,
> otherwise fixes in the base libraries won't trigger the package getting
> updated.
> 
> btw this needs testing on -current before it can go in, 5.1 (and even
> 5.2) is too old for a valid test.

Here's a (simpler?) diff for -current that seems to work here.

Landry
Index: Makefile
===
RCS file: /cvs/ports/www/cgit/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- Makefile6 Mar 2012 17:17:09 -   1.5
+++ Makefile16 Sep 2012 19:15:03 -
@@ -3,6 +3,7 @@
 COMMENT =  web frontend for git repositories
 
 DISTNAME = cgit-0.9.0.2
+REVISION = 0
 CATEGORIES =   www devel
 
 DISTFILES =cgit-0.9.0.2.tar.gz:0 \
@@ -26,7 +27,7 @@
 WANTLIB += c crypto pthread z
 
 PREFIX =   /var/www
-MAKE_FLAGS +=  V=1 NEEDS_LIBICONV=1 LDFLAGS+=-L${LOCALBASE}/lib
+MAKE_FLAGS +=  V=1 NEEDS_LIBICONV=1 LDFLAGS+='-static -L${LOCALBASE}/lib'
 
 post-extract:
rmdir ${WRKSRC}/git


Re: [patch] Add static FLAVOR to www/cgit-8.3.5p1 (OPENBSD_5_1)

2012-09-16 Thread Stuart Henderson
On 2012/09/16 10:56, Olivier Mehani wrote:
> Hi all,
> 
> Cgit in ports seems to be a ligtweight web interface to Git. However, to
> run its binary from ports in a chroot requires to copy a bunch of
> libraries in the chroot (or “Premature end of script headers:
> /cgi-bin/cgit.cgi” will ensue; `ldd /var/www/cgi-bin/cgit.cgi` is your
> friend), which I'd rather not.
> 
> The attached patch to the Makefile fixes this by adding a static flavour
> to the port. I have it running on my 5.1 server at the moment, without
> shared libs, and it seems to behave fine, but I haven't tested it
> thoroughly yet.

Is there any point in making this a flavour, wouldn't this be a
sane thing to do by default?

> There might be a mistake in the way I handled the MODULES variable (it's
> unconditionally set), which might result in the -static package to have
> a spurious dependency. I'm happy to be corrected on that (:

That's ok, you should have the dependency listed.

For statically linked things I would also continue to use the WANTLIB
on c/crypto/pthread/z even though it shows as "extra" in check-lib-depends,
otherwise fixes in the base libraries won't trigger the package getting
updated.

btw this needs testing on -current before it can go in, 5.1 (and even
5.2) is too old for a valid test.



[patch] Add static FLAVOR to www/cgit-8.3.5p1 (OPENBSD_5_1)

2012-09-16 Thread Olivier Mehani
Hi all,

Cgit in ports seems to be a ligtweight web interface to Git. However, to
run its binary from ports in a chroot requires to copy a bunch of
libraries in the chroot (or ???Premature end of script headers:
/cgi-bin/cgit.cgi??? will ensue; `ldd /var/www/cgi-bin/cgit.cgi` is your
friend), which I'd rather not.

The attached patch to the Makefile fixes this by adding a static flavour
to the port. I have it running on my 5.1 server at the moment, without
shared libs, and it seems to behave fine, but I haven't tested it
thoroughly yet.

There might be a mistake in the way I handled the MODULES variable (it's
unconditionally set), which might result in the -static package to have
a spurious dependency. I'm happy to be corrected on that (:

Hope this helps!

-- 
Olivier Mehani 
PGP fingerprint: 4435 CF6A 7C8D DD9B E2DE  F5F9 F012 A6E2 98C6 6655
Index: Makefile
===
@@ -23,8 +23,17 @@
 
 USE_GMAKE =yes
 
+FLAVORS=   static
+FLAVOR?=
+
 MODULES =  converters/libiconv
+.if ${FLAVOR:L} == "static"
+CFLAGS +=  -static
+LDFLAGS += -static
+MAKEFLAGS +=   CFLAGS+=-static LDFLAGS+=-static
+.else
 WANTLIB += c crypto pthread z
+.endif
 
 PREFIX =   /var/www
 MAKE_FLAGS +=  V=1 NEEDS_LIBICONV=1 LDFLAGS+=-L${LOCALBASE}/lib