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 = ${HOME}/rpmbuild |
---|
30 | tmp_build = $(topdir)/BUILD |
---|
31 | tmp_specs = $(topdir)/SPECS |
---|
32 | tmp_src = $(topdir)/SOURCES |
---|
33 | out_rpms = $(topdir)/RPMS |
---|
34 | out_srpms = $(topdir)/SRPMS |
---|
35 | out_sbin = $(topdir)/sbin |
---|
36 | |
---|
37 | dload = ${PWD}/.dload |
---|
38 | server_url = "http://web.mit.edu/scripts/src" |
---|
39 | server_arch = "fedora.stable" |
---|
40 | |
---|
41 | openafs_rpm_args = -E "%define kernvers $(shell rpm -q --qf "%{Version}-%{Release}\n" --whatprovides kernel | sort -n | tail -n1)" |
---|
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 | @rpmdev-setuptree; \ |
---|
58 | mkdir -p $(out_sbin); \ |
---|
59 | ln -s $(topdir) rpmbuild; |
---|
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 -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 $(openafs_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 | mkdir -p ${out_sbin}; make suexec && 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 | frob-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 | |
---|
151 | # The following packages are needed for our packages |
---|
152 | # basic deps: kernel-devel through krb5-workstation |
---|
153 | # oursrc: hesinfo |
---|
154 | # httpdmods: httpd-devel |
---|
155 | # httpd: xmlto through distcache-devel |
---|
156 | # krb5: bison through texinfo keyutils-libs-devel |
---|
157 | # openafs: pam-devel through automake |
---|
158 | # mit-zephyr: readline-devel hesiod.i386 libXt.i386 compat-readline43 |
---|
159 | install-deps: |
---|
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 |
---|
161 | rpm -ivh http://download.fedora.redhat.com/pub/fedora/linux/core/6/i386/os/Fedora/RPMS/compat-readline43-4.3-3.i386.rpm |
---|