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 ln -sf "..$(portage_confdir)/make.globals" "$(DESTDIR)$(sysconfdir)"; \
85 install -m$(INSMODE) "$(srcdir)/cnf/make.conf" \
86 "$(DESTDIR)$(portage_confdir)/make.conf.example"; \
88 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_setsdir)"; \
90 install -m$(INSMODE) *.conf "$(DESTDIR)$(portage_setsdir)"; \
92 install -d -m$(DIRMODE) "$(DESTDIR)$(sysconfdir)/logrotate.d"; \
93 cd "$(srcdir)/cnf/logrotate.d"; \
94 install -m$(INSMODE) $(LOGROTATE_FILES) \
95 "$(DESTDIR)$(sysconfdir)/logrotate.d"; \
97 for x in $$(cd "$(srcdir)" && find bin -type d) ; do \
99 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_base)/$$x"; \
100 files=$$(find . -mindepth 1 -maxdepth 1 -type f ! -type l); \
101 if [ -n "$$files" ] ; then \
102 install -m$(EXEMODE) $$files \
103 "$(DESTDIR)$(portage_base)/$$x"; \
105 symlinks=$$(find . -mindepth 1 -maxdepth 1 -type l); \
106 if [ -n "$$symlinks" ] ; then \
107 cp -P $$symlinks "$(DESTDIR)$(portage_base)/$$x"; \
111 for x in $$(cd "$(srcdir)" && find pym/* -type d \
112 ! -path "pym/portage/tests*") ; do \
113 cd "$(srcdir)/$$x"; \
114 files=$$(echo *.py); \
115 if [ -z "$$files" ] || [ "$$files" = "*.py" ]; then \
116 # __pycache__ directories contain no py files \
119 install -d -m$(DIRMODE) "$(DESTDIR)$(portage_base)/$$x"; \
120 install -m$(INSMODE) $$files "$(DESTDIR)$(portage_base)/$$x"; \
123 install -d -m$(DIRMODE) "$(DESTDIR)$(bindir)"; \
124 relative_path=".."; \
126 y="$(portage_base)"; \
127 if [ "$${x#$(prefix)}" != "$$x" ] && \
128 [ "$${y#$(prefix)}" != "$$y" ]; then \
133 while [ -n "$$x" ] ; do \
134 relative_path=$${relative_path}/..; \
137 relative_path=$$relative_path$$y; \
138 for x in $(BINDIR_FILES) ; do \
139 ln -sf "$$relative_path/bin/$$x" \
140 "$(DESTDIR)$(bindir)/$$x"; \
143 install -d -m$(DIRMODE) "$(DESTDIR)$(sbindir)"; \
144 relative_path=".."; \
146 y="$(portage_base)"; \
147 if [ "$${x#$(prefix)}" != "$$x" ] && \
148 [ "$${y#$(prefix)}" != "$$y" ]; then \
153 while [ -n "$$x" ] ; do \
154 relative_path=$${relative_path}/..; \
157 relative_path=$$relative_path$$y; \
158 for x in $(SBINDIR_FILES) ; do \
159 ln -sf "$$relative_path/bin/$$x" \
160 "$(DESTDIR)$(sbindir)/$$x"; \
163 ln -sf "$$relative_path/bin/env-update" \
164 "$(DESTDIR)$(sbindir)/update-env"; \
165 ln -sf "$$relative_path/bin/etc-update" \
166 "$(DESTDIR)$(sbindir)/update-etc"; \
168 # We install some minimal tests for use as a preinst sanity check. \
169 # These tests must be able to run without a full source tree and \
170 # without relying on a previous portage instance being installed. \
171 install -d -m$(DIRMODE) \
172 "$(DESTDIR)$(portage_base)/pym/portage/tests"; \
173 install -m$(EXEMODE) "$(srcdir)/pym/portage/tests/runTests" \
174 "$(DESTDIR)$(portage_base)/pym/portage/tests"; \
175 cd "$(srcdir)/pym/portage/tests"; \
176 install -m$(INSMODE) *.py \
177 "$(DESTDIR)$(portage_base)/pym/portage/tests"; \
178 install -d -m$(DIRMODE) \
179 "$(DESTDIR)$(portage_base)/pym/portage/tests/lint"; \
180 cd "$(srcdir)/pym/portage/tests/lint"; \
181 install -m$(INSMODE) *.py __test__ \
182 "$(DESTDIR)$(portage_base)/pym/portage/tests/lint"; \
184 install -d -m$(DIRMODE) "$(DESTDIR)$(docdir)"; \
186 install -m $(INSMODE) $(DOCS) "$(DESTDIR)$(docdir)"; \
189 install -d -m$(DIRMODE) "$(DESTDIR)$(mandir)/man$$x"; \
190 cd "$(srcdir)/man"; \
191 install -m$(INSMODE) *.$$x "$(DESTDIR)$(mandir)/man$$x"; \
194 if [ -f "$(srcdir)/doc/portage.html" ] ; then \
195 install -d -m$(DIRMODE) "$(DESTDIR)$(htmldir)"; \
196 cd "$(srcdir)/doc"; \
197 install -m$(INSMODE) *.html "$(DESTDIR)$(htmldir)"; \
200 if [ -d "$(WORKDIR)/epydoc" ] ; then \
201 install -d -m$(DIRMODE) "$(DESTDIR)$(htmldir)"; \
202 cp -pPR "$(WORKDIR)/epydoc" \
203 "$(DESTDIR)$(htmldir)/api"; \
204 cd "$(DESTDIR)$(htmldir)/api"; \
205 find . -type d | xargs chmod $(DIRMODE); \
206 find . -type f | xargs chmod $(INSMODE); \
211 $(MAKE) -C "$(srcdir)/doc" clean; \
212 rm -rf "$(srcdir)/pym/pysqlite2.py"* \
213 "$(WORKDIR)/epydoc"; \
215 .PHONY: all clean docbook epydoc install test