development/cgit: Added (web frontend for git repositories)

Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
This commit is contained in:
ponce 2011-07-03 13:39:37 -04:00 committed by Niels Horn
parent 8f35cc6ad9
commit 769dadaf44
8 changed files with 215 additions and 0 deletions

6
development/cgit/README Normal file
View File

@ -0,0 +1,6 @@
cgit is a web interface (cgi) for git repositories, written in C.
The folder /var/cache/cgit, must be owned by your webserver user.
A sample /etc/cgitrc (you must provide one) is in the $DOCS folder,
and so are some example configuration files for apache and lighttpd.

View File

@ -0,0 +1,90 @@
#!/bin/sh
# Slackware build script for cgit
# Written by ponce <matteo.bernardini@gmail.com>
PRGNAM=cgit
VERSION=${VERSION:-0.9.0.1}
CGIT_VERSION=${CGIT_VERSION:-v$VERSION}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
DOCS="cgitrc.5.txt COPYING README $CWD/config/cgit-lighttpd.conf \
$CWD/config/cgit-httpd.conf $CWD/config/cgitrc.sample"
GIT_TARBALL=$(grep \/git- $CWD/cgit.info | cut -d'/' -f8 | sed -e 's/\"//')
set -e # Exit on most errors
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.?z*
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# prepare sources
sed -i -e "s|-g -Wall -Igit|-Wall ${SLKCFLAGS} -Igit|" Makefile
sed -i -e "s|\/lib$|/lib${LIBDIRSUFFIX}|" Makefile
sed -i -e "s|(libdir)|(prefix)/share|" Makefile
cat $CWD/config/cgit.conf > cgit.conf
echo "CGIT_VERSION = $CGIT_VERSION" >> cgit.conf
# extract the git tarball
rm -fR git
tar xvf $CWD/$GIT_TARBALL
mv git-* git
make
make install DESTDIR=$PKG
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
install -m0644 -oroot $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
# prepare the cache dir: default permissions are for the apache user and group
mkdir -p $PKG/var/cache/cgit
chown 80.80 $PKG/var/cache/cgit
chmod 775 $PKG/var/cache/cgit
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View File

@ -0,0 +1,12 @@
PRGNAM="cgit"
VERSION="0.9.0.1"
HOMEPAGE="http://hjemli.net/git/cgit/"
DOWNLOAD="http://ponce.cc/slackware/sources/repo/cgit-0.9.0.1.tar.bz2 \
http://www.kernel.org/pub/software/scm/git/git-1.7.4.4.tar.bz2"
MD5SUM="dddae5bcfc1eeb469fc2b95531a75c1c \
1313f71d62fa100b32fa313769a85f2a"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
MAINTAINER="ponce"
EMAIL="matteo.bernardini@gmail.com"
APPROVED="dsomero"

View File

@ -0,0 +1,44 @@
# sample folder and virtual host configurations for httpd.
# edit, move it to /etc/httpd/extra and include it in
# /etc/httpd/httpd.conf with a line
#
# Include /etc/httpd/extra/cgit-httpd.conf
#
# uncomment also the line
#
# AddHandler cgi-script .cgi
<Directory /var/www/cgi-bin>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
## Version 1 (default): under /cgi-bin/cgit.cgi address
#ScriptAlias /cgi-bin/cgit.cgi /var/www/cgi-bin/cgit.cgi
#Alias /cgit/ /var/www/cgi-bin/
#<Location /cgit/cgit.cgi>
# Options FollowSymlinks ExecCGI
# Allow from All
#</Location>
#RewriteEngine on
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^/cgit/(.*)$ /cgit/cgit.cgi?url=$1 [L,QSA]
# Version 2: cgit as a handler to whole vhost:
<VirtualHost *:80>
ServerName cgit.my.domain
SetEnv CGIT_CONFIG /etc/cgitrc
Options FollowSymlinks ExecCGI
DirectoryIndex cgit.cgi
DocumentRoot /var/www/cgi-bin
<Location />
Options ExecCGI
Allow from All
</Location>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /cgit.cgi?url=$1 [L,QSA]
</VirtualHost>

View File

@ -0,0 +1,20 @@
# sample virtual host configuration for lighttpd.
# edit, move to /etc/lighttpd/ and include it in /etc/lighttpd/lighttpd.conf
# with a line
#
# include "cgit-lighttpd.conf"
$HTTP["host"] == "cgit.my.domain" {
alias.url = (
"/static/" => "/var/www/cgi-bin/",
"/cgit.cgi" => "/var/www/cgi-bin/cgit.cgi",
)
url.rewrite-once = (
"^/static/.*$" => "$0",
"^/([^?/]+/[^?]*)?(?:\?(.*))?$" => "/cgit.cgi?url=$1&$2",
)
cgi.assign = (
"/var/www/cgi-bin/cgit.cgi" => "",
)
}

View File

@ -0,0 +1,2 @@
CGIT_SCRIPT_PATH = /var/www/cgi-bin
CACHE_ROOT = /var/cache/cgit

View File

@ -0,0 +1,22 @@
# sample /etc/cgitrc file: two repos are defined
# you can see a demo here http://cgit.ponce.cc/
root-title=ponce's repository browser
root-desc=a fast interface to these git repositories
virtual-root=/
snapshots=tar.gz
#css=/static/cgit.css
#logo=/static/cgit.png
# repository specific data
repo.url=slackbuilds
repo.path=/path/to/repo/.git
repo.desc=slackbuilds.org fork for slackware-current
repo.owner=my.address _at_ my.isp
# the default branch here is set to current (default if omitted is master)
repo.defbranch=current
repo.clone-url=git://github.com/Ponce/slackbuilds.git
# if you need to display other repositories you can more config blocks
# like the one above

View File

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
cgit: cgit (web frontend for git repositories)
cgit:
cgit: cgit is a web interface (cgi) for git repositories, written in C.
cgit:
cgit: Homepage: http://hjemli.net/git/cgit/
cgit:
cgit:
cgit:
cgit:
cgit:
cgit: