Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Use new tools.

  • Loading branch information
wsanchez committed Mar 21, 2014
1 parent d0a9ebf commit 32ed40b342e561a380f0f234d20cf97bddf4260d
Showing with 62 additions and 111 deletions.
  1. +46 −98 support/Apple.make
  2. +16 −13 support/_cache_deps
@@ -32,7 +32,7 @@ include /AppleInternal/ServerTools/ServerBuildVariables.xcconfig
SIPP = $(SERVER_INSTALL_PATH_PREFIX)
SERVERSETUP = $(SIPP)$(NSSYSTEMDIR)$(NSLIBRARYSUBDIR)/ServerSetup

Cruft += .dependencies
Cruft += .develop
Extra_Environment += PATH="$(SIPP)/usr/bin:$$PATH"
Extra_Environment += PYTHONPATH="$(PY_TMP_LIB)"

@@ -52,61 +52,25 @@ CS_GROUP = _calendar
# Build
#

.phony: $(Project) pycalendar twext build setup prep install install-ossfiles buildit

CALDAVTESTER = CalDAVTester
PYKERBEROS = PyKerberos-9409
PYCALENDAR = PyCalendar-11947
TWEXT = twext-12414
PYGRESQL = PyGreSQL-4.1.1
SQLPARSE = sqlparse-0.1.2
SETPROCTITLE = setproctitle-1.1.8
PSUTIL = psutil-1.2.0
PYCRYPTO = pycrypto-2.6.1
CFFI = cffi-0.6
PYCPARSER = pycparser-2.10

$(CALDAVTESTER):: $(BuildDirectory)/$(CALDAVTESTER)
$(PYKERBEROS):: $(BuildDirectory)/$(PYKERBEROS)
$(PYCALENDAR):: $(BuildDirectory)/$(PYCALENDAR)
$(TWEXT):: $(BuildDirectory)/$(TWEXT)
$(PYGRESQL):: $(BuildDirectory)/$(PYGRESQL)
$(SQLPARSE):: $(BuildDirectory)/$(SQLPARSE)
$(SETPROCTITLE):: $(BuildDirectory)/$(SETPROCTITLE)
$(PSUTIL):: $(BuildDirectory)/$(PSUTIL)
$(PYCRYPTO):: $(BuildDirectory)/$(PYCRYPTO)
$(CFFI):: $(BuildDirectory)/$(CFFI)
$(PYCPARSER):: $(BuildDirectory)/$(PYCPARSER)
$(Project):: $(BuildDirectory)/$(Project)

build:: $(PYKERBEROS) $(PYCALENDAR) $(TWEXT) $(PYGRESQL) $(SQLPARSE) $(SETPROCTITLE) $(PSUTIL) $(PYCRYPTO) $(CFFI) $(PYCPARSER) $(Project)

setup:
$(_v) ./run -g

prep:: setup $(CALDAVTESTER).tgz $(PYKERBEROS).tgz $(PYCALENDAR).tgz $(TWEXT).tgz $(PYGRESQL).tgz $(SQLPARSE).tgz $(SETPROCTITLE).tgz $(PSUTIL).tgz $(PYCRYPTO).tgz $(CFFI).tgz $(PYCPARSER).tgz

# $(PYKERBEROS) $(PYCALENDAR) $(PYGRESQL) $(SQLPARSE) $(SETPROCTITLE) $(PSUTIL) $(PYCRYPTO) $(CFFI) $(PYCPARSER) $(Project)::
# @echo "Building $@..."
# $(_v) cd $(BuildDirectory)/$@ && $(Environment) $(PYTHON) setup.py build
.phony: $(Project) prep build install install-ossfiles buildit

$(Project):: $(BuildDirectory)/$(Project)
@echo "Building $@..."
$(_v) cd $(BuildDirectory)/$@ && $(Environment) $(PYTHON) setup.py build

build:: $(Project)

install:: build
$(_v) cd $(BuildDirectory)/$(PYKERBEROS) && $(Environment) $(PYTHON) setup.py install $(PY_INSTALL_FLAGS)
$(_v) cd $(BuildDirectory)/$(PYCALENDAR) && $(Environment) $(PYTHON) setup.py install $(PY_INSTALL_FLAGS)
$(_v) cd $(BuildDirectory)/$(TWEXT) && $(Environment) $(PYTHON) setup.py install $(PY_INSTALL_FLAGS)
$(_v) cd $(BuildDirectory)/$(PYGRESQL) && $(Environment) $(PYTHON) setup.py install $(PY_INSTALL_FLAGS)
$(_v) cd $(BuildDirectory)/$(SQLPARSE) && $(Environment) $(PYTHON) setup.py install $(PY_INSTALL_FLAGS)
$(_v) cd $(BuildDirectory)/$(SETPROCTITLE) && $(Environment) $(PYTHON) setup.py install $(PY_INSTALL_FLAGS)
$(_v) cd $(BuildDirectory)/$(PSUTIL) && $(Environment) $(PYTHON) setup.py install $(PY_INSTALL_FLAGS)
$(_v) cd $(BuildDirectory)/$(PYCRYPTO) && $(Environment) $(PYTHON) setup.py install $(PY_INSTALL_FLAGS)
$(_v) cd $(BuildDirectory)/$(PYCPARSER) && $(Environment) $(PYTHON) setup.py install $(PY_INSTALL_FLAGS)
$(_v) cd $(BuildDirectory)/$(CFFI) && $(Environment) $(PYTHON) setup.py install $(PY_INSTALL_FLAGS)
$(_v) cd $(BuildDirectory)/$(Project) && $(Environment) $(PYTHON) setup.py build_ext $(CS_BUILD_EXT_FLAGS) install $(PY_INSTALL_FLAGS) $(CS_INSTALL_FLAGS)
$(_v) for so in $$(find "$(DSTROOT)$(PY_HOME)/lib" -type f -name '*.so'); do $(STRIP) -Sx "$${so}"; done
$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)$(SIPP)$(ETCDIR)$(CALDAVDSUBDIR)"
$(_v) $(INSTALL_FILE) "$(Sources)/conf/caldavd-apple.plist" "$(DSTROOT)$(SIPP)$(ETCDIR)$(CALDAVDSUBDIR)/caldavd-apple.plist"
$(_v) chmod -R ugo+r "$(DSTROOT)$(PY_HOME)"
$(_v) for f in $$(find "$(DSTROOT)$(SIPP)$(ETCDIR)" -type f ! -name '*.default'); do cp "$${f}" "$${f}.default"; done
$(_v) cd $(BuildDirectory)/$(Project) && \
$(Environment) $(PYTHON) setup.py \
build_ext $(CS_BUILD_EXT_FLAGS) \
install $(PY_INSTALL_FLAGS) $(CS_INSTALL_FLAGS) \
;
$(_v) for so in $$(find "$(DSTROOT)$(PY_HOME)/lib" -type f -name '*.so'); do $(STRIP) -Sx "$${so}"; done;
$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)$(SIPP)$(ETCDIR)$(CALDAVDSUBDIR)";
$(_v) $(INSTALL_FILE) "$(Sources)/conf/caldavd-apple.plist" "$(DSTROOT)$(SIPP)$(ETCDIR)$(CALDAVDSUBDIR)/caldavd-apple.plist";
$(_v) chmod -R ugo+r "$(DSTROOT)$(PY_HOME)";
$(_v) for f in $$(find "$(DSTROOT)$(SIPP)$(ETCDIR)" -type f ! -name '*.default'); do cp "$${f}" "$${f}.default"; done;

install::
@echo "Installing manual pages..."
@@ -115,57 +79,39 @@ install::
$(_v) $(INSTALL_FILE) "$(Sources)/doc/calendarserver_command_gateway.8" "$(DSTROOT)$(SIPP)$(MANDIR)/man8"
$(_v) $(INSTALL_FILE) "$(Sources)/doc/calendarserver_export.8" "$(DSTROOT)$(SIPP)$(MANDIR)/man8"
$(_v) $(INSTALL_FILE) "$(Sources)/doc/calendarserver_manage_principals.8" "$(DSTROOT)$(SIPP)$(MANDIR)/man8"
$(_v) $(INSTALL_FILE) "$(Sources)/doc/calendarserver_migrate_resources.8" "$(DSTROOT)$(SIPP)$(MANDIR)/man8"
$(_v) $(INSTALL_FILE) "$(Sources)/doc/calendarserver_purge_attachments.8" "$(DSTROOT)$(SIPP)$(MANDIR)/man8"
$(_v) $(INSTALL_FILE) "$(Sources)/doc/calendarserver_purge_events.8" "$(DSTROOT)$(SIPP)$(MANDIR)/man8"
$(_v) $(INSTALL_FILE) "$(Sources)/doc/calendarserver_purge_principals.8" "$(DSTROOT)$(SIPP)$(MANDIR)/man8"
$(_v) $(INSTALL_FILE) "$(Sources)/doc/calendarserver_manage_push.8" "$(DSTROOT)$(SIPP)$(MANDIR)/man8"
$(_v) $(INSTALL_FILE) "$(Sources)/doc/calendarserver_shell.8" "$(DSTROOT)$(SIPP)$(MANDIR)/man8"
$(_v) $(INSTALL_FILE) "$(Sources)/doc/calendarserver_manage_timezones.8" "$(DSTROOT)$(SIPP)$(MANDIR)/man8"
$(_v) gzip -9 -f "$(DSTROOT)$(SIPP)$(MANDIR)/man8/"*.[0-9]
@echo "Installing launchd config..."
$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)$(NSLOCALDIR)/$(NSLIBRARYSUBDIR)/Server/Calendar and Contacts"
$(_v) $(INSTALL_DIRECTORY) -o "$(CS_USER)" -g "$(CS_GROUP)" -m 0755 "$(DSTROOT)$(VARDIR)/log$(CALDAVDSUBDIR)"
$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)$(SIPP)$(NSLIBRARYDIR)/LaunchDaemons"
$(_v) $(INSTALL_FILE) "$(Sources)/contrib/launchd/calendarserver.plist" "$(DSTROOT)$(SIPP)$(NSLIBRARYDIR)/LaunchDaemons/org.calendarserver.calendarserver.plist"
@echo "Installing changeip script..."
$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)$(SIPP)$(LIBEXECDIR)/changeip"
$(_v) $(INSTALL_FILE) "$(Sources)/calendarserver/tools/changeip_calendar.py" "$(DSTROOT)$(SIPP)$(LIBEXECDIR)/changeip/changeip_calendar.py"
$(_v) chmod ugo+x "$(DSTROOT)$(SIPP)$(LIBEXECDIR)/changeip/changeip_calendar.py"

install::
@echo "Installing CalDAVTester package..."
$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)/AppleInternal/ServerTools"
$(_v) $(TAR) -C "$(DSTROOT)/AppleInternal/ServerTools" -xzf "$(Sources)/CalDAVTester.tgz"
@echo "Installing launchd config...";
$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)$(NSLOCALDIR)/$(NSLIBRARYSUBDIR)/Server/Calendar and Contacts";
$(_v) $(INSTALL_DIRECTORY) -o "$(CS_USER)" -g "$(CS_GROUP)" -m 0755 "$(DSTROOT)$(VARDIR)/log$(CALDAVDSUBDIR)";
$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)$(SIPP)$(NSLIBRARYDIR)/LaunchDaemons";
$(_v) $(INSTALL_FILE) "$(Sources)/contrib/launchd/calendarserver.plist" "$(DSTROOT)$(SIPP)$(NSLIBRARYDIR)/LaunchDaemons/org.calendarserver.calendarserver.plist";

install::
@echo "Installing changeip script...";
$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)$(SIPP)$(LIBEXECDIR)/changeip";
$(_v) $(INSTALL_FILE) "$(Sources)/calendarserver/tools/changeip_calendar.py" "$(DSTROOT)$(SIPP)$(LIBEXECDIR)/changeip/changeip_calendar.py";
$(_v) chmod ugo+x "$(DSTROOT)$(SIPP)$(LIBEXECDIR)/changeip/changeip_calendar.py";

install::
@echo "Installing CalDAVTester package...";
$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)/AppleInternal/ServerTools";
$(_v) cd "$(DSTROOT)/AppleInternal/ServerTools" && unzip "$(BuildDirectory)/$(Project)/requirements/cache/CalDAVTester-*.zip";

#
# Automatic Extract
#

$(BuildDirectory)/$(Project):
@echo "Copying source for $(Project)..."
$(_v) $(MKDIR) -p "$@"
$(_v) pax -rw bin conf Makefile lib-patches setup.py calendarserver twistedcaldav txdav txweb2 twisted support "$@/"

$(BuildDirectory)/%: %.tgz
@echo "Extracting source for $(notdir $<)..."
$(_v) $(MKDIR) -p "$(BuildDirectory)"
$(_v) $(RMDIR) "$@"
$(_v) $(TAR) -C "$(BuildDirectory)" -xzf "$<"

%.tgz: ../%
@echo "Archiving sources for $(notdir $<)..."
$(_v) if [ -f "$</setup.py" ] && grep setuptools "$</setup.py" > /dev/null; then \
echo "Working around setuptools' stupid need to download a new version."; \
cd "$<" && $(Environment) $(PYTHON) "setup.py" --help >/dev/null; \
fi
$(_v) $(TAR) -C "$(dir $<)" \
--exclude=.svn \
--exclude=build \
--exclude=_trial_temp \
--exclude=dropin.cache \
--exclude='*.exe' \
-czf "$@" "$(notdir $<)"
@echo "Copying source for $(Project) to build directory...";
$(_v) $(MKDIR) -p "$@";
$(_v) cp -a "$(Sources)/" "$@/";

#
# Open Source Hooey
@@ -177,15 +123,17 @@ OSL = $(USRDIR)/local/OpenSourceLicenses
#install:: install-ossfiles

install-ossfiles::
$(_v) $(INSTALL_DIRECTORY) $(DSTROOT)/$(OSV)
$(_v) $(INSTALL_FILE) $(Sources)/$(ProjectName).plist $(DSTROOT)/$(OSV)/$(ProjectName).plist
$(_v) $(INSTALL_DIRECTORY) $(DSTROOT)/$(OSL)
$(_v) $(INSTALL_FILE) $(BuildDirectory)/$(Project)/LICENSE $(DSTROOT)/$(OSL)/$(ProjectName).txt
$(_v) $(INSTALL_DIRECTORY) $(DSTROOT)/$(OSV);
$(_v) $(INSTALL_FILE) $(Sources)/$(ProjectName).plist $(DSTROOT)/$(OSV)/$(ProjectName).plist;
$(_v) $(INSTALL_DIRECTORY) $(DSTROOT)/$(OSL);
$(_v) $(INSTALL_FILE) $(BuildDirectory)/$(Project)/LICENSE $(DSTROOT)/$(OSL)/$(ProjectName).txt;

#
# B&I Hooey
#

buildit: prep
@echo "Running buildit..."
$(_v) sudo ~rc/bin/buildit $(CC_Archs) $(Sources)
buildit:
@echo "Downloading dependencies...";
$(_v) ./support/_cache_deps
@echo "Running buildit...";
$(_v) sudo ~rc/bin/buildit $(CC_Archs) $(Sources);
@@ -30,16 +30,19 @@ develop > /dev/null;

mkdir "${wd}/requirements/cache";

find "${wd}/requirements" -type f -name "py_*.txt" | while read requirements; do
case "${requirements}" in
*/py_opt_OpenDirectory.txt) download=false; ;;
*/py_opt_Oracle.txt) download=false; ;;
*) download=true; ;;
esac;

if "${download}"; then
echo "Downloading requirements from: ${requirements}";

"${python}" -m pip install --download "${wd}/requirements/cache" --requirement "${requirements}";
fi;
done;
find "${wd}/requirements" -type f -name "py_*.txt" |\
while read requirements; do
case "${requirements}" in
*/py_opt_OpenDirectory.txt) download=false; ;;
*/py_opt_Oracle.txt) download=false; ;;
*) download=true; ;;
esac;

if "${download}"; then
echo "Downloading requirements from: ${requirements}";

"${python}" -m pip install \
--download "${wd}/requirements/cache" \
--requirement "${requirements}";
fi;
done;

0 comments on commit 32ed40b

Please sign in to comment.
You can’t perform that action at this time.