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.globals
31 LOGROTATE_FILES = elog-save-summary
32 BINDIR_FILES = ebuild egencache emerge emerge-webrsync \
33 portageq quickpkg repoman
34 SBINDIR_FILES = archive-conf dispatch-conf emaint \
35 env-update etc-update fixpackages regenworld
36 DOCS = ChangeLog NEWS RELEASE-NOTES
39 PYTHONPATH := $(srcdir)/pym:$(PYTHONPATH)
41 PYTHONPATH := $(srcdir)/pym
48 touch "$(srcdir)/doc/fragment/date"; \
49 $(MAKE) -C "$(srcdir)/doc" xhtml xhtml-nochunks
53 # workaround for bug 282760 \
54 touch "$(srcdir)/pym/pysqlite2.py"; \
55 env PYTHONPATH="$(PYTHONPATH)" epydoc \
56 -o "$(WORKDIR)/epydoc" \
60 $$(cd "$(srcdir)" && find pym -name '*.py' | sed \
61 -e s:/__init__.py$$:: \
66 rm -f "$(srcdir)/pym/pysqlite2.py"* \
67 "$(WORKDIR)/epydoc/pysqlite2-"* \
68 "$(WORKDIR)/epydoc/api-objects.txt"; \
72 "$(srcdir)/pym/portage/tests/runTests"; \
77 install -d -m$(DIRMODE) "$(DESTDIR)$(sysconfdir)"; \
78 install -m$(INSMODE) $(SYSCONFDIR_FILES) "$(DESTDIR)$(sysconfdir)"; \
80 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_confdir)"; \
82 install -m$(INSMODE) $(PORTAGE_CONFDIR_FILES) \
83 "$(DESTDIR)$(portage_confdir)"; \
84 install -m$(INSMODE) "$(srcdir)/cnf/make.conf" \
85 "$(DESTDIR)$(portage_confdir)/make.conf.example"; \
87 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_setsdir)"; \
89 install -m$(INSMODE) *.conf "$(DESTDIR)$(portage_setsdir)"; \
91 install -d -m$(DIRMODE) "$(DESTDIR)$(sysconfdir)/logrotate.d"; \
92 cd "$(srcdir)/cnf/logrotate.d"; \
93 install -m$(INSMODE) $(LOGROTATE_FILES) \
94 "$(DESTDIR)$(sysconfdir)/logrotate.d"; \
96 for x in $$(cd "$(srcdir)" && find bin -type d) ; do \
98 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_base)/$$x"; \
99 files=$$(find . -mindepth 1 -maxdepth 1 -type f ! -type l); \
100 if [ -n "$$files" ] ; then \
101 install -m$(EXEMODE) $$files \
102 "$(DESTDIR)$(portage_base)/$$x"; \
104 symlinks=$$(find . -mindepth 1 -maxdepth 1 -type l); \
105 if [ -n "$$symlinks" ] ; then \
106 cp -P $$symlinks "$(DESTDIR)$(portage_base)/$$x"; \
110 for x in $$(cd "$(srcdir)" && find pym/* -type d \
111 ! -path "pym/portage/tests*") ; do \
112 cd "$(srcdir)/$$x"; \
113 files=$$(echo *.py); \
114 if [ -z "$$files" ] || [ "$$files" = "*.py" ]; then \
115 # __pycache__ directories contain no py files \
118 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_base)/$$x"; \
119 install -m$(INSMODE) $$files "$(DESTDIR)$(portage_base)/$$x"; \
122 install -d -m$(DIRMODE) "$(DESTDIR)$(bindir)"; \
123 relative_path=".."; \
125 y="$(portage_base)"; \
126 if [ "$${x#$(prefix)}" != "$$x" ] && \
127 [ "$${y#$(prefix)}" != "$$y" ]; then \
132 while [ -n "$$x" ] ; do \
133 relative_path=$${relative_path}/..; \
136 relative_path=$$relative_path$$y; \
137 for x in $(BINDIR_FILES) ; do \
138 ln -sf "$$relative_path/bin/$$x" \
139 "$(DESTDIR)$(bindir)/$$x"; \
142 install -d -m$(DIRMODE) "$(DESTDIR)$(sbindir)"; \
143 relative_path=".."; \
145 y="$(portage_base)"; \
146 if [ "$${x#$(prefix)}" != "$$x" ] && \
147 [ "$${y#$(prefix)}" != "$$y" ]; then \
152 while [ -n "$$x" ] ; do \
153 relative_path=$${relative_path}/..; \
156 relative_path=$$relative_path$$y; \
157 for x in $(SBINDIR_FILES) ; do \
158 ln -sf "$$relative_path/bin/$$x" \
159 "$(DESTDIR)$(sbindir)/$$x"; \
162 ln -sf "$$relative_path/bin/env-update" \
163 "$(DESTDIR)$(sbindir)/update-env"; \
164 ln -sf "$$relative_path/bin/etc-update" \
165 "$(DESTDIR)$(sbindir)/update-etc"; \
167 # We install some minimal tests for use as a preinst sanity check. \
168 # These tests must be able to run without a full source tree and \
169 # without relying on a previous portage instance being installed. \
170 install -d -m$(DIRMODE) \
171 "$(DESTDIR)$(portage_base)/pym/portage/tests"; \
172 install -m$(EXEMODE) "$(srcdir)/pym/portage/tests/runTests" \
173 "$(DESTDIR)$(portage_base)/pym/portage/tests"; \
174 cd "$(srcdir)/pym/portage/tests"; \
175 install -m$(INSMODE) *.py \
176 "$(DESTDIR)$(portage_base)/pym/portage/tests"; \
177 install -d -m$(DIRMODE) \
178 "$(DESTDIR)$(portage_base)/pym/portage/tests/lint"; \
179 cd "$(srcdir)/pym/portage/tests/lint"; \
180 install -m$(INSMODE) *.py __test__ \
181 "$(DESTDIR)$(portage_base)/pym/portage/tests/lint"; \
183 install -d -m$(DIRMODE) "$(DESTDIR)$(docdir)"; \
185 install -m $(INSMODE) $(DOCS) "$(DESTDIR)$(docdir)"; \
188 install -d -m$(DIRMODE) "$(DESTDIR)$(mandir)/man$$x"; \
189 cd "$(srcdir)/man"; \
190 install -m$(INSMODE) *.$$x "$(DESTDIR)$(mandir)/man$$x"; \
193 if [ -f "$(srcdir)/doc/portage.html" ] ; then \
194 install -d -m$(DIRMODE) "$(DESTDIR)$(htmldir)"; \
195 cd "$(srcdir)/doc"; \
196 install -m$(INSMODE) *.html "$(DESTDIR)$(htmldir)"; \
199 if [ -d "$(WORKDIR)/epydoc" ] ; then \
200 install -d -m$(DIRMODE) "$(DESTDIR)$(htmldir)"; \
201 cp -pPR "$(WORKDIR)/epydoc" \
202 "$(DESTDIR)$(htmldir)/api"; \
203 cd "$(DESTDIR)$(htmldir)/api"; \
204 find . -type d | xargs chmod $(DIRMODE); \
205 find . -type f | xargs chmod $(INSMODE); \
210 $(MAKE) -C "$(srcdir)/doc" clean; \
211 rm -rf "$(srcdir)/pym/pysqlite2.py"* \
212 "$(WORKDIR)/epydoc"; \
214 .PHONY: all clean docbook epydoc install test