source: server/fedora/Makefile @ 407

Last change on this file since 407 was 407, checked in by andersk, 15 years ago
Fix the stupid rpmbuild symlink bug.
File size: 5.2 KB
RevLine 
[1]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
[64]21upstream        = openafs krb5 httpd mit-zephyr
[138]22oursrc          = execsys tokensys accountadm httpdmods logview sql-signup
[1]23allsrc          = $(upstream) $(oursrc)
24oursrcdir       = ${PWD}/../common/oursrc
25patches         = ${PWD}/../common/patches
[59]26metapatches     = ${PWD}/meta-patches
[1]27specs           = ${PWD}/specs
28
[353]29topdir          = ${HOME}/rpmbuild
30tmp_build       = $(topdir)/BUILD
31tmp_specs       = $(topdir)/SPECS
32tmp_src         = $(topdir)/SOURCES
33out_rpms        = $(topdir)/RPMS
34out_srpms       = $(topdir)/SRPMS
35out_sbin        = $(topdir)/sbin
[1]36
37dload           = ${PWD}/.dload
[260]38server_url      = "http://web.mit.edu/scripts/src"
[1]39server_arch     = "fedora.stable"
40
[316]41openafs_rpm_args = -E "%define kernvers $(shell rpm -q --qf "%{Version}-%{Release}\n" --whatprovides kernel | sort -n | tail -n1)"
[1]42
43.PHONY: minimal-clean
44
45info:
46        @echo "The following packages are available:"; \
47        echo "$(allsrc)"; \
48        echo "Run 'make all' to build all packages."
49
50minimal-clean:
51        rm -rf $(topdir) $(dload)
52
53clean: minimal-clean
54        rm -rf $(out_rpms) $(out_srpms) $(out_sbin)
55
56mkdir-tree:
[407]57        @rpmdev-setuptree
58        mkdir -p $(out_sbin)
59        ln -sTf $(topdir) rpmbuild
[1]60
61download:
[66]62        -@wget -O- -nv $(server_url)/$(server_arch) | wget -i- -nv -N -B $(server_url)/ -nd -nH -P $(dload);
[1]63
64copy-patches: mkdir-tree
[59]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;
[1]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}; \
[31]89        list=`find -mindepth 1 -maxdepth 1 -type d | grep -v ".svn"`; \
[1]90        for i in $$list; do \
91                pushd $$i; \
[119]92                if [ -x ./mrproper ]; then \
93                        ./mrproper; \
94                        autoconf; \
95                fi; \
[1]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
[11]119        PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" \
[353]120        rpmbuild -ba ${tmp_specs}/$@*.spec
[1]121
[103]122openafs-kernel: setup
[79]123        PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" \
[353]124        rpmbuild $(openafs_rpm_args) -bb --define "build_userspace 0" --define "build_modules 1" ${tmp_specs}/openafs*.spec
[79]125
[6]126suexec: install-srpms
[1]127        @rm -rf ${tmp_src}/httpd-2*/; \
128        tar zxvf ${tmp_src}/httpd-2*.tar.gz; \
[8]129        cd httpd-2*; \
[1]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=/; \
[8]132        pushd support; \
[299]133        mkdir -p ${out_sbin}; make suexec && cp suexec ${out_sbin}; \
[8]134        popd; \
135        rm -rf httpd-2*; \
[1]136        echo; \
137        echo "suexec binary written to ${out_sbin}."; \
138        echo "Run 'make install-suexec' as root to install it.";
139
140install-suexec:
[404]141        install -m 4510 -o 0 -g apache ${out_sbin}/suexec /usr/sbin/;
[36]142
[177]143frob-openafs:
144        @if [ ! -d "/etc/openafs/" ]; then \
145        echo "/etc/openafs does not exist"; \
146        exit 1; \
147        else \
148        ln -nfs /etc/openafs/* /usr/vice/etc/; \
149        fi
150
[68]151# The following packages are needed for our packages
152# basic deps: kernel-devel through krb5-workstation
[36]153# oursrc: hesinfo
[63]154# httpdmods: httpd-devel
[36]155# httpd: xmlto through distcache-devel
[352]156# krb5: bison through texinfo keyutils-libs-devel
[36]157# openafs: pam-devel through automake
[68]158# mit-zephyr: readline-devel hesiod.i386 libXt.i386 compat-readline43
[36]159install-deps:
[353]160        yum -y install kernel-devel rpm-build rpmdevtools 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 keyutils-libs-devel pam-devel automake readline-devel hesiod.i386 libXt.i386
[68]161        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.