aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/android/Android.mk
blob: 2f2cf563697ae9d44f327dac8b9e3738c63b2854 (plain) (blame)
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
#
# Copyright (C) 2014 Trevor Drake
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#


# A bit of a non-standard LOCAL_PATH declaration here
# The Android.mk lives below the top source directory
# but LOCAL_PATH needs to point to the top of the module
# source tree to maintain the integrity of the intermediates
# directories
LOCAL_PATH := $(subst /contrib/android,,$(call my-dir))

libarchive_target_config := contrib/android/config/android.h

libarchive_src_files := libarchive/archive_acl.c \
						libarchive/archive_check_magic.c \
						libarchive/archive_cmdline.c \
						libarchive/archive_cryptor.c \
						libarchive/archive_digest.c \
						libarchive/archive_entry.c \
						libarchive/archive_entry_copy_stat.c \
						libarchive/archive_entry_link_resolver.c \
						libarchive/archive_entry_sparse.c \
						libarchive/archive_entry_stat.c \
						libarchive/archive_entry_strmode.c \
						libarchive/archive_entry_xattr.c \
						libarchive/archive_getdate.c \
						libarchive/archive_hmac.c \
						libarchive/archive_match.c \
						libarchive/archive_options.c \
						libarchive/archive_pack_dev.c \
						libarchive/archive_pathmatch.c \
						libarchive/archive_ppmd7.c \
						libarchive/archive_random.c \
						libarchive/archive_rb.c \
						libarchive/archive_read.c \
						libarchive/archive_read_add_passphrase.c \
						libarchive/archive_read_append_filter.c \
						libarchive/archive_read_data_into_fd.c \
						libarchive/archive_read_disk_entry_from_file.c \
						libarchive/archive_read_disk_posix.c \
						libarchive/archive_read_disk_set_standard_lookup.c \
						libarchive/archive_read_extract.c \
						libarchive/archive_read_extract2.c \
						libarchive/archive_read_open_fd.c \
						libarchive/archive_read_open_file.c \
						libarchive/archive_read_open_filename.c \
						libarchive/archive_read_open_memory.c \
						libarchive/archive_read_set_format.c \
						libarchive/archive_read_set_options.c \
						libarchive/archive_read_support_filter_all.c \
						libarchive/archive_read_support_filter_bzip2.c \
						libarchive/archive_read_support_filter_compress.c \
						libarchive/archive_read_support_filter_grzip.c \
						libarchive/archive_read_support_filter_gzip.c \
						libarchive/archive_read_support_filter_lrzip.c \
						libarchive/archive_read_support_filter_lz4.c \
						libarchive/archive_read_support_filter_lzop.c \
						libarchive/archive_read_support_filter_none.c \
						libarchive/archive_read_support_filter_program.c \
						libarchive/archive_read_support_filter_rpm.c \
						libarchive/archive_read_support_filter_uu.c \
						libarchive/archive_read_support_filter_xz.c \
						libarchive/archive_read_support_filter_zstd.c \
						libarchive/archive_read_support_format_7zip.c \
						libarchive/archive_read_support_format_all.c \
						libarchive/archive_read_support_format_ar.c \
						libarchive/archive_read_support_format_by_code.c \
						libarchive/archive_read_support_format_cab.c \
						libarchive/archive_read_support_format_cpio.c \
						libarchive/archive_read_support_format_empty.c \
						libarchive/archive_read_support_format_iso9660.c \
						libarchive/archive_read_support_format_lha.c \
						libarchive/archive_read_support_format_mtree.c \
						libarchive/archive_read_support_format_rar.c \
						libarchive/archive_read_support_format_raw.c \
						libarchive/archive_read_support_format_tar.c \
						libarchive/archive_read_support_format_warc.c \
						libarchive/archive_read_support_format_xar.c \
						libarchive/archive_read_support_format_zip.c \
						libarchive/archive_string.c \
						libarchive/archive_string_sprintf.c \
						libarchive/archive_util.c \
						libarchive/archive_virtual.c \
						libarchive/archive_write.c \
						libarchive/archive_write_disk_acl.c \
						libarchive/archive_write_disk_posix.c \
						libarchive/archive_write_disk_set_standard_lookup.c \
						libarchive/archive_write_open_fd.c \
						libarchive/archive_write_open_file.c \
						libarchive/archive_write_open_filename.c \
						libarchive/archive_write_open_memory.c \
						libarchive/archive_write_add_filter.c \
						libarchive/archive_write_add_filter_b64encode.c \
						libarchive/archive_write_add_filter_by_name.c \
						libarchive/archive_write_add_filter_bzip2.c \
						libarchive/archive_write_add_filter_compress.c \
						libarchive/archive_write_add_filter_grzip.c \
						libarchive/archive_write_add_filter_gzip.c \
						libarchive/archive_write_add_filter_lrzip.c \
						libarchive/archive_write_add_filter_lz4.c \
						libarchive/archive_write_add_filter_lzop.c \
						libarchive/archive_write_add_filter_none.c \
						libarchive/archive_write_add_filter_program.c \
						libarchive/archive_write_add_filter_uuencode.c \
						libarchive/archive_write_add_filter_xz.c \
						libarchive/archive_write_add_filter_zstd.c \
						libarchive/archive_write_set_format.c \
						libarchive/archive_write_set_format_7zip.c \
						libarchive/archive_write_set_format_ar.c \
						libarchive/archive_write_set_format_by_name.c \
						libarchive/archive_write_set_format_cpio.c \
						libarchive/archive_write_set_format_cpio_newc.c \
						libarchive/archive_write_set_format_iso9660.c \
						libarchive/archive_write_set_format_mtree.c \
						libarchive/archive_write_set_format_pax.c \
						libarchive/archive_write_set_format_raw.c \
						libarchive/archive_write_set_format_shar.c \
						libarchive/archive_write_set_format_ustar.c \
						libarchive/archive_write_set_format_v7tar.c \
						libarchive/archive_write_set_format_gnutar.c \
						libarchive/archive_write_set_format_warc.c \
						libarchive/archive_write_set_format_xar.c \
						libarchive/archive_write_set_format_zip.c \
						libarchive/archive_write_set_options.c \
						libarchive/archive_write_set_passphrase.c \
						libarchive/filter_fork_posix.c \
						libarchive/xxhash.c

ifeq ($(HOST_OS),windows)
libarchive_host_src_files := \
							libarchive/archive_entry_copy_bhfi.c \
							libarchive/archive_read_disk_windows.c \
							libarchive/archive_write_disk_windows.c \
							libarchive/filter_fork_windows.c \
							libarchive/archive_windows.c
else
libarchive_host_src_files :=
endif

libarchive_fe_src_files :=  libarchive_fe/err.c \
							libarchive_fe/line_reader.c \
							libarchive_fe/passphrase.c

bsdtar_src_files := tar/bsdtar.c \
					tar/bsdtar_windows.c \
					tar/cmdline.c \
					tar/creation_set.c \
					tar/read.c \
					tar/subst.c \
					tar/util.c \
					tar/write.c

bsdcpio_src_files := cpio/cmdline.c \
					cpio/cpio.c

bsdcat_src_files := cat/cmdline.c \
					cat/bsdcat.c


ifeq ($(HOST_OS),darwin)
$(warning Host : $(HOST_OS) Not Supported. Host Build Will Be Skipped )
else
libarchive_host_config := contrib/android/config/$(HOST_OS)_host.h

include $(CLEAR_VARS)
LOCAL_MODULE := libarchive
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(libarchive_src_files) $(libarchive_host_src_files)
LOCAL_CFLAGS := -DPLATFORM_CONFIG_H=\"$(libarchive_host_config)\"
LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libarchive
include $(BUILD_HOST_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libarchive
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS := -DPLATFORM_CONFIG_H=\"$(libarchive_host_config)\"
LOCAL_SHARED_LIBRARIES := libz-host
LOCAL_WHOLE_STATIC_LIBRARIES := libarchive
LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libarchive
include $(BUILD_HOST_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libarchive_fe
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS := -DPLATFORM_CONFIG_H=\"$(libarchive_host_config)\"
LOCAL_SRC_FILES := $(libarchive_fe_src_files)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libarchive_fe
include $(BUILD_HOST_STATIC_LIBRARY)

endif


# Do not build target binaries if we are not targeting linux
# on the host
ifeq ($(HOST_OS),linux)

include $(CLEAR_VARS)
LOCAL_MODULE := bsdtar
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS :=  -DBSDTAR_VERSION_STRING=ARCHIVE_VERSION_ONLY_STRING -DPLATFORM_CONFIG_H=\"$(libarchive_host_config)\"
LOCAL_SHARED_LIBRARIES := libz-host
LOCAL_STATIC_LIBRARIES := libarchive libarchive_fe
LOCAL_SRC_FILES := $(bsdtar_src_files)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include
include $(BUILD_HOST_EXECUTABLE)

include $(CLEAR_VARS)
LOCAL_MODULE := bsdcpio
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS :=  -DBSDCPIO_VERSION_STRING=ARCHIVE_VERSION_ONLY_STRING -DPLATFORM_CONFIG_H=\"$(libarchive_host_config)\"
LOCAL_SHARED_LIBRARIES := libz-host
LOCAL_STATIC_LIBRARIES := libarchive libarchive_fe
LOCAL_SRC_FILES := $(bsdcpio_src_files)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include
include $(BUILD_HOST_EXECUTABLE)

include $(CLEAR_VARS)
LOCAL_MODULE := bsdcat
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS := -DBSDCAT_VERSION_STRING=ARCHIVE_VERSION_ONLY_STRING -DPLATFORM_CONFIG_H=\"$(libarchive_host_config)\"
LOCAL_SHARED_LIBRARIES := libz-host
LOCAL_STATIC_LIBRARIES := libarchive libarchive_fe
LOCAL_SRC_FILES := $(bsdcat_src_files)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include
include $(BUILD_HOST_EXECUTABLE)



include $(CLEAR_VARS)
LOCAL_MODULE := libarchive
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(libarchive_src_files)
LOCAL_STATIC_LIBRARIES := libz liblz4
LOCAL_CFLAGS := -DPLATFORM_CONFIG_H=\"$(libarchive_target_config)\"
LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libarchive
include $(BUILD_STATIC_LIBRARY)


include $(CLEAR_VARS)
LOCAL_MODULE := libarchive
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES :=
LOCAL_CFLAGS := -DPLATFORM_CONFIG_H=\"$(libarchive_target_config)\"
LOCAL_SHARED_LIBRARIES := libz
LOCAL_WHOLE_STATIC_LIBRARIES := libarchive
LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libarchive
include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libarchive_fe
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS := -DPLATFORM_CONFIG_H=\"$(libarchive_target_config)\"
LOCAL_SRC_FILES := $(libarchive_fe_src_files)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libarchive_fe
include $(BUILD_STATIC_LIBRARY)


include $(CLEAR_VARS)
LOCAL_MODULE := bsdtar
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS :=  -DBSDTAR_VERSION_STRING=ARCHIVE_VERSION_ONLY_STRING -DPLATFORM_CONFIG_H=\"$(libarchive_target_config)\"
LOCAL_SHARED_LIBRARIES := libz
LOCAL_STATIC_LIBRARIES := libarchive libarchive_fe
LOCAL_SRC_FILES := $(bsdtar_src_files)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/libarchive $(LOCAL_PATH)/libarchive_fe $(LOCAL_PATH)/contrib/android/include
include $(BUILD_EXECUTABLE)

include $(CLEAR_VARS)
LOCAL_MODULE := bsdcpio
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS :=  -DBSDCPIO_VERSION_STRING=ARCHIVE_VERSION_ONLY_STRING -DPLATFORM_CONFIG_H=\"$(libarchive_target_config)\"
LOCAL_SHARED_LIBRARIES := libz
LOCAL_STATIC_LIBRARIES := libarchive libarchive_fe
LOCAL_SRC_FILES := $(bsdcpio_src_files)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/libarchive $(LOCAL_PATH)/libarchive_fe $(LOCAL_PATH)/contrib/android/include
include $(BUILD_EXECUTABLE)

include $(CLEAR_VARS)
LOCAL_MODULE := bsdcat
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS := -DBSDCAT_VERSION_STRING=ARCHIVE_VERSION_ONLY_STRING -DPLATFORM_CONFIG_H=\"$(libarchive_target_config)\"
LOCAL_SHARED_LIBRARIES := libz
LOCAL_STATIC_LIBRARIES := libarchive libarchive_fe
LOCAL_SRC_FILES := $(bsdcat_src_files)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/libarchive $(LOCAL_PATH)/libarchive_fe $(LOCAL_PATH)/contrib/android/include
include $(BUILD_EXECUTABLE)

endif