| [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 |  | 
|---|
 | 21 | upstream        = openafs krb5 httpd | 
|---|
 | 22 | oursrc          = execsys tokensys lockeradm sqladm | 
|---|
 | 23 | allsrc          = $(upstream) $(oursrc) | 
|---|
 | 24 | oursrcdir       = ${PWD}/../common/oursrc | 
|---|
 | 25 | patches         = ${PWD}/../common/patches | 
|---|
 | 26 | specs           = ${PWD}/specs | 
|---|
 | 27 |  | 
|---|
 | 28 | topdir          = ${PWD}/.tmp | 
|---|
 | 29 | tmp_build       = ${PWD}/.tmp/BUILD | 
|---|
 | 30 | tmp_specs       = ${PWD}/.tmp/SPECS | 
|---|
 | 31 | tmp_src         = ${PWD}/.tmp/SOURCES | 
|---|
 | 32 | out_rpms        = ${PWD}/RPMS | 
|---|
 | 33 | out_srpms       = ${PWD}/SRPMS | 
|---|
 | 34 | tree            = $(topdir) $(tmp_build) $(tmp_specs) $(tmp_src) $(out_rpms) $(out_srpms)  | 
|---|
 | 35 | out_sbin        = ${PWD}/sbin | 
|---|
 | 36 |  | 
|---|
 | 37 | dload           = ${PWD}/.dload | 
|---|
 | 38 | server_url      = "http://scripts.mit.edu/src" | 
|---|
 | 39 | server_arch     = "fedora.stable" | 
|---|
 | 40 |  | 
|---|
| [13] | 41 | rpm_args        = -E '%define _smp_mflags -j4' -E '%define _topdir $(topdir)' -E '%define _rpmdir $(out_rpms)' -E '%define _srcrpmdir $(out_srpms)' | 
|---|
 | 42 | #-E '%define kernvers %(rpm -q --whatprovides kernel | sort | tail -1)' | 
|---|
| [1] | 43 |  | 
|---|
 | 44 | .PHONY: minimal-clean | 
|---|
 | 45 |  | 
|---|
 | 46 | info: | 
|---|
 | 47 |         @echo "The following packages are available:"; \ | 
|---|
 | 48 |         echo "$(allsrc)"; \ | 
|---|
 | 49 |         echo "Run 'make all' to build all packages." | 
|---|
 | 50 |  | 
|---|
 | 51 | minimal-clean: | 
|---|
 | 52 |         rm -rf $(topdir) $(dload) | 
|---|
 | 53 |  | 
|---|
 | 54 | clean: minimal-clean | 
|---|
 | 55 |         rm -rf $(out_rpms) $(out_srpms) $(out_sbin) | 
|---|
 | 56 |  | 
|---|
 | 57 | mkdir-tree: | 
|---|
 | 58 |         @mkdir -p $(tree); | 
|---|
 | 59 |  | 
|---|
 | 60 | download: | 
|---|
 | 61 |         -@wget -O- -nv $(server_url)/$(server_arch) | wget -i- -nv -nc -B $(server_url)/ -nd -nH -P $(dload); | 
|---|
 | 62 |  | 
|---|
 | 63 | copy-patches: mkdir-tree | 
|---|
 | 64 |         cp ${patches}/*.patch $(tmp_src) | 
|---|
 | 65 |  | 
|---|
 | 66 | install-srpms: mkdir-tree download | 
|---|
 | 67 |         rpm $(rpm_args) -i $(dload)/*.src.rpm 2>/dev/null; | 
|---|
 | 68 |  | 
|---|
 | 69 | copy-specs: mkdir-tree | 
|---|
 | 70 |         cp ${specs}/*.spec $(tmp_specs) | 
|---|
 | 71 |  | 
|---|
 | 72 | patch-specs: install-srpms | 
|---|
 | 73 |         @cd ${tmp_specs}; \ | 
|---|
 | 74 |         list=`ls ${specs}/*.spec.patch`; \ | 
|---|
 | 75 |         for i in $$list; do \ | 
|---|
 | 76 |                 patch < $$i; \ | 
|---|
 | 77 |         done; | 
|---|
 | 78 |  | 
|---|
 | 79 | # 1. use the package's Makefile to delete leftover files and run autoconf | 
|---|
 | 80 | # 2. create a tarball (we want it to contain the autoconf output) | 
|---|
 | 81 | create-tarballs: mkdir-tree | 
|---|
 | 82 |         @cd ${oursrcdir}; \ | 
|---|
 | 83 |         list=`find -mindepth 1 -maxdepth 1 -type d`; \ | 
|---|
 | 84 |         for i in $$list; do \ | 
|---|
 | 85 |                 pushd $$i; \ | 
|---|
 | 86 |                 autoconf; \ | 
|---|
 | 87 |                 ./configure; \ | 
|---|
 | 88 |                 make ready; \ | 
|---|
 | 89 |                 popd; \ | 
|---|
 | 90 |                 tar -czf $(tmp_src)/$$i.tar.gz $$i; \ | 
|---|
 | 91 |         done; | 
|---|
 | 92 |  | 
|---|
 | 93 | setup: install-srpms copy-patches copy-specs patch-specs create-tarballs | 
|---|
 | 94 |  | 
|---|
 | 95 | # Do not work: | 
|---|
 | 96 | #rpms: setup | 
|---|
 | 97 | #       rpmbuild $(rpm_args) -bb ${tmp_specs}/$(allsrc); | 
|---|
 | 98 | # | 
|---|
 | 99 | #srpms: setup | 
|---|
 | 100 | #       rpmbuild $(rpm_args) -bs ${tmp_specs}/$(allsrc); | 
|---|
 | 101 |  | 
|---|
 | 102 | oursrc: | 
|---|
 | 103 |         make $(oursrc) | 
|---|
 | 104 |  | 
|---|
 | 105 | upstream: | 
|---|
 | 106 |         make $(upstream) | 
|---|
 | 107 |  | 
|---|
 | 108 | all: | 
|---|
 | 109 |         make $(allsrc) | 
|---|
 | 110 |  | 
|---|
 | 111 | $(allsrc): setup | 
|---|
| [11] | 112 |         PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" \ | 
|---|
| [1] | 113 |         rpmbuild $(rpm_args) -ba ${tmp_specs}/$@*.spec | 
|---|
 | 114 |  | 
|---|
| [6] | 115 | suexec: install-srpms | 
|---|
| [1] | 116 |         @rm -rf ${tmp_src}/httpd-2*/; \ | 
|---|
 | 117 |         tar zxvf ${tmp_src}/httpd-2*.tar.gz; \ | 
|---|
| [8] | 118 |         cd httpd-2*; \ | 
|---|
| [1] | 119 |         patch -p1 < ${patches}/httpd-suexec-scripts.patch; \ | 
|---|
 | 120 |         ./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] | 121 |         pushd support; \ | 
|---|
| [1] | 122 |         make suexec && mkdir ${out_sbin} && cp suexec ${out_sbin}; \ | 
|---|
| [8] | 123 |         popd; \ | 
|---|
 | 124 |         rm -rf httpd-2*; \ | 
|---|
| [1] | 125 |         echo; \ | 
|---|
 | 126 |         echo "suexec binary written to ${out_sbin}."; \ | 
|---|
 | 127 |         echo "Run 'make install-suexec' as root to install it."; | 
|---|
 | 128 |  | 
|---|
 | 129 | install-suexec: | 
|---|
 | 130 |         install -m 4510 -o 0 -g apache ${PWD}/sbin/suexec /usr/sbin/; | 
|---|