source: server/fedora/Makefile @ 142

Last change on this file since 142 was 138, checked in by jbarnold, 18 years ago
added logview package; fixed signup homedir
File size: 5.1 KB
Line 
1# Makefile for building scripts.mit.edu Fedora packages
2# Copyright (C) 2006  Jeff Arnold <jbarnold@mit.edu>
3#                and  Joe Presbrey <presbrey@mit.edu>
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU General Public License
7# as published by the Free Software Foundation; either version 2
8# of the License, or (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18#
19# See /COPYRIGHT in this repository for more information.
20
21upstream        = openafs krb5 httpd mit-zephyr
22oursrc          = execsys tokensys accountadm httpdmods logview sql-signup
23allsrc          = $(upstream) $(oursrc)
24oursrcdir       = ${PWD}/../common/oursrc
25patches         = ${PWD}/../common/patches
26metapatches     = ${PWD}/meta-patches
27specs           = ${PWD}/specs
28
29topdir          = ${PWD}/.tmp
30tmp_build       = ${PWD}/.tmp/BUILD
31tmp_specs       = ${PWD}/.tmp/SPECS
32tmp_src         = ${PWD}/.tmp/SOURCES
33out_rpms        = ${PWD}/RPMS
34out_srpms       = ${PWD}/SRPMS
35tree            = $(topdir) $(tmp_build) $(tmp_specs) $(tmp_src) $(out_rpms) $(out_srpms) 
36out_sbin        = ${PWD}/sbin
37
38dload           = ${PWD}/.dload
39server_url      = "http://scripts.mit.edu/src"
40server_arch     = "fedora.stable"
41
42rpm_args        = -E '%define _smp_mflags -j4' -E '%define _topdir $(topdir)' -E '%define _rpmdir $(out_rpms)' -E '%define _srcrpmdir $(out_srpms)'
43#-E '%define kernvers %(rpm -q --whatprovides kernel | sort | tail -1)'
44
45.PHONY: minimal-clean
46
47info:
48        @echo "The following packages are available:"; \
49        echo "$(allsrc)"; \
50        echo "Run 'make all' to build all packages."
51
52minimal-clean:
53        rm -rf $(topdir) $(dload)
54
55clean: minimal-clean
56        rm -rf $(out_rpms) $(out_srpms) $(out_sbin)
57
58mkdir-tree:
59        @mkdir -p $(tree);
60
61download:
62        -@wget -O- -nv $(server_url)/$(server_arch) | wget -i- -nv -N -B $(server_url)/ -nd -nH -P $(dload);
63
64copy-patches: mkdir-tree
65        @cp $(patches)/*.patch $(tmp_src); \
66        cd $(tmp_src); \
67        list=`ls $(metapatches)/*.patch`; \
68        for i in $$list; do \
69                patch < $$i; \
70        done;
71
72install-srpms: mkdir-tree download
73        rpm $(rpm_args) -i $(dload)/*.src.rpm 2>/dev/null;
74
75copy-specs: mkdir-tree
76        cp ${specs}/*.spec $(tmp_specs)
77
78patch-specs: install-srpms
79        @cd ${tmp_specs}; \
80        list=`ls ${specs}/*.spec.patch`; \
81        for i in $$list; do \
82                patch < $$i; \
83        done;
84
85# 1. use the package's Makefile to delete leftover files and run autoconf
86# 2. create a tarball (we want it to contain the autoconf output)
87create-tarballs: mkdir-tree
88        @cd ${oursrcdir}; \
89        list=`find -mindepth 1 -maxdepth 1 -type d | grep -v ".svn"`; \
90        for i in $$list; do \
91                pushd $$i; \
92                if [ -x ./mrproper ]; then \
93                        ./mrproper; \
94                        autoconf; \
95                fi; \
96                popd; \
97                tar -czf $(tmp_src)/$$i.tar.gz $$i; \
98        done;
99
100setup: install-srpms copy-patches copy-specs patch-specs create-tarballs
101
102# Do not work:
103#rpms: setup
104#       rpmbuild $(rpm_args) -bb ${tmp_specs}/$(allsrc);
105#
106#srpms: setup
107#       rpmbuild $(rpm_args) -bs ${tmp_specs}/$(allsrc);
108
109oursrc:
110        make $(oursrc)
111
112upstream:
113        make $(upstream)
114
115all:
116        make $(allsrc)
117
118$(allsrc): setup
119        PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" \
120        rpmbuild $(rpm_args) -ba ${tmp_specs}/$@*.spec
121
122openafs-kernel: setup
123        PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" \
124        rpmbuild $(rpm_args) -bb --define "build_userspace 0" --define "build_modules 1" ${tmp_specs}/openafs*.spec
125
126suexec: install-srpms
127        @rm -rf ${tmp_src}/httpd-2*/; \
128        tar zxvf ${tmp_src}/httpd-2*.tar.gz; \
129        cd httpd-2*; \
130        patch -p1 < ${patches}/httpd-suexec-scripts.patch; \
131        ./configure --prefix=/etc/httpd --with-suexec-userdir=web_scripts --with-suexec-caller=apache --with-suexec-uidmin=50 --with-suexec-gidmin=50 --with-suexec-docroot=/; \
132        pushd support; \
133        make suexec && mkdir ${out_sbin} && cp suexec ${out_sbin}; \
134        popd; \
135        rm -rf httpd-2*; \
136        echo; \
137        echo "suexec binary written to ${out_sbin}."; \
138        echo "Run 'make install-suexec' as root to install it.";
139
140install-suexec:
141        install -m 4510 -o 0 -g apache ${PWD}/sbin/suexec /usr/sbin/;
142
143# The following packages are needed for our packages
144# basic deps: kernel-devel through krb5-workstation
145# oursrc: hesinfo
146# httpdmods: httpd-devel
147# httpd: xmlto through distcache-devel
148# krb5: bison through texinfo
149# openafs: pam-devel through automake
150# mit-zephyr: readline-devel hesiod.i386 libXt.i386 compat-readline43
151install-deps:
152        yum -y install kernel-devel rpm-build gcc autoconf patch krb5-workstation hesinfo httpd-devel xmlto db4-devel expat-devel zlib-devel libselinux-devel apr-devel apr-util-devel pcre-devel openssl-devel distcache-devel bison ncurses-devel texinfo pam-devel automake readline-devel hesiod.i386 libXt.i386
153        rpm -ivh http://download.fedora.redhat.com/pub/fedora/linux/core/6/i386/os/Fedora/RPMS/compat-readline43-4.3-3.i386.rpm
Note: See TracBrowser for help on using the repository browser.