freeipa/Makefile

275 lines
9.6 KiB
Makefile
Raw Normal View History

include VERSION
SUBDIRS=daemons install ipapython ipa-client smartproxy
2009-10-12 15:00:00 -05:00
CLIENTDIRS=ipapython ipa-client
0000-12-31 18:09:24 -05:50
PRJ_PREFIX=freeipa
0000-12-31 18:09:24 -05:50
RPMBUILD ?= $(PWD)/rpmbuild
TARGET ?= master
SUPPORTED_PLATFORM ?= fedora
IPA_NUM_VERSION ?= $(shell printf %d%02d%02d $(IPA_VERSION_MAJOR) $(IPA_VERSION_MINOR) $(IPA_VERSION_RELEASE))
# After updating the version in VERSION you should run the version-update
0000-12-31 18:09:24 -05:50
# target.
ifeq ($(IPA_VERSION_IS_GIT_SNAPSHOT),"yes")
GIT_VERSION=$(shell git show --pretty=format:"%h" --stat HEAD 2>/dev/null|head -1)
ifneq ($(GIT_VERSION),)
IPA_VERSION=$(IPA_VERSION_MAJOR).$(IPA_VERSION_MINOR).$(IPA_VERSION_RELEASE)GIT$(GIT_VERSION)
endif # in a git tree and git returned a version
endif # git
ifndef IPA_VERSION
ifdef IPA_VERSION_PRE_RELEASE
IPA_VERSION=$(IPA_VERSION_MAJOR).$(IPA_VERSION_MINOR).$(IPA_VERSION_RELEASE).pre$(IPA_VERSION_PRE_RELEASE)
else
ifdef IPA_VERSION_BETA_RELEASE
IPA_VERSION=$(IPA_VERSION_MAJOR).$(IPA_VERSION_MINOR).$(IPA_VERSION_RELEASE).beta$(IPA_VERSION_BETA_RELEASE)
else
ifdef IPA_VERSION_RC_RELEASE
IPA_VERSION=$(IPA_VERSION_MAJOR).$(IPA_VERSION_MINOR).$(IPA_VERSION_RELEASE).rc$(IPA_VERSION_RC_RELEASE)
else
IPA_VERSION=$(IPA_VERSION_MAJOR).$(IPA_VERSION_MINOR).$(IPA_VERSION_RELEASE)
endif # rc
endif # beta
endif # pre
endif # ipa_version
IPA_VENDOR_VERSION=$(IPA_VERSION)$(IPA_VENDOR_VERSION_SUFFIX)
TARBALL_PREFIX=freeipa-$(IPA_VERSION)
TARBALL=$(TARBALL_PREFIX).tar.gz
IPA_RPM_RELEASE=$(shell cat RELEASE)
LIBDIR ?= /usr/lib
DEVELOPER_MODE ?= 0
ifneq ($(DEVELOPER_MODE),0)
LINT_OPTIONS=--no-fail
endif
PYTHON ?= $(shell rpm -E %__python || echo /usr/bin/python2)
CFLAGS := -g -O2 -Wall -Wextra -Wformat-security -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers $(CFLAGS)
export CFLAGS
# Uncomment to increase Java stack size for Web UI build in case it fails
# because of stack overflow exception. Default should be OK for most platforms.
#JAVA_STACK_SIZE ?= 8m
#export JAVA_STACK_SIZE
all: bootstrap-autogen server tests
0000-12-31 18:09:24 -05:50
@for subdir in $(SUBDIRS); do \
(cd $$subdir && $(MAKE) $@) || exit 1; \
done
2009-10-12 15:00:00 -05:00
client: client-autogen
@for subdir in $(CLIENTDIRS); do \
(cd $$subdir && $(MAKE) all) || exit 1; \
done
bootstrap-autogen: version-update client-autogen
@echo "Building IPA $(IPA_VERSION)"
cd daemons; if [ ! -e Makefile ]; then ../autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=$(LIBDIR) --with-openldap; fi
cd install; if [ ! -e Makefile ]; then ../autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=$(LIBDIR); fi
cd smartproxy; if [ ! -e Makefile ]; then ../autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=$(LIBDIR); fi
2009-10-12 15:00:00 -05:00
client-autogen: version-update
cd ipa-client; if [ ! -e Makefile ]; then ../autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=$(LIBDIR); fi
cd install; if [ ! -e Makefile ]; then ../autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=$(LIBDIR); fi
tests-man-autogen: version-update
cd ipatests/man; if [ ! -e Makefile ]; then ../../autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=$(LIBDIR); fi
install: all server-install tests-install
0000-12-31 18:09:24 -05:50
@for subdir in $(SUBDIRS); do \
(cd $$subdir && $(MAKE) $@) || exit 1; \
done
client-install: client client-dirs
2009-10-12 15:00:00 -05:00
@for subdir in $(CLIENTDIRS); do \
(cd $$subdir && $(MAKE) install) || exit 1; \
done
cd install/po && $(MAKE) install || exit 1;
2009-10-12 15:00:00 -05:00
if [ "$(DESTDIR)" = "" ]; then \
$(PYTHON) setup-client.py install; \
2009-10-12 15:00:00 -05:00
else \
$(PYTHON) setup-client.py install --root $(DESTDIR); \
2009-10-12 15:00:00 -05:00
fi
client-dirs:
@if [ "$(DESTDIR)" != "" ] ; then \
mkdir -p $(DESTDIR)/etc/ipa ; \
mkdir -p $(DESTDIR)/var/lib/ipa-client/sysrestore ; \
else \
echo "DESTDIR was not set, please create /etc/ipa and /var/lib/ipa-client/sysrestore" ; \
echo "Without those directories ipa-client-install will fail" ; \
fi
lint: bootstrap-autogen
./make-lint $(LINT_OPTIONS)
$(MAKE) -C install/po validate-src-strings
test:
./make-test
release-update:
if [ ! -e RELEASE ]; then echo 0 > RELEASE; fi
version-update: release-update
sed -e s/__VERSION__/$(IPA_VERSION)/ -e s/__RELEASE__/$(IPA_RPM_RELEASE)/ \
freeipa.spec.in > freeipa.spec
sed -e s/__VERSION__/$(IPA_VERSION)/ version.m4.in \
> version.m4
sed -e s/__VERSION__/$(IPA_VERSION)/ ipapython/setup.py.in \
> ipapython/setup.py
sed -e s/__VERSION__/$(IPA_VERSION)/ ipaplatform/setup.py.in \
> ipaplatform/setup.py
sed -e s/__VERSION__/$(IPA_VERSION)/ ipapython/version.py.in \
> ipapython/version.py
sed -e s/__VERSION__/$(IPA_VERSION)/ ipatests/setup.py.in \
> ipatests/setup.py
Load updated Web UI files after server upgrade Issue: * There was no caching policy specified. * -> Browsers use their own default policy. * -> After upgrade, some Web UI files might have been actualized some not. * -> With schema change may result into weird bugs in Web UI Solution considerations: 1. Detect server version change and hard-reload at runtime Detection is easy. Problem is the reload. Obvious candidate 'window.location.reload(true)' works in Firefox but not in Chrome because expected behavior when parameter is used is not in standard and therefore Chromium/WebKit authors did not implement it. 2. Application Cache HTML 5 technology which lets web apps to run offline. Besides weird issues with event handlers which I encountered, this would be an ideal candidate. Simple change of manifest file would lead to reload of all files (requires reload of page to used the new files). Showstopper was usage with untrusted certificate. If user did not add exception for the cert or its CA and would visit the page for a second time, all AJAX calls would fail. 3. Set Expires to now() for everything Web UI rarely changes so this is an overkill. Setting it to different value is not a solution either. We can't predict when the upgrade will happen and when new Web UI will be needed. Solution: * Implemented a mini loader which loads basic resources. Dojo loader takes action after Dojo is loaded. * The loader adds a version parameter (?v=__NUM_VERSION__) to all requests. * Version is defined in the loader. It's set to current in `make version-update`. * All static pages use this loader to fetch their resources. * Version is also passed to dojo loader as cache-bust for the same effect. * Expire header was set to 'access time plus 1 year' for /ui folder. Exceptions are HTML files and loader (set to immediate expiration). Possible issues: * Images are cached but not requested with version param. * Images with version and without are considered different * -> We would have to attach version to all URIs - in CSS and in JS. But we should avoid changing jQuery UI CSS. * Proposed solution is to change image name when changing image. Image change is done rarely. * Version is set by build and therefore updated just on server update. It might cause trouble with different update schedule of plugins. * No action taken to address this issue yet. * We might leave it on plugin devs (own .conf in /etc/httpd/conf.d/) * or set expires to now for all plugins * running `make version-update` is required in order to use static version of UI for testing https://fedorahosted.org/freeipa/ticket/3798
2013-08-29 08:19:02 -05:00
sed -e s/__NUM_VERSION__/$(IPA_NUM_VERSION)/ install/ui/src/libs/loader.js.in \
> install/ui/src/libs/loader.js
perl -pi -e "s:__API_VERSION__:$(IPA_API_VERSION_MAJOR).$(IPA_API_VERSION_MINOR):" install/ui/src/libs/loader.js
perl -pi -e "s:__NUM_VERSION__:$(IPA_NUM_VERSION):" ipapython/version.py
perl -pi -e "s:__VENDOR_VERSION__:$(IPA_VENDOR_VERSION):" ipapython/version.py
perl -pi -e "s:__API_VERSION__:$(IPA_API_VERSION_MAJOR).$(IPA_API_VERSION_MINOR):" ipapython/version.py
touch -r ipapython/version.py.in ipapython/version.py
sed -e s/__VERSION__/$(IPA_VERSION)/ daemons/ipa-version.h.in \
> daemons/ipa-version.h
perl -pi -e "s:__NUM_VERSION__:$(IPA_NUM_VERSION):" daemons/ipa-version.h
perl -pi -e "s:__DATA_VERSION__:$(IPA_DATA_VERSION):" daemons/ipa-version.h
sed -e s/__VERSION__/$(IPA_VERSION)/ -e s/__RELEASE__/$(IPA_RPM_RELEASE)/ \
ipa-client/ipa-client.spec.in > ipa-client/ipa-client.spec
sed -e s/__VERSION__/$(IPA_VERSION)/ ipa-client/version.m4.in \
> ipa-client/version.m4
if [ "$(SUPPORTED_PLATFORM)" != "" ]; then \
rm -f ipaplatform/paths.py ipaplatform/services.py ipaplatform/tasks.py; \
ln -s $(SUPPORTED_PLATFORM)/paths.py ipaplatform/paths.py; \
ln -s $(SUPPORTED_PLATFORM)/services.py ipaplatform/services.py; \
ln -s $(SUPPORTED_PLATFORM)/tasks.py ipaplatform/tasks.py; \
fi
if [ "$(SKIP_API_VERSION_CHECK)" != "yes" ]; then \
./makeapi --validate; \
./makeaci --validate; \
fi
server: version-update
$(PYTHON) setup.py build
0000-12-31 18:09:24 -05:50
server-install: server
2009-10-12 15:00:00 -05:00
if [ "$(DESTDIR)" = "" ]; then \
$(PYTHON) setup.py install; \
else \
$(PYTHON) setup.py install --root $(DESTDIR); \
fi
tests: version-update tests-man-autogen
cd ipatests; $(PYTHON) setup.py build
cd ipatests/man && $(MAKE) all
tests-install: tests
if [ "$(DESTDIR)" = "" ]; then \
cd ipatests; $(PYTHON) setup.py install; \
else \
cd ipatests; $(PYTHON) setup.py install --root $(DESTDIR); \
fi
cd ipatests/man && $(MAKE) install
archive:
0000-12-31 18:09:24 -05:50
-mkdir -p dist
git archive --format=tar --prefix=ipa/ $(TARGET) | (cd dist && tar xf -)
0000-12-31 18:09:24 -05:50
local-archive:
-mkdir -p dist/$(TARBALL_PREFIX)
rsync -a --exclude=dist --exclude=.git --exclude=/build --exclude=rpmbuild . dist/$(TARBALL_PREFIX)
archive-cleanup:
rm -fr dist/freeipa
tarballs: local-archive
-mkdir -p dist/sources
# tar up clean sources
cd dist/$(TARBALL_PREFIX)/ipa-client; ../autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=$(LIBDIR); make distclean
cd dist/$(TARBALL_PREFIX)/daemons; ../autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=$(LIBDIR); make distclean
cd dist/$(TARBALL_PREFIX)/install; ../autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=$(LIBDIR); make distclean
cd dist/$(TARBALL_PREFIX)/smartproxy; ../autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=$(LIBDIR); make distclean
cd dist; tar cfz sources/$(TARBALL) $(TARBALL_PREFIX)
rm -rf dist/$(TARBALL_PREFIX)
rpmroot:
rm -rf $(RPMBUILD)
mkdir -p $(RPMBUILD)/BUILD
mkdir -p $(RPMBUILD)/RPMS
mkdir -p $(RPMBUILD)/SOURCES
mkdir -p $(RPMBUILD)/SPECS
mkdir -p $(RPMBUILD)/SRPMS
rpmdistdir:
mkdir -p dist/rpms
mkdir -p dist/srpms
rpms: rpmroot rpmdistdir version-update lint tarballs
cp dist/sources/$(TARBALL) $(RPMBUILD)/SOURCES/.
rpmbuild --define "_topdir $(RPMBUILD)" -ba freeipa.spec
cp $(RPMBUILD)/RPMS/*/$(PRJ_PREFIX)-*-$(IPA_VERSION)-*.rpm dist/rpms/
cp $(RPMBUILD)/SRPMS/$(PRJ_PREFIX)-$(IPA_VERSION)-*.src.rpm dist/srpms/
rm -rf $(RPMBUILD)
client-rpms: rpmroot rpmdistdir version-update lint tarballs
2009-10-12 15:00:00 -05:00
cp dist/sources/$(TARBALL) $(RPMBUILD)/SOURCES/.
rpmbuild --define "_topdir $(RPMBUILD)" --define "ONLY_CLIENT 1" -ba freeipa.spec
cp $(RPMBUILD)/RPMS/*/$(PRJ_PREFIX)-*-$(IPA_VERSION)-*.rpm dist/rpms/
cp $(RPMBUILD)/SRPMS/$(PRJ_PREFIX)-$(IPA_VERSION)-*.src.rpm dist/srpms/
rm -rf $(RPMBUILD)
2009-10-12 15:00:00 -05:00
srpms: rpmroot rpmdistdir version-update lint tarballs
2009-05-07 16:37:29 -05:00
cp dist/sources/$(TARBALL) $(RPMBUILD)/SOURCES/.
rpmbuild --define "_topdir $(RPMBUILD)" -bs freeipa.spec
cp $(RPMBUILD)/SRPMS/$(PRJ_PREFIX)-$(IPA_VERSION)-*.src.rpm dist/srpms/
rm -rf $(RPMBUILD)
2009-05-07 16:37:29 -05:00
repodata:
-createrepo -p dist
dist: version-update archive tarballs archive-cleanup rpms repodata
local-dist: bootstrap-autogen clean local-archive tarballs archive-cleanup rpms
clean: version-update
@for subdir in $(SUBDIRS); do \
(cd $$subdir && $(MAKE) $@) || exit 1; \
done
rm -f *~
distclean: version-update
2009-10-12 15:00:00 -05:00
touch daemons/NEWS daemons/README daemons/AUTHORS daemons/ChangeLog
touch install/NEWS install/README install/AUTHORS install/ChangeLog
@for subdir in $(SUBDIRS); do \
(cd $$subdir && $(MAKE) $@) || exit 1; \
done
rm -fr $(RPMBUILD) dist build
2009-10-12 15:00:00 -05:00
rm -f daemons/NEWS daemons/README daemons/AUTHORS daemons/ChangeLog
rm -f install/NEWS install/README install/AUTHORS install/ChangeLog
0000-12-31 18:09:24 -05:50
maintainer-clean: clean
rm -fr $(RPMBUILD) dist build
cd daemons && $(MAKE) maintainer-clean
cd install && $(MAKE) maintainer-clean
0000-12-31 18:09:24 -05:50
cd ipa-client && $(MAKE) maintainer-clean
cd ipapython && $(MAKE) maintainer-clean
cd smartproxy && $(MAKE) maintainer-clean
rm -f version.m4
rm -f freeipa.spec