Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
1 ##
2 ## Makefile -- OpenPKG Framework Developer Procedures
3 ## Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
4 ##
5 ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
6 ## All rights reserved. Licenses which grant limited permission to use,
7 ## copy, modify and distribute this software are available from the
8 ## OpenPKG GmbH.
9 ##
10 ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 PATH = /usr/opkg/bin:/usr/opkg/sbin:/bin:/sbin:/usr/bin:/usr/sbin
25 PREFIX = /openpkg
26 USER = openpkg
27 GROUP = openpkg
28 TAG = openpkg
30 SH = /bin/sh
31 RPM = $(PREFIX)/bin/openpkg rpm
32 SUDO = sudo
33 SCP = scp
34 RSYNC = rsync
35 RSYNC_REM = /v/openpkg/sw/bin/rsync
36 MTN = mtn
38 UPLOAD1 = openpkg@experimental.openpkg.org:/v/openpkg/download/data/framework/release/source/
39 UPLOAD2 = openpkg@experimental.openpkg.org:/v/openpkg/download/data/components/cache/openpkg/
41 all:
42 @echo "Individual Steps:"
43 @echo " $(MAKE) fetch-sh fetch third-party distribution files (standalone)"
44 @echo " $(MAKE) fetch-rpm fetch third-party distribution files (requires $(PREFIX))"
45 @echo " $(MAKE) build-src-sh build SOURCE SHELL package (standalone)"
46 @echo " $(MAKE) build-bin-sh build BINARY SHELL package (standalone)"
47 @echo " $(MAKE) build-src-rpm build SOURCE RPM package (requires $(PREFIX))"
48 @echo " $(MAKE) build-bin-rpm build BINARY RPM package (requires $(PREFIX))"
49 @echo " $(MAKE) install-bin-sh install BINARY SHELL package (requires $(PREFIX))"
50 @echo " $(MAKE) install-bin-rpm install BINARY RPM package (requires $(PREFIX))"
51 @echo " $(MAKE) uninstall uninstall entire instance under $(PREFIX)"
52 @echo " $(MAKE) upload-dst upload latest DISTRIBUTION files"
53 @echo " $(MAKE) upload-pkg upload latest SOURCE SHELL+RPM packages"
54 @echo " $(MAKE) upload-src upload latest SOURCE repository revisions"
55 @echo " $(MAKE) clean remove temporary files"
56 @echo ""
57 @echo "All-In-One Steps:"
58 @echo " $(MAKE) bootstrap BOOTSTRAP instance under $(PREFIX) from scratch"
59 @echo " $(MAKE) update UPDATE instance under $(PREFIX)"
60 @echo " $(MAKE) upload upload all results"
62 ##
63 ## Individual Steps
64 ##
66 fetch-sh:
67 @echo "++ fetching third-party distribution files (manually)"; \
68 eval `egrep '^%define *V_.*' openpkg.spec | \
69 sed -e 's%^.*\(V_[a-z][a-zA-Z0-9_]*\) *\([^ ][^ ]*\).*$$%\1="\2";%'`; \
70 for url in \
71 `egrep '^Source[0-9][0-9]*: *(http|ftp)://' openpkg.spec | \
72 sed -e 's;^Source[0-9][0-9]*: *;;' -e 's;%{\(V_[a-z][a-zA-Z0-9_]*\)};$${\1};g'`; do \
73 eval "url=\"$$url\""; \
74 file=`echo "$$url" | sed -e 's;^.*/\([^/]*\)$$;../dst/\1;'`; \
75 if [ ! -f $$file ]; then \
76 echo "-- downloading $$url"; \
77 if [ ".`(which curl) 2>/dev/null | egrep '^/'`" != . ]; then \
78 curl -s -L -o "$$file" "$$url" || true; \
79 elif [ ".`(which wget) 2>/dev/null | egrep '^/'`" != . ]; then \
80 wget -q -O "$$file" "$$url" || true; \
81 elif [ ".`(which fetch) 2>/dev/null | egrep '^/'`" != . ]; then \
82 fetch -o "$$file" "$$url" || true; \
83 elif [ ".`(which lwp-download) 2>/dev/null | egrep '^/'`" != . ]; then \
84 lwp-download "$$url" "$$file" || true; \
85 else \
86 echo "ERROR: sorry, no download tool found in \$$PATH (\"curl\", \"wget\", \"fetch\", \"lwp-download\")" 1>&2; \
87 exit 1; \
88 fi; \
89 if [ ! -f "$$file" ]; then \
90 echo "ERROR: failed to download \"$$url\"" 1>&2; \
91 exit 1; \
92 fi; \
93 fi; \
94 done
96 fetch-rpm:
97 @echo "++ fetching third-party distribution files (via RPM)"; \
98 PATH="$(PATH)" $(RPM) -bf *.spec
100 build-src-sh:
101 @echo "++ building SOURCE SHELL package"; \
102 PATH="$(PATH)" $(SH) openpkg.boot -s
104 build-bin-sh:
105 @echo "++ building BINARY SHELL package"; \
106 cd ../pkg && TMPDIR="`cd ../tmp && pwd`" && export TMPDIR && \
107 PATH="$(PATH)" $(SH) openpkg-*-`date '+%Y%m%d'`.src.sh \
108 --prefix=$(PREFIX) \
109 --user=$(USER) \
110 --group=$(GROUP) \
111 --tag=$(TAG)
113 build-src-rpm:
114 @echo "++ building SOURCE RPM package"; \
115 PATH="$(PATH)" $(RPM) -bs openpkg.spec
117 build-bin-rpm:
118 @echo "++ building BINARY RPM package"; \
119 PATH="$(PATH)" $(RPM) -bb openpkg.spec
121 install-bin-sh:
122 @echo "++ installing BINARY SHELL package"; \
123 d=`cd ../pkg && pwd` && cd / && PATH="$(PATH)" $(SUDO) $(SH) $$d/openpkg-*-`date '+%Y%m%d'`.*-*-*.sh
125 install-bin-rpm:
126 @echo "++ installing BINARY RPM package"; \
127 d=`cd ../pkg && pwd` && cd / && PATH="$(PATH)" $(SUDO) $(RPM) -Uvh --replacepkgs $$d/openpkg-*-`date '+%Y%m%d'`.*-*-*.rpm
129 uninstall:
130 -@echo "++ uninstalling ENTIRE instance"; \
131 cd /; $(RPM) -qa | grep -v '^openpkg-[0-9]' | xargs $(SUDO) $(RPM) -e; \
132 $(SUDO) $(RPM) -e openpkg
134 upload-dst:
135 @echo "++ uploading vendor DISTRIBUTION files:"; \
136 $(RSYNC) -raH --delete -v --progress --rsync-path=$(RSYNC_REM) ../dst/ $(UPLOAD2)
138 upload-pkg:
139 @echo "++ uploading SOURCE SHELL/RPM package(s):"; \
140 $(RSYNC) -raH --delete -v --progress --rsync-path=$(RSYNC_REM) ../pkg/*.src.* $(UPLOAD1)
142 upload-src:
143 @echo "++ uploading SOURCE repository revision(s):"; \
144 $(MTN) sync
146 clean:
147 -rm -rf ../tmp/*
149 pod2man:
150 pod2man --section=1 --center="OpenPKG" --release="OPENPKG(8)" --date="OpenPKG" --quotes=none openpkg.pod >openpkg.1
151 pod2man --section=8 --center="OpenPKG" --release="RC(8)" --date="OpenPKG" --quotes=none rc.pod >rc.8
152 pod2man --section=8 --center="OpenPKG" --release="RPMTOOL(8)" --date="OpenPKG" --quotes=none rpmtool.pod >rpmtool.8
153 pod2man --section=8 --center="OpenPKG" --release="LSYNC(8)" --date="OpenPKG" --quotes=none lsync.pod >lsync.8
154 pod2man --section=8 --center="OpenPKG" --release="RPM-CONFIG(8)" --date="OpenPKG" --quotes=none rpm-config.pod >rpm-config.8
155 pod2man --section=8 --center="OpenPKG" --release="UUID(8)" --date="OpenPKG" --quotes=none uuid.pod >uuid.8
156 pod2man --section=8 --center="OpenPKG" --release="RELEASE(8)" --date="OpenPKG" --quotes=none release.pod >release.8
157 pod2man --section=8 --center="OpenPKG" --release="BUILD(8)" --date="OpenPKG" --quotes=none build.pod >build.8
158 pod2man --section=8 --center="OpenPKG" --release="INDEX(8)" --date="OpenPKG" --quotes=none index.pod >index.8
159 pod2man --section=8 --center="OpenPKG" --release="SEARCH(8)" --date="OpenPKG" --quotes=none search.pod >search.8
160 pod2man --section=8 --center="OpenPKG" --release="MIRROR(8)" --date="OpenPKG" --quotes=none mirror.pod >mirror.8
161 pod2man --section=8 --center="OpenPKG" --release="MAKEPROXY(8)" --date="OpenPKG" --quotes=none makeproxy.pod >makeproxy.8
162 pod2man --section=8 --center="OpenPKG" --release="REGISTER(8)" --date="OpenPKG" --quotes=none register.pod >register.8
163 pod2man --section=8 --center="OpenPKG" --release="LICENSE(8)" --date="OpenPKG" --quotes=none license.pod >license.8
164 pod2man --section=8 --center="OpenPKG" --release="DEV(8)" --date="OpenPKG" --quotes=none dev.pod >dev.8
165 pod2man --section=8 --center="OpenPKG" --release="SEA(8)" --date="OpenPKG" --quotes=none sea.pod >sea.8
166 pod2man --section=8 --center="OpenPKG" --release="STACK(8)" --date="OpenPKG" --quotes=none stack.pod >stack.8
168 ##
169 ## All-In-One Steps
170 ##
172 bootstrap: build-src-sh build-bin-sh install-bin-sh
174 update: build-bin-rpm install-bin-rpm
176 upload: build-src-sh build-src-rpm upload-pkg upload-src