Hi,

This bumps the version of cgit from 1.0 to 1.1.

Changed in the patch below:
- pass the option NO_GETTEXT=1 to git to disable gettext support.
- add a patch patches/patch-setup_c to not open /dev/null in the chroot.
  alternatively the user can not use this patch and make the device node in
  $chroot/dev/null and disable the "nodev" mountpoint option if needed.
- minor change made to patch/patch_Makefile required to patch.
- add a OpenBSD httpd (with slowcgi) example to the README.
- add an explanation a static gzip binary is required for .tar.gz snapshot 
support.

tested on amd64.


Unrelated, but maybe worth mentioning:
Cgit used to output a part of the header to the client, because it uses write(2)
directly unbuffered. I'm happy to report this commit in -current fixed it:
https://github.com/openbsd/src/commit/e6c0e46b10b1ac06c178c4ee0b2e0bd058797eb4


diff --git a/www/cgit/Makefile b/www/cgit/Makefile
index a3040ebf78e..ca9e9369059 100644
--- a/www/cgit/Makefile
+++ b/www/cgit/Makefile
@@ -2,11 +2,11 @@
 
 COMMENT =      web frontend for git repositories
 
-DISTNAME =     cgit-1.0
+DISTNAME =     cgit-1.1
 CATEGORIES =   www devel
 
 DISTFILES =    ${DISTNAME}.tar.gz:0 \
-               git-2.8.3.tar.gz:1
+               git-2.10.2.tar.gz:1
 
 MASTER_SITES0 =                http://git.zx2c4.com/cgit/snapshot/
 MASTER_SITES1 =                https://www.kernel.org/pub/software/scm/git/
@@ -20,7 +20,7 @@ USE_GMAKE =   yes
 LIB_DEPENDS =  converters/libiconv
 
 PREFIX =       ${VARBASE}/www
-MAKE_FLAGS +=  V=1 NO_LUA=1 LDFLAGS+='${STATIC} -L${LOCALBASE}/lib'
+MAKE_FLAGS +=  V=1 NO_GETTEXT=1 NO_LUA=1 LDFLAGS+='${STATIC} 
-L${LOCALBASE}/lib'
 
 post-extract:
        rmdir ${WRKSRC}/git
diff --git a/www/cgit/distinfo b/www/cgit/distinfo
index d71bfacc15a..d1f527d5097 100644
--- a/www/cgit/distinfo
+++ b/www/cgit/distinfo
@@ -1,4 +1,4 @@
-SHA256 (cgit-1.0.tar.gz) = 56yIddhatPaqQc3fGB3JjAuoBI6HdFLOtEAcPucvpPQ=
-SHA256 (git-2.8.3.tar.gz) = La1Qx1gznW9SNTCdtiDlEkngAA/zSqLyrLy4TCEj7Qk=
-SIZE (cgit-1.0.tar.gz) = 105139
-SIZE (git-2.8.3.tar.gz) = 5847849
+SHA256 (cgit-1.1.tar.gz) = 9A3soz5VbJohi73Ce9nEd62ZxwhjkjCWhtIWkB3RDTs=
+SHA256 (git-2.10.2.tar.gz) = PX7yddgLl6qmHztr6dPcUWIC5vb12IXywJtZ66WS3MQ=
+SIZE (cgit-1.1.tar.gz) = 105738
+SIZE (git-2.10.2.tar.gz) = 6065116
diff --git a/www/cgit/patches/patch-Makefile b/www/cgit/patches/patch-Makefile
index a21e6ae7038..f3fc76d1edf 100644
--- a/www/cgit/patches/patch-Makefile
+++ b/www/cgit/patches/patch-Makefile
@@ -1,9 +1,8 @@
-$OpenBSD: patch-Makefile,v 1.7 2016/06/17 07:22:39 landry Exp $
---- Makefile.orig      Tue Jun  7 14:45:04 2016
-+++ Makefile   Fri Jun 17 07:30:53 2016
+--- Makefile.orig      Thu Feb 23 10:40:08 2017
++++ Makefile   Thu Feb 23 10:42:15 2017
 @@ -2,11 +2,11 @@ all::
  
- CGIT_VERSION = v1.0
+ CGIT_VERSION = v1.1
  CGIT_SCRIPT_NAME = cgit.cgi
 -CGIT_SCRIPT_PATH = /var/www/htdocs/cgit
 -CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH)
@@ -23,7 +22,7 @@ $OpenBSD: patch-Makefile,v 1.7 2016/06/17 07:22:39 landry Exp 
$
        $(INSTALL) -m 0644 favicon.ico $(DESTDIR)$(CGIT_DATA_PATH)/favicon.ico
        $(INSTALL) -m 0644 robots.txt $(DESTDIR)$(CGIT_DATA_PATH)/robots.txt
 -      $(INSTALL) -m 0755 -d $(DESTDIR)$(filterdir)
--      $(COPYTREE)  filters/* $(DESTDIR)$(filterdir)
+-      $(COPYTREE) filters/* $(DESTDIR)$(filterdir)
  
  install-doc: install-man install-html install-pdf
  
diff --git a/www/cgit/patches/patch-setup_c b/www/cgit/patches/patch-setup_c
new file mode 100644
index 00000000000..f7985677bb1
--- /dev/null
+++ b/www/cgit/patches/patch-setup_c
@@ -0,0 +1,18 @@
+--- git/setup.c.orig   Wed Mar  1 21:01:06 2017
++++ git/setup.c        Wed Mar  1 21:01:56 2017
+@@ -1024,6 +1024,7 @@ const char *resolve_gitdir(const char *suspect)
+ /* if any standard file descriptor is missing open it to /dev/null */
+ void sanitize_stdfds(void)
+ {
++#if 0
+       int fd = open("/dev/null", O_RDWR, 0);
+       while (fd != -1 && fd < 2)
+               fd = dup(fd);
+@@ -1031,6 +1032,7 @@ void sanitize_stdfds(void)
+               die_errno("open /dev/null or dup failed");
+       if (fd > 2)
+               close(fd);
++#endif
+ }
+ 
+ int daemonize(void)
diff --git a/www/cgit/pkg/README b/www/cgit/pkg/README
index fc0ef92f4dc..29f18b8eb5a 100644
--- a/www/cgit/pkg/README
+++ b/www/cgit/pkg/README
@@ -12,6 +12,21 @@ Refer to http://git.zx2c4.com/cgit/tree/cgitrc.5.txt for the 
syntax.
 Webserver config
 ================
 
+OpenBSD httpd
+-------------
+ext_ip="0.0.0.0"
+server "default" {
+       listen on $ext_ip port 80
+
+       # don't serve static files from cgit CGI: cgit.css and cgit.png
+       location "/cgit.*" {
+               root "/cgit"
+               no fastcgi
+       }
+       root "/cgi-bin/cgit.cgi"
+       fastcgi socket "/run/slowcgi.sock"
+}
+
 Nginx
 -----
 An example nginx config snippet is provided below, to run with
@@ -47,3 +62,14 @@ ScriptAlias /cgit /cgi-bin/cgit.cgi
        Order allow,deny
        Allow from all
 </Location>
+
+
+snapshots
+---------
+Nginx and OpenBSD httpd use chroot(2).
+
+For .tar.gz snapshot support a static binary in $chroot/bin/gzip is required.
+
+       cd /usr/src/usr.bin/compress
+       make clean && make LDFLAGS="-static -pie"
+       cp obj/compress $chroot/bin/gzip

-- 
Kind regards,
Hiltjo

Reply via email to