1# 2# Copyright (C) 2000-2015 Kern Sibbald 3# License: BSD 2-Clause; see file LICENSE-FOSS 4# 5# This is the makefile template for the platform directory 6# which contains general platform installation. 7# 8# 17 August 2009 -- Lorenz Schori 9# 10# for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ 11# 12 13 14# bacula version and download site 15BACULA_VERSION:=@VERSION@ 16BACULA_DL_URL:=http://downloads.sourceforge.net/project/bacula/bacula/${BACULA_VERSION}/bacula-${BACULA_VERSION}.tar.gz 17 18# Build universal binary. Comment out when building versions of bacula < 3.0.0 19ARCHFLAGS:= 20MACOSX_SDK_SYSROOT:= 21MACOSX_VERSION_FLAGS:= 22 23# Tools 24PB:=/usr/bin/pkgbuild 25MAKE:=/usr/bin/make 26CURL:=/usr/bin/curl 27TAR:=/usr/bin/tar 28 29########### you should not have to edit anything beyond this line ########### 30 31# Build paths 32DL_DIR:=dl 33BUILD_DIR:=build 34PRODUCTS_DIR:=products 35 36WORKING_DIR:=${BUILD_DIR}/${BACULA_VERSION} 37BACULA_TAR:=${DL_DIR}/bacula-${BACULA_VERSION}.tar.gz 38BACULA_SOURCE:=${WORKING_DIR}/bacula-${BACULA_VERSION} 39BACULA_DESTDIR:=${WORKING_DIR}/destdir 40BACULA_PREFIX:=/usr/local/bacula-${BACULA_VERSION} 41BACULA_FD_CONF:=/Library/Preferences/bacula/bacula-fd.conf 42BACULA_WORKING_DIR:=/private/var/bacula/working 43BACULA_PMDOC:=${WORKING_DIR}/installer.pmdoc 44 45# Detect whether we sit inside the Bacula source tree. In this case we won't 46# download the tar from sourceforge but instead work with what is there 47# already 48CURSUB:=$(CURDIR:%/platforms/osx=%) 49ifneq ($(CURDIR),$(CURSUB)) 50 BACULA_TAR:= 51 BACULA_SOURCE:=../../ 52# BACULA_VERSION:=$(shell sed -n 's,^VERSION=,,p' $(CURSUB)/autoconf/Make.common) 53endif 54 55PACKAGE_TITLE:=Bacula File Daemon ${BACULA_VERSION} 56PACKAGE_ID:=org.bacula.bacula-fd.pkg 57PACKAGE_DIR:=${PRODUCTS_DIR}/${PACKAGE_TITLE} 58PACKAGE_BUNDLE:=${PACKAGE_DIR}/${PACKAGE_TITLE}.pkg 59PACKAGE_DMG:=${PRODUCTS_DIR}/${PACKAGE_TITLE}.dmg 60PACKAGE_RESOURCES:=ReadMe.html postflight preupgrade 61PACKAGE_XRESOURCES:=postflight preupgrade 62 63# Flags for the toolchain 64CONFIGFLAGS:= \ 65 --enable-client-only \ 66 --prefix=${BACULA_PREFIX} \ 67 --with-dir-password=@DIR_PW@ \ 68 --with-fd-password=@FD_PW@ \ 69 --with-sd-password=@SD_PW@ \ 70 --with-mon-dir-password=@MON_DIR_PW@ \ 71 --with-mon-fd-password=@MON_FD_PW@ \ 72 --with-mon-sd-password=@MON_SD_PW@ \ 73 --with-basename=@BASENAME@ \ 74 --with-hostname=@HOSTNAME@ \ 75 --with-working-dir=${BACULA_WORKING_DIR} 76CPPFLAGS:= 77CFLAGS:=-O -g 78CXXFLAGS:=${CFLAGS} 79LDFLAGS:= 80 81# required on snow leopard: compiling for 10.4 requires usage of gcc 4.0 82# system defaults to version 4.2 83CC:=gcc 84CPP:=cpp 85CXX:=g++ 86CXXPP:=cpp 87 88# Placeholders for *.in files 89INFILE_SUBST=\ 90 -e "s,@PREFIX@,${BACULA_PREFIX},g" \ 91 -e "s,@BACULA_VERSION@,${BACULA_VERSION},g" \ 92 -e "s,@FD_CONF@,${BACULA_FD_CONF},g" \ 93 -e "s,@BACULA_DESTDIR@,${BACULA_DESTDIR},g" \ 94 -e "s,@PACKAGE_ID@,${PACKAGE_ID},g" 95 96dmg: pkg 97 hdiutil create -srcfolder "${PACKAGE_DIR}" "${PACKAGE_DMG}" 98 99pkg: ${BACULA_DESTDIR} ${BACULA_PMDOC} ${WORKING_DIR}/resources 100 mkdir -p "${PACKAGE_DIR}" 101 102 mkdir -p "${CURDIR}/${BACULA_DESTDIR}${WORKING_DIR}" 103 104 ${PB} --identifier "${PACKAGE_ID}" --root "${CURDIR}/${BACULA_DESTDIR}" "Bacula Enterprise File Daemon-${BACULA_VERSION}.pkg" 105 106 cp "Bacula Enterprise File Daemon-${BACULA_VERSION}.pkg" "${PACKAGE_DIR}" 107 cp ${WORKING_DIR}/resources/ReadMe.html "${PACKAGE_DIR}/ReadMe.html" 108 109 sed ${INFILE_SUBST} \ 110 files/uninstall.command.in > "${PACKAGE_DIR}/uninstall.command"; 111 chmod 0775 "${PACKAGE_DIR}/uninstall.command" 112 113${BACULA_PMDOC}: ${BACULA_DESTDIR} ${WORKING_DIR}/resources 114 mkdir -p "${BACULA_PMDOC}" 115 116 for f in index.xml 01destdir.xml; do \ 117 sed ${INFILE_SUBST} \ 118 files/installer.pmdoc.in/$$f > "${BACULA_PMDOC}/$$f"; \ 119 done 120 121 python installer-gencontents.py ${BACULA_DESTDIR} > ${BACULA_PMDOC}/01destdir-contents.xml 122 123${WORKING_DIR}/resources: ${BACULA_DESTDIR} 124 mkdir -p "${WORKING_DIR}/resources" 125 126 for res in ${PACKAGE_RESOURCES}; do \ 127 sed ${INFILE_SUBST} \ 128 resources/$$res.in > "${WORKING_DIR}/resources/$$res"; \ 129 done 130 131 for xres in ${PACKAGE_XRESOURCES}; do \ 132 chmod +x "${WORKING_DIR}/resources/$$xres"; \ 133 done 134 135 cp "${BACULA_SOURCE}/LICENSE" "${WORKING_DIR}/resources/License.txt" 136 137${BACULA_DESTDIR}: ${BACULA_SOURCE} 138 (cd ${BACULA_SOURCE} && ./configure ${CONFIGFLAGS} CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" CC="${CC}" CPP="${CPP}" CXX="${CXX}" CXXPP="${CXXPP}") 139 ${MAKE} -C ${BACULA_SOURCE} 140 ${MAKE} -C ${BACULA_SOURCE} install DESTDIR="${CURDIR}/${BACULA_DESTDIR}" 141 142 rm -rf "${BACULA_DESTDIR}/tmp" 143 144 for conffile in ${BACULA_DESTDIR}${BACULA_PREFIX}/etc/*.conf; do \ 145 mv $$conffile $$conffile.example; \ 146 done 147 148 mkdir -p "${BACULA_DESTDIR}${BACULA_PREFIX}/Library/LaunchDaemons" 149 sed ${INFILE_SUBST} files/org.bacula.bacula-fd.plist.in \ 150 > "${BACULA_DESTDIR}${BACULA_PREFIX}/Library/LaunchDaemons/org.bacula.bacula-fd.plist" 151 152${BACULA_SOURCE}: ${BACULA_TAR} 153 mkdir -p "${WORKING_DIR}" 154 ${TAR} -xzf "${BACULA_TAR}" -C "${WORKING_DIR}" 155 156${BACULA_TAR}: 157 mkdir -p "${DL_DIR}" 158 ${CURL} -L -o "${BACULA_TAR}" "${BACULA_DL_URL}" 159 160.PHONY: distclean 161distclean: clean 162 rm -rf "${DL_DIR}" "${PRODUCTS_DIR}" 163 164.PHONY: clean 165clean: 166 rm -rf "${BUILD_DIR}" "${PACKAGE_DIR}" "${PACKAGE_DMG}" 167