4 HOMEPAGE ?= http://www.gentoo.org/proj/en/portage/index.xml
8 DESTDIR = $(PWD)/image/
12 exec_prefix = $(prefix)
13 bindir = $(exec_prefix)/bin
14 sbindir = $(exec_prefix)/sbin
15 libdir = $(exec_prefix)/lib
16 datarootdir = $(prefix)/share
17 datadir = $(datarootdir)
18 mandir = $(datarootdir)/man
19 docdir = $(datarootdir)/doc/$(PF)
20 htmldir = $(docdir)/html
21 portage_datadir = $(datarootdir)/$(PN)
22 portage_confdir = $(portage_datadir)/config
23 portage_setsdir = $(portage_confdir)/sets
24 portage_base = $(libdir)/$(PN)
25 EPYDOC_OPTS = -qqqqq --no-frames --show-imports
29 SYSCONFDIR_FILES = etc-update.conf dispatch-conf.conf
30 PORTAGE_CONFDIR_FILES = make.conf.example make.globals repos.conf
31 LOGROTATE_FILES = elog-save-summary
32 BINDIR_FILES = ebuild egencache emerge emerge-webrsync \
33 emirrordist portageq quickpkg repoman
34 SBINDIR_FILES = archive-conf dispatch-conf emaint \
35 env-update etc-update fixpackages regenworld
36 DOCS = ChangeLog NEWS RELEASE-NOTES
37 LINGUAS ?= $(shell cd "$(srcdir)/man" && find -mindepth 1 -type d)
40 PYTHONPATH := $(srcdir)/pym:$(PYTHONPATH)
42 PYTHONPATH := $(srcdir)/pym
49 touch "$(srcdir)/doc/fragment/date"; \
50 $(MAKE) -C "$(srcdir)/doc" xhtml xhtml-nochunks
54 # workaround for bug 282760 \
55 touch "$(srcdir)/pym/pysqlite2.py"; \
56 env PYTHONPATH="$(PYTHONPATH)" epydoc \
57 -o "$(WORKDIR)/epydoc" \
61 $$(cd "$(srcdir)" && find pym -name '*.py' | sed \
62 -e s:/__init__.py$$:: \
67 rm -f "$(srcdir)/pym/pysqlite2.py"* \
68 "$(WORKDIR)/epydoc/pysqlite2-"* \
69 "$(WORKDIR)/epydoc/api-objects.txt"; \
73 "$(srcdir)/pym/portage/tests/runTests"; \
78 install -d -m$(DIRMODE) "$(DESTDIR)$(sysconfdir)"; \
79 install -m$(INSMODE) $(SYSCONFDIR_FILES) "$(DESTDIR)$(sysconfdir)"; \
81 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_confdir)"; \
83 install -m$(INSMODE) $(PORTAGE_CONFDIR_FILES) \
84 "$(DESTDIR)$(portage_confdir)"; \
85 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_setsdir)"; \
87 install -m$(INSMODE) *.conf "$(DESTDIR)$(portage_setsdir)"; \
89 install -d -m$(DIRMODE) "$(DESTDIR)$(sysconfdir)/logrotate.d"; \
90 cd "$(srcdir)/cnf/logrotate.d"; \
91 install -m$(INSMODE) $(LOGROTATE_FILES) \
92 "$(DESTDIR)$(sysconfdir)/logrotate.d"; \
94 for x in $$(cd "$(srcdir)" && find bin -type d) ; do \
96 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_base)/$$x"; \
97 files=$$(find . -mindepth 1 -maxdepth 1 -type f ! -type l); \
98 if [ -n "$$files" ] ; then \
99 install -m$(EXEMODE) $$files \
100 "$(DESTDIR)$(portage_base)/$$x"; \
102 symlinks=$$(find . -mindepth 1 -maxdepth 1 -type l); \
103 if [ -n "$$symlinks" ] ; then \
104 cp -P $$symlinks "$(DESTDIR)$(portage_base)/$$x"; \
108 for x in $$(cd "$(srcdir)" && find pym/* -type d \
109 ! -path "pym/portage/tests*") ; do \
110 cd "$(srcdir)/$$x"; \
111 files=$$(echo *.py); \
112 if [ -z "$$files" ] || [ "$$files" = "*.py" ]; then \
113 # __pycache__ directories contain no py files \
116 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_base)/$$x"; \
117 install -m$(INSMODE) $$files "$(DESTDIR)$(portage_base)/$$x"; \
120 install -d -m$(DIRMODE) "$(DESTDIR)$(bindir)"; \
121 relative_path=".."; \
123 y="$(portage_base)"; \
124 if [ "$${x#$(prefix)}" != "$$x" ] && \
125 [ "$${y#$(prefix)}" != "$$y" ]; then \
130 while [ -n "$$x" ] ; do \
131 relative_path=$${relative_path}/..; \
134 relative_path=$$relative_path$$y; \
135 for x in $(BINDIR_FILES) ; do \
136 ln -sf "$$relative_path/bin/$$x" \
137 "$(DESTDIR)$(bindir)/$$x"; \
140 install -d -m$(DIRMODE) "$(DESTDIR)$(sbindir)"; \
141 relative_path=".."; \
143 y="$(portage_base)"; \
144 if [ "$${x#$(prefix)}" != "$$x" ] && \
145 [ "$${y#$(prefix)}" != "$$y" ]; then \
150 while [ -n "$$x" ] ; do \
151 relative_path=$${relative_path}/..; \
154 relative_path=$$relative_path$$y; \
155 for x in $(SBINDIR_FILES) ; do \
156 ln -sf "$$relative_path/bin/$$x" \
157 "$(DESTDIR)$(sbindir)/$$x"; \
160 ln -sf "$$relative_path/bin/env-update" \
161 "$(DESTDIR)$(sbindir)/update-env"; \
162 ln -sf "$$relative_path/bin/etc-update" \
163 "$(DESTDIR)$(sbindir)/update-etc"; \
165 # We install some minimal tests for use as a preinst sanity check. \
166 # These tests must be able to run without a full source tree and \
167 # without relying on a previous portage instance being installed. \
168 install -d -m$(DIRMODE) \
169 "$(DESTDIR)$(portage_base)/pym/portage/tests"; \
170 install -m$(EXEMODE) "$(srcdir)/pym/portage/tests/runTests" \
171 "$(DESTDIR)$(portage_base)/pym/portage/tests"; \
172 cd "$(srcdir)/pym/portage/tests"; \
173 install -m$(INSMODE) *.py \
174 "$(DESTDIR)$(portage_base)/pym/portage/tests"; \
175 install -d -m$(DIRMODE) \
176 "$(DESTDIR)$(portage_base)/pym/portage/tests/lint"; \
177 cd "$(srcdir)/pym/portage/tests/lint"; \
178 install -m$(INSMODE) *.py __test__ \
179 "$(DESTDIR)$(portage_base)/pym/portage/tests/lint"; \
181 install -d -m$(DIRMODE) "$(DESTDIR)$(docdir)"; \
183 install -m $(INSMODE) $(DOCS) "$(DESTDIR)$(docdir)"; \
185 for x in "" $(LINGUAS); do \
187 if [ -d "$(srcdir)/man/$$x" ]; then \
188 cd "$(srcdir)/man/$$x"; \
189 files=$$(echo *.$$y); \
190 if [ -z "$$files" ] || [ "$$files" = "*.$$y" ]; then \
193 install -d -m$(DIRMODE) "$(DESTDIR)$(mandir)/$$x/man$$y"; \
194 install -m$(INSMODE) *.$$y "$(DESTDIR)$(mandir)/$$x/man$$y"; \
199 if [ -f "$(srcdir)/doc/portage.html" ] ; then \
200 install -d -m$(DIRMODE) "$(DESTDIR)$(htmldir)"; \
201 cd "$(srcdir)/doc"; \
202 install -m$(INSMODE) *.html "$(DESTDIR)$(htmldir)"; \
205 if [ -d "$(WORKDIR)/epydoc" ] ; then \
206 install -d -m$(DIRMODE) "$(DESTDIR)$(htmldir)"; \
207 cp -pPR "$(WORKDIR)/epydoc" \
208 "$(DESTDIR)$(htmldir)/api"; \
209 cd "$(DESTDIR)$(htmldir)/api"; \
210 find . -type d | xargs chmod $(DIRMODE); \
211 find . -type f | xargs chmod $(INSMODE); \
216 $(MAKE) -C "$(srcdir)/doc" clean; \
217 rm -rf "$(srcdir)/pym/pysqlite2.py"* \
218 "$(WORKDIR)/epydoc"; \
220 .PHONY: all clean docbook epydoc install test