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 env PYTHONPATH="$(PYTHONPATH)" epydoc \
55 -o "$(WORKDIR)/epydoc" \
59 $$(cd "$(srcdir)" && find pym -name '*.py' | sed \
60 -e s:/__init__.py$$:: \
65 rm -f "$(WORKDIR)/epydoc/api-objects.txt"; \
69 "$(srcdir)/pym/portage/tests/runTests"; \
74 install -d -m$(DIRMODE) "$(DESTDIR)$(sysconfdir)"; \
75 install -m$(INSMODE) $(SYSCONFDIR_FILES) "$(DESTDIR)$(sysconfdir)"; \
77 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_confdir)"; \
79 install -m$(INSMODE) $(PORTAGE_CONFDIR_FILES) \
80 "$(DESTDIR)$(portage_confdir)"; \
81 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_setsdir)"; \
83 install -m$(INSMODE) *.conf "$(DESTDIR)$(portage_setsdir)"; \
85 install -d -m$(DIRMODE) "$(DESTDIR)$(sysconfdir)/logrotate.d"; \
86 cd "$(srcdir)/cnf/logrotate.d"; \
87 install -m$(INSMODE) $(LOGROTATE_FILES) \
88 "$(DESTDIR)$(sysconfdir)/logrotate.d"; \
90 for x in $$(cd "$(srcdir)" && find bin -type d) ; do \
92 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_base)/$$x"; \
93 files=$$(find . -mindepth 1 -maxdepth 1 -type f ! -type l); \
94 if [ -n "$$files" ] ; then \
95 install -m$(EXEMODE) $$files \
96 "$(DESTDIR)$(portage_base)/$$x"; \
98 symlinks=$$(find . -mindepth 1 -maxdepth 1 -type l); \
99 if [ -n "$$symlinks" ] ; then \
100 cp -P $$symlinks "$(DESTDIR)$(portage_base)/$$x"; \
104 for x in $$(cd "$(srcdir)" && find pym/* -type d \
105 ! -path "pym/portage/tests*") ; do \
106 cd "$(srcdir)/$$x"; \
107 files=$$(echo *.py); \
108 if [ -z "$$files" ] || [ "$$files" = "*.py" ]; then \
109 # __pycache__ directories contain no py files \
112 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_base)/$$x"; \
113 install -m$(INSMODE) $$files "$(DESTDIR)$(portage_base)/$$x"; \
116 install -d -m$(DIRMODE) "$(DESTDIR)$(bindir)"; \
117 relative_path=".."; \
119 y="$(portage_base)"; \
120 if [ "$${x#$(prefix)}" != "$$x" ] && \
121 [ "$${y#$(prefix)}" != "$$y" ]; then \
126 while [ -n "$$x" ] ; do \
127 relative_path=$${relative_path}/..; \
130 relative_path=$$relative_path$$y; \
131 for x in $(BINDIR_FILES) ; do \
132 ln -sf "$$relative_path/bin/$$x" \
133 "$(DESTDIR)$(bindir)/$$x"; \
136 install -d -m$(DIRMODE) "$(DESTDIR)$(sbindir)"; \
137 relative_path=".."; \
139 y="$(portage_base)"; \
140 if [ "$${x#$(prefix)}" != "$$x" ] && \
141 [ "$${y#$(prefix)}" != "$$y" ]; then \
146 while [ -n "$$x" ] ; do \
147 relative_path=$${relative_path}/..; \
150 relative_path=$$relative_path$$y; \
151 for x in $(SBINDIR_FILES) ; do \
152 ln -sf "$$relative_path/bin/$$x" \
153 "$(DESTDIR)$(sbindir)/$$x"; \
156 ln -sf "$$relative_path/bin/env-update" \
157 "$(DESTDIR)$(sbindir)/update-env"; \
158 ln -sf "$$relative_path/bin/etc-update" \
159 "$(DESTDIR)$(sbindir)/update-etc"; \
161 # We install some minimal tests for use as a preinst sanity check. \
162 # These tests must be able to run without a full source tree and \
163 # without relying on a previous portage instance being installed. \
164 install -d -m$(DIRMODE) \
165 "$(DESTDIR)$(portage_base)/pym/portage/tests"; \
166 install -m$(EXEMODE) "$(srcdir)/pym/portage/tests/runTests" \
167 "$(DESTDIR)$(portage_base)/pym/portage/tests"; \
168 cd "$(srcdir)/pym/portage/tests"; \
169 install -m$(INSMODE) *.py \
170 "$(DESTDIR)$(portage_base)/pym/portage/tests"; \
171 install -d -m$(DIRMODE) \
172 "$(DESTDIR)$(portage_base)/pym/portage/tests/lint"; \
173 cd "$(srcdir)/pym/portage/tests/lint"; \
174 install -m$(INSMODE) *.py __test__ \
175 "$(DESTDIR)$(portage_base)/pym/portage/tests/lint"; \
177 install -d -m$(DIRMODE) "$(DESTDIR)$(docdir)"; \
179 install -m $(INSMODE) $(DOCS) "$(DESTDIR)$(docdir)"; \
181 for x in "" $(LINGUAS); do \
183 if [ -d "$(srcdir)/man/$$x" ]; then \
184 cd "$(srcdir)/man/$$x"; \
185 files=$$(echo *.$$y); \
186 if [ -z "$$files" ] || [ "$$files" = "*.$$y" ]; then \
189 install -d -m$(DIRMODE) "$(DESTDIR)$(mandir)/$$x/man$$y"; \
190 install -m$(INSMODE) *.$$y "$(DESTDIR)$(mandir)/$$x/man$$y"; \
195 if [ -f "$(srcdir)/doc/portage.html" ] ; then \
196 install -d -m$(DIRMODE) "$(DESTDIR)$(htmldir)"; \
197 cd "$(srcdir)/doc"; \
198 install -m$(INSMODE) *.html "$(DESTDIR)$(htmldir)"; \
201 if [ -d "$(WORKDIR)/epydoc" ] ; then \
202 install -d -m$(DIRMODE) "$(DESTDIR)$(htmldir)"; \
203 cp -pPR "$(WORKDIR)/epydoc" \
204 "$(DESTDIR)$(htmldir)/api"; \
205 cd "$(DESTDIR)$(htmldir)/api"; \
206 find . -type d | xargs chmod $(DIRMODE); \
207 find . -type f | xargs chmod $(INSMODE); \
212 $(MAKE) -C "$(srcdir)/doc" clean; \
213 rm -rf "$(WORKDIR)/epydoc"; \
215 .PHONY: all clean docbook epydoc install test