openpkg/Makefile

Thu, 04 Oct 2012 20:30:05 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 04 Oct 2012 20:30:05 +0200
changeset 715
c10fb90893b9
permissions
-rw-r--r--

Correct out of date build configuration, porting to Solaris 11 network
link infrastructure and new libpcap logic. This additionally allows for
device drivers in subdirectories of /dev. Correct packaged nmap
personalities and signatures to work out of the box. Finally, hack
arpd logic to properly close sockets and quit on TERM by repeating
signaling in the run command script. Sadly, all this fails to correct
the run time behaviour of honeyd which fails to bind to the IP layer.

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

mercurial