| 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 mit-zephyr | 
|---|
| 22 | oursrc          = execsys tokensys accountadm httpdmods logview sql-signup | 
|---|
| 23 | allsrc          = $(upstream) $(oursrc) | 
|---|
| 24 | oursrcdir       = ${PWD}/../common/oursrc | 
|---|
| 25 | patches         = ${PWD}/../common/patches | 
|---|
| 26 | metapatches     = ${PWD}/meta-patches | 
|---|
| 27 | specs           = ${PWD}/specs | 
|---|
| 28 |  | 
|---|
| 29 | topdir          = ${PWD}/.tmp | 
|---|
| 30 | tmp_build       = ${PWD}/.tmp/BUILD | 
|---|
| 31 | tmp_specs       = ${PWD}/.tmp/SPECS | 
|---|
| 32 | tmp_src         = ${PWD}/.tmp/SOURCES | 
|---|
| 33 | out_rpms        = ${PWD}/RPMS | 
|---|
| 34 | out_srpms       = ${PWD}/SRPMS | 
|---|
| 35 | tree            = $(topdir) $(tmp_build) $(tmp_specs) $(tmp_src) $(out_rpms) $(out_srpms)  | 
|---|
| 36 | out_sbin        = ${PWD}/sbin | 
|---|
| 37 |  | 
|---|
| 38 | dload           = ${PWD}/.dload | 
|---|
| 39 | server_url      = "http://scripts.mit.edu/src" | 
|---|
| 40 | server_arch     = "fedora.stable" | 
|---|
| 41 |  | 
|---|
| 42 | rpm_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 |  | 
|---|
| 47 | info: | 
|---|
| 48 |         @echo "The following packages are available:"; \ | 
|---|
| 49 |         echo "$(allsrc)"; \ | 
|---|
| 50 |         echo "Run 'make all' to build all packages." | 
|---|
| 51 |  | 
|---|
| 52 | minimal-clean: | 
|---|
| 53 |         rm -rf $(topdir) $(dload) | 
|---|
| 54 |  | 
|---|
| 55 | clean: minimal-clean | 
|---|
| 56 |         rm -rf $(out_rpms) $(out_srpms) $(out_sbin) | 
|---|
| 57 |  | 
|---|
| 58 | mkdir-tree: | 
|---|
| 59 |         @mkdir -p $(tree); | 
|---|
| 60 |  | 
|---|
| 61 | download: | 
|---|
| 62 |         -@wget -O- -nv $(server_url)/$(server_arch) | wget -i- -nv -N -B $(server_url)/ -nd -nH -P $(dload); | 
|---|
| 63 |  | 
|---|
| 64 | copy-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 |  | 
|---|
| 72 | install-srpms: mkdir-tree download | 
|---|
| 73 |         rpm $(rpm_args) -i $(dload)/*.src.rpm 2>/dev/null; | 
|---|
| 74 |  | 
|---|
| 75 | copy-specs: mkdir-tree | 
|---|
| 76 |         cp ${specs}/*.spec $(tmp_specs) | 
|---|
| 77 |  | 
|---|
| 78 | patch-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) | 
|---|
| 87 | create-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 |  | 
|---|
| 100 | setup: 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 |  | 
|---|
| 109 | oursrc: | 
|---|
| 110 |         make $(oursrc) | 
|---|
| 111 |  | 
|---|
| 112 | upstream: | 
|---|
| 113 |         make $(upstream) | 
|---|
| 114 |  | 
|---|
| 115 | all: | 
|---|
| 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 |  | 
|---|
| 122 | openafs-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 |  | 
|---|
| 126 | suexec: 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 |  | 
|---|
| 140 | install-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 | 
|---|
| 151 | install-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 | 
|---|