summaryrefslogtreecommitdiff
path: root/portage/Android.mk
blob: 90db66616bf527ea4f101d220161ed71923e9ff5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
LOCAL_PATH := $(call my-dir)

PORTAGE_PREFIX := $(LOCAL_PATH)/../../portage
BINDIR := $(PORTAGE_PREFIX)/usr/bin

define CREATE_WRAPPER
	$(hide)mkdir -p $(dir $@)
	$(hide)sed \
		-e 's:@ROOT_SUBDIR@:$(3RD_PARTY_ROOT_SUBDIR):g' \
		-e 's:@BIN@:$(BINDIR)/$(notdir $@):' \
		$< > $@.tmp \
		&& chmod a+rx $@.tmp && mv $@.tmp $@
endef

CBUILD = $(CLANG_CONFIG_$(HOST_ARCH)_HOST_TRIPLE)
CHOST  = $(CLANG_CONFIG_$(TARGET_ARCH)_TARGET_TRIPLE)

# Map android's arch naming to Gentoo's.
ANDROID_ARCH-mips64 = mips
ANDROID_ARCH-x86_64 = amd64
gentoo-arch = $(if $(ANDROID_ARCH-$(1)),$(ANDROID_ARCH-$(1)),$(1))
HOST_KEYWORD   := $(call gentoo-arch,$(HOST_ARCH))
TARGET_KEYWORD := $(call gentoo-arch,$(TARGET_ARCH))

# Common build doesn't set this up.
TARGET_RANLIB ?= $(TARGET_AR:ar=ranlib)

MAIN_OVERLAY_REPO := `readlink -f $(LOCAL_PATH)`/../../overlays/gentoo

include $(CLEAR_VARS)

#
# Create /etc/portage config files.
#

make.profile := $(3RD_PARTY_ROOT)/etc/portage/make.profile
$(make.profile):
	$(hide)mkdir -p $(dir $@)
	$(hide)ln -sfT \
		$(MAIN_OVERLAY_REPO)/profiles/default/linux/$(TARGET_KEYWORD) \
		$@

LOCAL_MODULE := make.conf
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(3RD_PARTY_ROOT)/etc/portage
3RD_PARTY_CONFIGS += $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)

include $(BUILD_SYSTEM)/base_rules.mk

make.conf := $(intermediates)/make.conf
$(make.conf): $(LOCAL_PATH)/make.conf.in $(make.profile)
	$(hide)mkdir -p $(dir $@)
	$(hide)sed \
		-e 's:@CC@:$(notdir $(3RD_PARTY_CC)):g' \
		-e 's:@CXX@:$(notdir $(3RD_PARTY_CXX)):g' \
		-e 's:@AR@:$(notdir $(TARGET_AR)):g' \
		-e 's:@RANLIB@:$(notdir $(TARGET_RANLIB)):g' \
		-e 's:@LD@:$(notdir $(TARGET_LD)):g' \
		-e 's:@OBJCOPY@:$(notdir $(TARGET_OBJCOPY)):g' \
		-e 's:@STRIP@:$(notdir $(TARGET_STRIP)):g' \
		-e 's:@READELF@:$(notdir $(TARGET_READELF)):g' \
		-e 's:@PKG_CONFIG@:$(notdir $(3RD_PARTY_PKG_CONFIG)):g' \
		-e 's:@ARCH@:$(TARGET_ARCH):g' \
		-e 's:@CBUILD@:$(CBUILD):g' \
		-e 's:@CHOST@:$(CHOST):g' \
		-e 's:@COMMON_OBJ@:$(if $(filter /%,$(TARGET_OUT_COMMON_GENTOO)),,$${ANDROID_BUILD_TOP}/)$(TARGET_OUT_COMMON_GENTOO):g' \
		-e 's:@PRODUCT_OBJ@:$${ANDROID_PRODUCT_OUT}/obj/gentoo:g' \
		-e 's:@PORTAGE_PREFIX@:$(PORTAGE_PREFIX):g' \
		-e 's:@LIBDIR@:$(3RD_PARTY_LIBDIR):' \
		$< > $@

include $(CLEAR_VARS)

LOCAL_MODULE := package.provided
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(3RD_PARTY_ROOT)/etc/portage/profile
3RD_PARTY_CONFIGS += $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)

include $(BUILD_SYSTEM)/base_rules.mk

package.provided := $(intermediates)/package.provided
$(package.provided): $(LOCAL_PATH)/package.provided.in
	$(hide)mkdir -p $(dir $@)
	$(hide)cp $< $@

include $(CLEAR_VARS)

LOCAL_MODULE := make.defaults
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(3RD_PARTY_ROOT)/etc/portage/profile
3RD_PARTY_CONFIGS += $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)

include $(BUILD_SYSTEM)/base_rules.mk

make.defaults := $(intermediates)/make.defaults
$(make.defaults): $(LOCAL_PATH)/make.defaults.in
	$(hide)mkdir -p $(dir $@)
	$(hide)cp $< $@

include $(CLEAR_VARS)

LOCAL_MODULE := package.use
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(3RD_PARTY_ROOT)/etc/portage/profile
3RD_PARTY_CONFIGS += $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)

include $(BUILD_SYSTEM)/base_rules.mk

package.use := $(intermediates)/$(LOCAL_MODULE)
$(package.use): $(LOCAL_PATH)/$(LOCAL_MODULE).in
	$(hide)mkdir -p $(dir $@)
	$(hide)cp $< $@

include $(CLEAR_VARS)

LOCAL_MODULE := use.force
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(3RD_PARTY_ROOT)/etc/portage/profile
3RD_PARTY_CONFIGS += $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)

include $(BUILD_SYSTEM)/base_rules.mk

use.force := $(intermediates)/$(LOCAL_MODULE)
$(use.force): $(LOCAL_PATH)/$(LOCAL_MODULE).in
	$(hide)mkdir -p $(dir $@)
	$(hide)cp $< $@

include $(CLEAR_VARS)

LOCAL_MODULE := use.mask
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(3RD_PARTY_ROOT)/etc/portage/profile
3RD_PARTY_CONFIGS += $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)

include $(BUILD_SYSTEM)/base_rules.mk

use.mask := $(intermediates)/$(LOCAL_MODULE)
$(use.mask): $(LOCAL_PATH)/$(LOCAL_MODULE).in
	$(hide)mkdir -p $(dir $@)
	$(hide)cp $< $@

include $(CLEAR_VARS)

LOCAL_MODULE := gentoo.conf
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(3RD_PARTY_ROOT)/etc/portage/repos.conf
3RD_PARTY_CONFIGS += $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)

include $(BUILD_SYSTEM)/base_rules.mk

gentoo.conf := $(intermediates)/gentoo.conf
$(gentoo.conf): $(LOCAL_PATH)/repos.conf.in
	$(hide)mkdir -p $(dir $@)
	$(hide)sed -e "s:@OVERLAY_LOCATION@:$(MAIN_OVERLAY_REPO):" $< > $@

#
# Create various bin/ wrappers.
# XXX: These contain product specific paths and should not.
#

include $(CLEAR_VARS)

LOCAL_MODULE := ebuild
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_IS_HOST_MODULE := true
3RD_PARTY_WRAPPERS += $(HOST_OUT_EXECUTABLES)/$(LOCAL_MODULE)

include $(BUILD_SYSTEM)/base_rules.mk

ebuild := $(intermediates)/$(LOCAL_MODULE)
$(ebuild): $(LOCAL_PATH)/wrapper.in
	$(CREATE_WRAPPER)

LOCAL_BUILT_MODULE := $(ebuild)

include $(CLEAR_VARS)

LOCAL_MODULE := emerge
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_IS_HOST_MODULE := true
3RD_PARTY_WRAPPERS += $(HOST_OUT_EXECUTABLES)/$(LOCAL_MODULE)

include $(BUILD_SYSTEM)/base_rules.mk

LOCAL_BUILT_MODULE := $(intermediates)/$(LOCAL_MODULE)
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/wrapper.in | $(patsubst %,$(HOST_OUT_EXECUTABLES)/%,ebuild portageq)
	$(CREATE_WRAPPER)

include $(CLEAR_VARS)

LOCAL_MODULE := portageq
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_IS_HOST_MODULE := true
3RD_PARTY_WRAPPERS += $(HOST_OUT_EXECUTABLES)/$(LOCAL_MODULE)

include $(BUILD_SYSTEM)/base_rules.mk

portageq := $(intermediates)/portageq
$(portageq): $(LOCAL_PATH)/wrapper.in
	$(CREATE_WRAPPER)

LOCAL_BUILT_MODULE := $(portageq)

include $(CLEAR_VARS)

LOCAL_MODULE := 3rd-party-merge
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_IS_HOST_MODULE := true
3RD_PARTY_WRAPPERS += $(HOST_OUT_EXECUTABLES)/$(LOCAL_MODULE)

include $(BUILD_SYSTEM)/base_rules.mk

LOCAL_BUILT_MODULE := $(intermediates)/$(LOCAL_MODULE)
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/wrapper.in
	$(CREATE_WRAPPER)