ensure that we always install static binaries to gotweb's chroot Compile static libexec binaries for gotweb, keeping them separate from the main build. Use the same source files but a separate set of Makefiles. Previously, 'make web-install' installed whichever libexec binaries had already been built, and if those happened to be dynamically linked they failed to run inside the chroot which resulted in "privsep peer process closed pipe" being rendered on the index page.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
diff --git a/Makefile b/Makefile
index 50b44e8..39e9e02 100644
--- a/Makefile
+++ b/Makefile
@@ -30,9 +30,9 @@ dist: clean
rm got-dist.txt.new
web:
- ${MAKE} -C gotweb MAKEWEB=Yes
+ ${MAKE} -C gotweb
web-install:
- ${MAKE} -C gotweb install MAKEWEB=Yes
+ ${MAKE} -C gotweb install
.include <bsd.subdir.mk>
diff --git a/Makefile.inc b/Makefile.inc
index c51458d..bb6ed69 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -27,22 +27,3 @@ DEBUG = -O0 -g
.endif
.endif
-
-.if "${MAKEWEB}" == "Yes"
-LDADD += -L${PREFIX}/lib -lz -lutil
-LDSTATIC = ${STATIC}
-PREFIX = /usr/local
-CHROOT_DIR = /var/www
-GOTWEB_DIR = /cgi-bin/gotweb
-LIBEXECDIR = ${GOTWEB_DIR}/libexec
-LIBEXEC_DIR = ${CHROOT_DIR}${LIBEXECDIR}
-ETC_DIR = ${CHROOT_DIR}/etc
-HTTPD_DIR = ${CHROOT_DIR}/htdocs
-TMP_DIR = ${CHROOT_DIR}/tmp
-PROG_DIR = ${HTTPD_DIR}/${PROG}
-CGI_DIR = ${CHROOT_DIR}${GOTWEB_DIR}
-TMPL_DIR = ${CGI_DIR}/gw_tmpl
-PUB_REPOS_DIR = ${CHROOT_DIR}/got/public
-WWWUSR ?= www
-WWWGRP ?= www
-.endif
diff --git a/gotweb/Makefile b/gotweb/Makefile
index a738cb3..3a1ae06 100644
--- a/gotweb/Makefile
+++ b/gotweb/Makefile
@@ -1,8 +1,9 @@
.PATH:${.CURDIR}/../lib
-SUBDIR = ../libexec
+SUBDIR = libexec
.include "../got-version.mk"
+.include "Makefile.inc"
PROG = gotweb
SRCS = gotweb.c parse.y blame.c commit_graph.c delta.c diff.c \
@@ -14,9 +15,8 @@ SRCS = gotweb.c parse.y blame.c commit_graph.c delta.c diff.c \
MAN = ${PROG}.conf.5
CPPFLAGS += -I${.CURDIR}/../include -I${.CURDIR}/../lib -I${.CURDIR} \
- -I${PREFIX}/include
-
-LDADD = -L${PREFIX}/lib -lkcgihtml -lkcgi -lz -lutil
+ -I${KCGIBASE}/include
+LDADD += -L${KCGIBASE}/lib -lkcgihtml -lkcgi
LDSTATIC = ${STATIC}
.if ${GOT_RELEASE} != "Yes"
diff --git a/gotweb/Makefile.inc b/gotweb/Makefile.inc
new file mode 100644
index 0000000..f7c4df6
--- /dev/null
+++ b/gotweb/Makefile.inc
@@ -0,0 +1,16 @@
+KCGIBASE ?= /usr/local
+LDADD += -lz -lutil
+LDSTATIC = ${STATIC}
+CHROOT_DIR = /var/www
+GOTWEB_DIR = /cgi-bin/gotweb
+LIBEXECDIR = ${GOTWEB_DIR}/libexec
+LIBEXEC_DIR = ${CHROOT_DIR}${LIBEXECDIR}
+ETC_DIR = ${CHROOT_DIR}/etc
+HTTPD_DIR = ${CHROOT_DIR}/htdocs
+TMP_DIR = ${CHROOT_DIR}/tmp
+PROG_DIR = ${HTTPD_DIR}/${PROG}
+CGI_DIR = ${CHROOT_DIR}${GOTWEB_DIR}
+TMPL_DIR = ${CGI_DIR}/gw_tmpl
+PUB_REPOS_DIR = ${CHROOT_DIR}/got/public
+WWWUSR ?= www
+WWWGRP ?= www
diff --git a/gotweb/libexec/Makefile b/gotweb/libexec/Makefile
new file mode 100644
index 0000000..a4c900b
--- /dev/null
+++ b/gotweb/libexec/Makefile
@@ -0,0 +1,4 @@
+SUBDIR = got-read-blob got-read-commit got-read-object got-read-tree \
+ got-read-tag got-read-pack got-read-gitconfig
+
+.include <bsd.subdir.mk>
diff --git a/gotweb/libexec/Makefile.inc b/gotweb/libexec/Makefile.inc
new file mode 100644
index 0000000..ea1131a
--- /dev/null
+++ b/gotweb/libexec/Makefile.inc
@@ -0,0 +1,11 @@
+.include "../Makefile.inc"
+
+realinstall:
+ if [ ! -d ${CHROOT_DIR}${LIBEXECDIR}/. ]; then \
+ ${INSTALL} -d -o root -g daemon -m 755 \
+ ${CHROOT_DIR}${LIBEXECDIR}; \
+ fi
+ ${INSTALL} ${INSTALL_COPY} -o root -g daemon -m 755 ${PROG} \
+ ${CHROOT_DIR}${LIBEXECDIR}/${PROG}
+
+NOMAN = Yes
diff --git a/gotweb/libexec/got-read-blob/Makefile b/gotweb/libexec/got-read-blob/Makefile
new file mode 100644
index 0000000..fb9095d
--- /dev/null
+++ b/gotweb/libexec/got-read-blob/Makefile
@@ -0,0 +1,15 @@
+
+.include "../../../got-version.mk"
+
+PROG= got-read-blob
+SRCS= got-read-blob.c error.c inflate.c object_parse.c \
+ path.c privsep.c sha1.c
+
+CPPFLAGS = -I${.CURDIR}/../../../include -I${.CURDIR}/../../../lib
+LDADD = -lutil -lz
+DPADD = ${LIBZ} ${LIBUTIL}
+LDSTATIC = ${STATIC}
+
+.PATH: ${.CURDIR}/../../../lib ${.CURDIR}/../../../libexec/got-read-blob
+
+.include <bsd.prog.mk>
diff --git a/gotweb/libexec/got-read-commit/Makefile b/gotweb/libexec/got-read-commit/Makefile
new file mode 100644
index 0000000..1e78a9b
--- /dev/null
+++ b/gotweb/libexec/got-read-commit/Makefile
@@ -0,0 +1,15 @@
+
+.include "../../../got-version.mk"
+
+PROG= got-read-commit
+SRCS= got-read-commit.c error.c inflate.c object_parse.c \
+ path.c privsep.c sha1.c
+
+CPPFLAGS = -I${.CURDIR}/../../../include -I${.CURDIR}/../../../lib
+LDADD = -lutil -lz
+DPADD = ${LIBZ} ${LIBUTIL}
+LDSTATIC = ${STATIC}
+
+.PATH: ${.CURDIR}/../../../lib ${.CURDIR}/../../../libexec/got-read-commit
+
+.include <bsd.prog.mk>
diff --git a/gotweb/libexec/got-read-gitconfig/Makefile b/gotweb/libexec/got-read-gitconfig/Makefile
new file mode 100644
index 0000000..76cd8d7
--- /dev/null
+++ b/gotweb/libexec/got-read-gitconfig/Makefile
@@ -0,0 +1,15 @@
+
+.include "../../../got-version.mk"
+
+PROG= got-read-gitconfig
+SRCS= got-read-gitconfig.c error.c inflate.c object_parse.c \
+ path.c privsep.c sha1.c gitconfig.c
+
+CPPFLAGS = -I${.CURDIR}/../../../include -I${.CURDIR}/../../../lib
+LDADD = -lutil -lz
+DPADD = ${LIBZ} ${LIBUTIL}
+LDSTATIC = ${STATIC}
+
+.PATH: ${.CURDIR}/../../../lib ${.CURDIR}/../../../libexec/got-read-gitconfig
+
+.include <bsd.prog.mk>
diff --git a/gotweb/libexec/got-read-object/Makefile b/gotweb/libexec/got-read-object/Makefile
new file mode 100644
index 0000000..22604cc
--- /dev/null
+++ b/gotweb/libexec/got-read-object/Makefile
@@ -0,0 +1,15 @@
+
+.include "../../../got-version.mk"
+
+PROG= got-read-object
+SRCS= got-read-object.c error.c inflate.c object_parse.c \
+ path.c privsep.c sha1.c
+
+CPPFLAGS = -I${.CURDIR}/../../../include -I${.CURDIR}/../../../lib
+LDADD = -lutil -lz
+DPADD = ${LIBZ} ${LIBUTIL}
+LDSTATIC = ${STATIC}
+
+.PATH: ${.CURDIR}/../../../lib ${.CURDIR}/../../../libexec/got-read-object
+
+.include <bsd.prog.mk>
diff --git a/gotweb/libexec/got-read-pack/Makefile b/gotweb/libexec/got-read-pack/Makefile
new file mode 100644
index 0000000..eae7dbb
--- /dev/null
+++ b/gotweb/libexec/got-read-pack/Makefile
@@ -0,0 +1,16 @@
+
+.include "../../../got-version.mk"
+
+PROG= got-read-pack
+SRCS= got-read-pack.c delta.c error.c inflate.c object_cache.c \
+ object_idset.c object_parse.c opentemp.c pack.c path.c \
+ privsep.c sha1.c delta_cache.c
+
+CPPFLAGS = -I${.CURDIR}/../../../include -I${.CURDIR}/../../../lib
+LDADD = -lutil -lz
+DPADD = ${LIBZ} ${LIBUTIL}
+LDSTATIC = ${STATIC}
+
+.PATH: ${.CURDIR}/../../../lib ${.CURDIR}/../../../libexec/got-read-pack
+
+.include <bsd.prog.mk>
diff --git a/gotweb/libexec/got-read-tag/Makefile b/gotweb/libexec/got-read-tag/Makefile
new file mode 100644
index 0000000..375212d
--- /dev/null
+++ b/gotweb/libexec/got-read-tag/Makefile
@@ -0,0 +1,15 @@
+
+.include "../../../got-version.mk"
+
+PROG= got-read-tag
+SRCS= got-read-tag.c error.c inflate.c object_parse.c \
+ path.c privsep.c sha1.c
+
+CPPFLAGS = -I${.CURDIR}/../../../include -I${.CURDIR}/../../../lib
+LDADD = -lutil -lz
+DPADD = ${LIBZ} ${LIBUTIL}
+LDSTATIC = ${STATIC}
+
+.PATH: ${.CURDIR}/../../../lib ${.CURDIR}/../../../libexec/got-read-tag
+
+.include <bsd.prog.mk>
diff --git a/gotweb/libexec/got-read-tree/Makefile b/gotweb/libexec/got-read-tree/Makefile
new file mode 100644
index 0000000..b601aea
--- /dev/null
+++ b/gotweb/libexec/got-read-tree/Makefile
@@ -0,0 +1,15 @@
+
+.include "../../../got-version.mk"
+
+PROG= got-read-tree
+SRCS= got-read-tree.c error.c inflate.c object_parse.c \
+ path.c privsep.c sha1.c
+
+CPPFLAGS = -I${.CURDIR}/../../../include -I${.CURDIR}/../../../lib
+LDADD = -lutil -lz
+DPADD = ${LIBZ} ${LIBUTIL}
+LDSTATIC = ${STATIC}
+
+.PATH: ${.CURDIR}/../../../lib ${.CURDIR}/../../../libexec/got-read-tree
+
+.include <bsd.prog.mk>