From a5f8a219541ac82f3e5f1c3222edd569f1b6aecd Mon Sep 17 00:00:00 2001 From: Daniel Joseph Barnhart Clark Date: Sat, 21 Jul 2007 20:04:57 +0000 Subject: EncapPackages: Major updates to epkg Makefile, including proper static building of OpenSSL into the epkg binary, and the use of https URLs with server verification via the /usr/local/etc/epkg-ca-bundle.pem, proper naming of GNU/Linux platforms, and creation of a epkg-2.3.9-encap-*-*.tar.gz distribution as the last step. git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3532 ce84e21b-d406-0410-9b95-82705330c041 --- encap/epkg/Makefile | 124 +++++++++++++++++++++++++++++++++++++++++++++++++--- encap/epkg/README | 3 +- 2 files changed, 119 insertions(+), 8 deletions(-) (limited to 'encap') diff --git a/encap/epkg/Makefile b/encap/epkg/Makefile index cba4613c9..6f98fc15c 100644 --- a/encap/epkg/Makefile +++ b/encap/epkg/Makefile @@ -1,6 +1,6 @@ # $Id$ -.PHONY : all clean distclean install zlib openssl libtar curl fget expat epkg +.PHONY : log all clean distclean install pkgconfig zlib openssl libtar curl fget expat epkg .SUFFIXES : BASEDIR = /usr/local @@ -8,12 +8,15 @@ ENCAPDIR = ${BASEDIR}/encap PREFIX = /tmp/epkg-static-libs PATH = ${PREFIX}/bin:/usr/sfw/bin:/usr/ccs/bin:/usr/local/bin:/opt/csw/bin:/usr/sbin:/usr/bin:/bin CC = gcc -static-libgcc -LDFLAGS = -all-static -L${PREFIX}/lib +LDFLAGS = -L${PREFIX}/lib CPPFLAGS = -I${PREFIX}/include LD_LIBRARY_PATH = ${PREFIX}/lib LIBPATH = ${PREFIX}/lib -export PATH CC LDFLAGS CPPFLAGS LD_LIBRARY_PATH LIBPATH +PKG_CONFIG_PATH = ${PREFIX}/lib/pkgconfig +ENCAP_CONTACT = dclark@pobox.com +export PATH CC LDFLAGS CPPFLAGS LD_LIBRARY_PATH LIBPATH PKG_CONFIG_PATH ENCAP_CONTACT +PKGCONFIG = pkg-config-0.22 ZLIB = zlib-1.2.3 LIBTAR = libtar-1.2.12 OPENSSL = openssl-0.9.8e @@ -22,9 +25,98 @@ FGET = fget-1.3.3 EXPAT = expat-2.0.1 EPKG = epkg-2.3.9 +# Get Platform for GNU/Linux distributions... +UNAME := $(shell uname) + +ifeq ($(UNAME),Linux) +DISTRO := $(shell cat /etc/issue | grep ^[a-zA-Z] | head -1) +UNAMEM := $(shell uname -m) +endif + +## Get OS for GNU/Linux distributions... +ifeq ($(DISTRO),Debian GNU/Linux 3.1 \n \l) +OS = linux_debian_sarge +endif + +ifeq ($(DISTRO),Debian GNU/Linux 4.0 \n \l) +OS = linux_debian_etch +endif + +ifeq ($(DISTRO),Debian GNU/Linux testing/unstable \n \l) +OS = linux_debian_sid +endif + +ifeq ($(DISTRO),Ubuntu 6.06.1 LTS \n \l) +OS = linux_ubuntu_dapper +endif + +ifeq ($(DISTRO),Red Hat Linux release 6.0 (Hedwig)) +OS = linux_redhat_60 +endif + +ifeq ($(DISTRO),Red Hat Linux release 7.2 (Enigma)) +OS = linux_redhat_72 +endif + +ifeq ($(DISTRO),Welcome to SuSE SLES 8 (powered by UnitedLinux 1.0) (i586)) +OS = linux_suse_sles8 +endif + +ifeq ($(DISTRO),Welcome to SUSE Linux Enterprise Server 10 (i586) - Kernel \r (\l).) +OS = linux_suse_sles10 +endif + +ifeq ($(DISTRO),Welcome to SUSE Linux Enterprise Server 10 (i686) - Kernel \r (\l).) +OS = linux_suse_sles10 +endif + +ifeq ($(DISTRO),Welcome to SUSE Linux Enterprise Server 10 (x86_64) - Kernel \r (\l).) +OS = linux_suse_sles10 +endif + +ifeq ($(DISTRO),Red Hat Enterprise Linux AS release 4 (Nahant Update 5)) +OS = linux_redhat_rhel4 +endif + +ifeq ($(DISTRO),Red Hat Enterprise Linux AS release 4 (Nahant Update 4)) +OS = linux_redhat_rhel4 +endif + +## Get ARCH for GNU/Linux distributions... +ARCH = ix86 +ifeq ($(UNAMEM),x86_64) +ARCH = x86_64 +endif + +## Finally, set PLATFORM for GNU/Linux distributions... +PLATFORM = +ifeq ($(UNAME),Linux) +PLATFORM = -p ${ARCH}-${OS} +endif + +log: + ( $(MAKE) epkg.done > ./make.log 2>&1 ) & + tail -f make.log + all: epkg.done -zlib.done: +clean: + -rm *.done + -rm -rf ${PREFIX} + +distclean: clean + for D in ${PKGCONFIG} ${ZLIB} ${LIBTAR} ${OPENSSL} ${CURL} ${FGET} ${EXPAT} ${EPKG}; do (cd $$D && printf "In $$D \n" && (make clean 2>/dev/null || true) && (make distclean 2>/dev/null || true)); done + if [ -f ${CURL}/lib/ca-bundle.crt.orig ]; then mv ${CURL}/lib/ca-bundle.crt.orig ${CURL}/lib/ca-bundle.crt; fi + cd ${OPENSSL} && if [ -f config.orig ]; then mv config.orig config; fi + -rm /usr/local/etc/epkg-ca-bundle.pem + -rm /usr/local/etc/mkencap_environment + -rm epkg-*-encap-*-*.tar.gz + +pkgconfig.done: + cd ${PKGCONFIG} && ./configure --prefix=${PREFIX} && $(MAKE) && $(MAKE) install + touch pkgconfig.done + +zlib.done: pkgconfig.done cd ${ZLIB} && prefix=${PREFIX} CC=gcc ./configure && $(MAKE) && $(MAKE) install touch zlib.done @@ -34,7 +126,7 @@ openssl.done: zlib.done cd ${OPENSSL} && mv config config.orig cd ${OPENSSL} && cp config.bcfg2 config cd ${OPENSSL} && chmod 755 config - cd ${OPENSSL} && ./config --prefix="${PREFIX}" zlib no-shared no-asm -L${PREFIX}/lib -I${PREFIX}/include && $(MAKE) && $(MAKE) install + cd ${OPENSSL} && LDFLAGS="-all-static $LDFLAGS" ./config --prefix="${PREFIX}" zlib no-shared no-asm -L${PREFIX}/lib -I${PREFIX}/include && $(MAKE) && $(MAKE) install touch openssl.done libtar.done: openssl.done @@ -42,7 +134,11 @@ libtar.done: openssl.done touch libtar.done curl.done: libtar.done - cd ${CURL} && ./configure --disable-ipv6 --disable-shared --enable-static --prefix=${PREFIX} --with-ssl=${PREFIX} && $(MAKE) && $(MAKE) install + if [ -f ${CURL}/lib/ca-bundle.crt ]; then mv ${CURL}/lib/ca-bundle.crt ${CURL}/lib/ca-bundle.crt.orig; fi + cp cacert.pem ${CURL}/lib/ca-bundle.crt + cd ${CURL} && ./configure --with-ssl --disable-ipv6 --disable-shared --enable-static --prefix=${PREFIX} --sysconfdir=/usr/local/etc --with-ca-bundle=/usr/local/etc/epkg-ca-bundle.pem && $(MAKE) && $(MAKE) install + if [ -f ${CURL}/lib/ca-bundle.crt.orig ]; then mv ${CURL}/lib/ca-bundle.crt.orig ${CURL}/lib/ca-bundle.crt; fi + ${PREFIX}/bin/curl -V | xargs echo | grep zlib | grep ftp | grep http | grep libz | grep ftps | grep https touch curl.done fget.done: curl.done @@ -55,5 +151,19 @@ expat.done: fget.done epkg.done: expat.done test -d $(ENCAPDIR)/$(EPKG) && rm -rf $(ENCAPDIR)/$(EPKG) || true - cd ${EPKG} && ./configure && $(MAKE) && $(MAKE) install + -rm /usr/local/etc/epkg-ca-bundle.pem + -rm /usr/local/etc/mkencap_environment + -rm epkg-*-encap-*-*.tar.gz + cd ${EPKG} && ./configure && $(MAKE) && (rm -rf /usr/local/encap/epkg-2* 2>/dev/null || true) && $(MAKE) install + cp cacert.pem /usr/local/encap/${EPKG}/epkg-ca-bundle.pem + printf 'if [ ! -f "$${ENCAP_TARGET}/etc/epkg-ca-bundle.pem" ]; then\n\techo "installing: $${ENCAP_TARGET}/etc/epkg-ca-bundle.pem";\n\tcp "$${ENCAP_SOURCE}/$${ENCAP_PKGNAME}/epkg-ca-bundle.pem" "$${ENCAP_TARGET}/etc/epkg-ca-bundle.pem";\nfi\n' >> $(ENCAPDIR)/$(EPKG)/postinstall + $(ENCAPDIR)/$(EPKG)/bin/mkencap $(PLATFORM) -ef $(EPKG) + $(ENCAPDIR)/$(EPKG)/bin/mkencap $(PLATFORM) -c $(EPKG) + $(ENCAPDIR)/$(EPKG)/bin/epkg -f -r epkg + -rm /usr/local/etc/epkg-ca-bundle.pem + -rm /usr/local/etc/mkencap_environment + $(ENCAPDIR)/$(EPKG)/bin/epkg -f -i epkg + $(ENCAPDIR)/$(EPKG)/bin/epkg -c + test -f /usr/local/etc/epkg-ca-bundle.pem + test -f /usr/local/etc/mkencap_environment touch epkg.done diff --git a/encap/epkg/README b/encap/epkg/README index 7fb3bd856..ce986d3c0 100644 --- a/encap/epkg/README +++ b/encap/epkg/README @@ -6,7 +6,8 @@ Solaris/x86 10) to compile it. You'll need to manually download the versions of packages you want to this directory, edit the Makefile to refer to those versions, decompress/untar the distributions, and then run make (or gmake on -non-GNU platforms) +non-GNU platforms). The cacert.pem file that needs to be in this +directory is available from http://curl.haxx.se/docs/caextract.html All of the software is available from: * http://mirror.opensysadmin.com/epkg-deps/epkg-with-all-deps.tar.gz -- cgit v1.2.3-1-g7c22