michael@428: ## michael@428: ## Makefile -- OpenPKG Framework Developer Procedures michael@428: ## Copyright (c) 2000-2012 OpenPKG GmbH michael@428: ## michael@428: ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208. michael@428: ## All rights reserved. Licenses which grant limited permission to use, michael@428: ## copy, modify and distribute this software are available from the michael@428: ## OpenPKG GmbH. michael@428: ## michael@428: ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED michael@428: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@428: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@428: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@428: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@428: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@428: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@428: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@428: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@428: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@428: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@428: ## SUCH DAMAGE. michael@428: ## michael@428: michael@428: PATH = /usr/opkg/bin:/usr/opkg/sbin:/bin:/sbin:/usr/bin:/usr/sbin michael@428: PREFIX = /openpkg michael@428: USER = openpkg michael@428: GROUP = openpkg michael@428: TAG = openpkg michael@428: michael@428: SH = /bin/sh michael@428: RPM = $(PREFIX)/bin/openpkg rpm michael@428: SUDO = sudo michael@428: SCP = scp michael@428: RSYNC = rsync michael@428: RSYNC_REM = /v/openpkg/sw/bin/rsync michael@428: MTN = mtn michael@428: michael@428: UPLOAD1 = openpkg@experimental.openpkg.org:/v/openpkg/download/data/framework/release/source/ michael@428: UPLOAD2 = openpkg@experimental.openpkg.org:/v/openpkg/download/data/components/cache/openpkg/ michael@428: michael@428: all: michael@428: @echo "Individual Steps:" michael@428: @echo " $(MAKE) fetch-sh fetch third-party distribution files (standalone)" michael@428: @echo " $(MAKE) fetch-rpm fetch third-party distribution files (requires $(PREFIX))" michael@428: @echo " $(MAKE) build-src-sh build SOURCE SHELL package (standalone)" michael@428: @echo " $(MAKE) build-bin-sh build BINARY SHELL package (standalone)" michael@428: @echo " $(MAKE) build-src-rpm build SOURCE RPM package (requires $(PREFIX))" michael@428: @echo " $(MAKE) build-bin-rpm build BINARY RPM package (requires $(PREFIX))" michael@428: @echo " $(MAKE) install-bin-sh install BINARY SHELL package (requires $(PREFIX))" michael@428: @echo " $(MAKE) install-bin-rpm install BINARY RPM package (requires $(PREFIX))" michael@428: @echo " $(MAKE) uninstall uninstall entire instance under $(PREFIX)" michael@428: @echo " $(MAKE) upload-dst upload latest DISTRIBUTION files" michael@428: @echo " $(MAKE) upload-pkg upload latest SOURCE SHELL+RPM packages" michael@428: @echo " $(MAKE) upload-src upload latest SOURCE repository revisions" michael@428: @echo " $(MAKE) clean remove temporary files" michael@428: @echo "" michael@428: @echo "All-In-One Steps:" michael@428: @echo " $(MAKE) bootstrap BOOTSTRAP instance under $(PREFIX) from scratch" michael@428: @echo " $(MAKE) update UPDATE instance under $(PREFIX)" michael@428: @echo " $(MAKE) upload upload all results" michael@428: michael@428: ## michael@428: ## Individual Steps michael@428: ## michael@428: michael@428: fetch-sh: michael@428: @echo "++ fetching third-party distribution files (manually)"; \ michael@428: eval `egrep '^%define *V_.*' openpkg.spec | \ michael@428: sed -e 's%^.*\(V_[a-z][a-zA-Z0-9_]*\) *\([^ ][^ ]*\).*$$%\1="\2";%'`; \ michael@428: for url in \ michael@428: `egrep '^Source[0-9][0-9]*: *(http|ftp)://' openpkg.spec | \ michael@428: sed -e 's;^Source[0-9][0-9]*: *;;' -e 's;%{\(V_[a-z][a-zA-Z0-9_]*\)};$${\1};g'`; do \ michael@428: eval "url=\"$$url\""; \ michael@428: file=`echo "$$url" | sed -e 's;^.*/\([^/]*\)$$;../dst/\1;'`; \ michael@428: if [ ! -f $$file ]; then \ michael@428: echo "-- downloading $$url"; \ michael@428: if [ ".`(which curl) 2>/dev/null | egrep '^/'`" != . ]; then \ michael@428: curl -s -L -o "$$file" "$$url" || true; \ michael@428: elif [ ".`(which wget) 2>/dev/null | egrep '^/'`" != . ]; then \ michael@428: wget -q -O "$$file" "$$url" || true; \ michael@428: elif [ ".`(which fetch) 2>/dev/null | egrep '^/'`" != . ]; then \ michael@428: fetch -o "$$file" "$$url" || true; \ michael@428: elif [ ".`(which lwp-download) 2>/dev/null | egrep '^/'`" != . ]; then \ michael@428: lwp-download "$$url" "$$file" || true; \ michael@428: else \ michael@428: echo "ERROR: sorry, no download tool found in \$$PATH (\"curl\", \"wget\", \"fetch\", \"lwp-download\")" 1>&2; \ michael@428: exit 1; \ michael@428: fi; \ michael@428: if [ ! -f "$$file" ]; then \ michael@428: echo "ERROR: failed to download \"$$url\"" 1>&2; \ michael@428: exit 1; \ michael@428: fi; \ michael@428: fi; \ michael@428: done michael@428: michael@428: fetch-rpm: michael@428: @echo "++ fetching third-party distribution files (via RPM)"; \ michael@428: PATH="$(PATH)" $(RPM) -bf *.spec michael@428: michael@428: build-src-sh: michael@428: @echo "++ building SOURCE SHELL package"; \ michael@428: PATH="$(PATH)" $(SH) openpkg.boot -s michael@428: michael@428: build-bin-sh: michael@428: @echo "++ building BINARY SHELL package"; \ michael@428: cd ../pkg && TMPDIR="`cd ../tmp && pwd`" && export TMPDIR && \ michael@428: PATH="$(PATH)" $(SH) openpkg-*-`date '+%Y%m%d'`.src.sh \ michael@428: --prefix=$(PREFIX) \ michael@428: --user=$(USER) \ michael@428: --group=$(GROUP) \ michael@428: --tag=$(TAG) michael@428: michael@428: build-src-rpm: michael@428: @echo "++ building SOURCE RPM package"; \ michael@428: PATH="$(PATH)" $(RPM) -bs openpkg.spec michael@428: michael@428: build-bin-rpm: michael@428: @echo "++ building BINARY RPM package"; \ michael@428: PATH="$(PATH)" $(RPM) -bb openpkg.spec michael@428: michael@428: install-bin-sh: michael@428: @echo "++ installing BINARY SHELL package"; \ michael@428: d=`cd ../pkg && pwd` && cd / && PATH="$(PATH)" $(SUDO) $(SH) $$d/openpkg-*-`date '+%Y%m%d'`.*-*-*.sh michael@428: michael@428: install-bin-rpm: michael@428: @echo "++ installing BINARY RPM package"; \ michael@428: d=`cd ../pkg && pwd` && cd / && PATH="$(PATH)" $(SUDO) $(RPM) -Uvh --replacepkgs $$d/openpkg-*-`date '+%Y%m%d'`.*-*-*.rpm michael@428: michael@428: uninstall: michael@428: -@echo "++ uninstalling ENTIRE instance"; \ michael@428: cd /; $(RPM) -qa | grep -v '^openpkg-[0-9]' | xargs $(SUDO) $(RPM) -e; \ michael@428: $(SUDO) $(RPM) -e openpkg michael@428: michael@428: upload-dst: michael@428: @echo "++ uploading vendor DISTRIBUTION files:"; \ michael@428: $(RSYNC) -raH --delete -v --progress --rsync-path=$(RSYNC_REM) ../dst/ $(UPLOAD2) michael@428: michael@428: upload-pkg: michael@428: @echo "++ uploading SOURCE SHELL/RPM package(s):"; \ michael@428: $(RSYNC) -raH --delete -v --progress --rsync-path=$(RSYNC_REM) ../pkg/*.src.* $(UPLOAD1) michael@428: michael@428: upload-src: michael@428: @echo "++ uploading SOURCE repository revision(s):"; \ michael@428: $(MTN) sync michael@428: michael@428: clean: michael@428: -rm -rf ../tmp/* michael@428: michael@428: pod2man: michael@428: pod2man --section=1 --center="OpenPKG" --release="OPENPKG(8)" --date="OpenPKG" --quotes=none openpkg.pod >openpkg.1 michael@428: pod2man --section=8 --center="OpenPKG" --release="RC(8)" --date="OpenPKG" --quotes=none rc.pod >rc.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="RPMTOOL(8)" --date="OpenPKG" --quotes=none rpmtool.pod >rpmtool.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="LSYNC(8)" --date="OpenPKG" --quotes=none lsync.pod >lsync.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="RPM-CONFIG(8)" --date="OpenPKG" --quotes=none rpm-config.pod >rpm-config.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="UUID(8)" --date="OpenPKG" --quotes=none uuid.pod >uuid.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="RELEASE(8)" --date="OpenPKG" --quotes=none release.pod >release.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="BUILD(8)" --date="OpenPKG" --quotes=none build.pod >build.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="INDEX(8)" --date="OpenPKG" --quotes=none index.pod >index.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="SEARCH(8)" --date="OpenPKG" --quotes=none search.pod >search.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="MIRROR(8)" --date="OpenPKG" --quotes=none mirror.pod >mirror.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="MAKEPROXY(8)" --date="OpenPKG" --quotes=none makeproxy.pod >makeproxy.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="REGISTER(8)" --date="OpenPKG" --quotes=none register.pod >register.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="LICENSE(8)" --date="OpenPKG" --quotes=none license.pod >license.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="DEV(8)" --date="OpenPKG" --quotes=none dev.pod >dev.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="SEA(8)" --date="OpenPKG" --quotes=none sea.pod >sea.8 michael@428: pod2man --section=8 --center="OpenPKG" --release="STACK(8)" --date="OpenPKG" --quotes=none stack.pod >stack.8 michael@428: michael@428: ## michael@428: ## All-In-One Steps michael@428: ## michael@428: michael@428: bootstrap: build-src-sh build-bin-sh install-bin-sh michael@428: michael@428: update: build-bin-rpm install-bin-rpm michael@428: michael@428: upload: build-src-sh build-src-rpm upload-pkg upload-src michael@428: