| 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 |  | 
|---|
| 41 | rpm_args        = -E '%define _smp_mflags -j4' -E '%define _topdir $(topdir)' -E '%define _rpmdir $(out_rpms)' -E '%define _srcrpmdir $(out_srpms)'  | 
|---|
| 42 |  | 
|---|
| 43 | .PHONY: minimal-clean | 
|---|
| 44 |  | 
|---|
| 45 | info: | 
|---|
| 46 |         @echo "The following packages are available:"; \ | 
|---|
| 47 |         echo "$(allsrc)"; \ | 
|---|
| 48 |         echo "Run 'make all' to build all packages." | 
|---|
| 49 |  | 
|---|
| 50 | minimal-clean: | 
|---|
| 51 |         rm -rf $(topdir) $(dload) | 
|---|
| 52 |  | 
|---|
| 53 | clean: minimal-clean | 
|---|
| 54 |         rm -rf $(out_rpms) $(out_srpms) $(out_sbin) | 
|---|
| 55 |  | 
|---|
| 56 | mkdir-tree: | 
|---|
| 57 |         @mkdir -p $(tree); | 
|---|
| 58 |  | 
|---|
| 59 | download: | 
|---|
| 60 |         -@wget -O- -nv $(server_url)/$(server_arch) | wget -i- -nv -nc -B $(server_url)/ -nd -nH -P $(dload); | 
|---|
| 61 |  | 
|---|
| 62 | copy-patches: mkdir-tree | 
|---|
| 63 |         cp ${patches}/*.patch $(tmp_src) | 
|---|
| 64 |  | 
|---|
| 65 | install-srpms: mkdir-tree download | 
|---|
| 66 |         rpm $(rpm_args) -i $(dload)/*.src.rpm 2>/dev/null; | 
|---|
| 67 |  | 
|---|
| 68 | copy-specs: mkdir-tree | 
|---|
| 69 |         cp ${specs}/*.spec $(tmp_specs) | 
|---|
| 70 |  | 
|---|
| 71 | patch-specs: install-srpms | 
|---|
| 72 |         @cd ${tmp_specs}; \ | 
|---|
| 73 |         list=`ls ${specs}/*.spec.patch`; \ | 
|---|
| 74 |         for i in $$list; do \ | 
|---|
| 75 |                 patch < $$i; \ | 
|---|
| 76 |         done; | 
|---|
| 77 |  | 
|---|
| 78 | # 1. use the package's Makefile to delete leftover files and run autoconf | 
|---|
| 79 | # 2. create a tarball (we want it to contain the autoconf output) | 
|---|
| 80 | # 3. use the package's Makefile to delete leftover files | 
|---|
| 81 |  | 
|---|
| 82 | create-tarballs: mkdir-tree | 
|---|
| 83 |         @cd ${oursrcdir}; \ | 
|---|
| 84 |         list=`find -mindepth 1 -maxdepth 1 -type d`; \ | 
|---|
| 85 |         for i in $$list; do \ | 
|---|
| 86 |                 pushd $$i; \ | 
|---|
| 87 |                 autoconf; \ | 
|---|
| 88 |                 ./configure; \ | 
|---|
| 89 |                 make ready; \ | 
|---|
| 90 |                 popd; \ | 
|---|
| 91 |                 tar -czf $(tmp_src)/$$i.tar.gz $$i; \ | 
|---|
| 92 |                 pushd $$i; \ | 
|---|
| 93 |                 autoconf; \ | 
|---|
| 94 |                 ./configure; \ | 
|---|
| 95 |                 make preauto; \ | 
|---|
| 96 |                 popd; \ | 
|---|
| 97 |         done; | 
|---|
| 98 |  | 
|---|
| 99 | setup: install-srpms copy-patches copy-specs patch-specs create-tarballs | 
|---|
| 100 |  | 
|---|
| 101 | # Do not work: | 
|---|
| 102 | #rpms: setup | 
|---|
| 103 | #       rpmbuild $(rpm_args) -bb ${tmp_specs}/$(allsrc); | 
|---|
| 104 | # | 
|---|
| 105 | #srpms: setup | 
|---|
| 106 | #       rpmbuild $(rpm_args) -bs ${tmp_specs}/$(allsrc); | 
|---|
| 107 |  | 
|---|
| 108 | oursrc: | 
|---|
| 109 |         make $(oursrc) | 
|---|
| 110 |  | 
|---|
| 111 | upstream: | 
|---|
| 112 |         make $(upstream) | 
|---|
| 113 |  | 
|---|
| 114 | all: | 
|---|
| 115 |         make $(allsrc) | 
|---|
| 116 |  | 
|---|
| 117 | $(allsrc): setup | 
|---|
| 118 |         rpmbuild $(rpm_args) -ba ${tmp_specs}/$@*.spec | 
|---|
| 119 |  | 
|---|
| 120 | suexec: setup | 
|---|
| 121 |         @rm -rf ${tmp_src}/httpd-2*/; \ | 
|---|
| 122 |         tar zxvf ${tmp_src}/httpd-2*.tar.gz; \ | 
|---|
| 123 |         cd ./httpd-2*; \ | 
|---|
| 124 |         patch -p1 < ${patches}/httpd-suexec-scripts.patch; \ | 
|---|
| 125 |         ./configure --prefix=/etc/httpd --with-suexec-userdir=web_scripts --with-suexec-caller=apache --with-suexec-uidmin=50 --with-suexec-gidmin=50 --with-suexec-docroot=/; \ | 
|---|
| 126 |         cd support; \ | 
|---|
| 127 |         make suexec && mkdir ${out_sbin} && cp suexec ${out_sbin}; \ | 
|---|
| 128 |         echo; \ | 
|---|
| 129 |         echo "suexec binary written to ${out_sbin}."; \ | 
|---|
| 130 |         echo "Run 'make install-suexec' as root to install it."; | 
|---|
| 131 |  | 
|---|
| 132 | install-suexec: | 
|---|
| 133 |         install -m 4510 -o 0 -g apache ${PWD}/sbin/suexec /usr/sbin/; | 
|---|