1# $FreeBSD$
2.include <bsd.own.mk>
3
4LIBARCHIVEDIR=	${.CURDIR}/../../contrib/libarchive
5
6LIB=	archive
7DPADD=	${LIBZ}
8LDADD=	-lz
9
10DPADD+= ${LIBBZ2}
11LDADD+= -lbz2
12CFLAGS+= -DHAVE_BZLIB_H=1
13
14DPADD+= ${LIBLZMA}
15LDADD+= -llzma
16CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1
17
18DPADD+= ${LIBBSDXML}
19LDADD+= -lbsdxml
20
21# FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system.
22# It has no real relation to the libarchive version number.
23SHLIB_MAJOR= 5
24
25CFLAGS+=	-DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\"
26CFLAGS+=	-I${.OBJDIR}
27
28.if ${MK_OPENSSL} != "no"
29CFLAGS+=	-DWITH_OPENSSL
30DPADD+=	${LIBCRYPTO}
31LDADD+=	-lcrypto
32.else
33DPADD+=	${LIBMD}
34LDADD+=	-lmd
35.endif
36
37.PATH: ${LIBARCHIVEDIR}/libarchive
38
39# Headers to be installed in /usr/include
40INCS=	archive.h archive_entry.h
41
42# Sources to be compiled.
43SRCS=	archive_check_magic.c				\
44	archive_entry.c					\
45	archive_entry_copy_stat.c			\
46	archive_entry_stat.c				\
47	archive_entry_strmode.c				\
48	archive_entry_link_resolver.c			\
49	archive_entry_xattr.c				\
50	archive_read.c					\
51	archive_read_data_into_fd.c			\
52	archive_read_disk.c				\
53	archive_read_disk_entry_from_file.c		\
54	archive_read_disk_set_standard_lookup.c		\
55	archive_read_extract.c				\
56	archive_read_open_fd.c				\
57	archive_read_open_file.c			\
58	archive_read_open_filename.c			\
59	archive_read_open_memory.c			\
60	archive_read_support_compression_all.c		\
61	archive_read_support_compression_bzip2.c	\
62	archive_read_support_compression_compress.c	\
63	archive_read_support_compression_gzip.c		\
64	archive_read_support_compression_none.c		\
65	archive_read_support_compression_program.c	\
66	archive_read_support_compression_rpm.c		\
67	archive_read_support_compression_uu.c		\
68	archive_read_support_compression_xz.c		\
69	archive_read_support_format_all.c		\
70	archive_read_support_format_ar.c		\
71	archive_read_support_format_cpio.c		\
72	archive_read_support_format_empty.c		\
73	archive_read_support_format_iso9660.c		\
74	archive_read_support_format_mtree.c		\
75	archive_read_support_format_raw.c		\
76	archive_read_support_format_tar.c		\
77	archive_read_support_format_xar.c		\
78	archive_read_support_format_zip.c		\
79	archive_string.c				\
80	archive_string_sprintf.c			\
81	archive_util.c					\
82	archive_virtual.c				\
83	archive_write.c					\
84	archive_write_disk.c				\
85	archive_write_disk_set_standard_lookup.c	\
86	archive_write_open_fd.c				\
87	archive_write_open_file.c			\
88	archive_write_open_filename.c			\
89	archive_write_open_memory.c			\
90	archive_write_set_compression_bzip2.c		\
91	archive_write_set_compression_compress.c	\
92	archive_write_set_compression_gzip.c		\
93	archive_write_set_compression_none.c		\
94	archive_write_set_compression_program.c		\
95	archive_write_set_compression_xz.c		\
96	archive_write_set_format.c			\
97	archive_write_set_format_ar.c			\
98	archive_write_set_format_by_name.c		\
99	archive_write_set_format_cpio.c			\
100	archive_write_set_format_cpio_newc.c		\
101	archive_write_set_format_mtree.c		\
102	archive_write_set_format_pax.c			\
103	archive_write_set_format_shar.c			\
104	archive_write_set_format_ustar.c		\
105	archive_write_set_format_zip.c			\
106	filter_fork.c
107
108# Man pages to be installed.
109MAN=	archive_entry.3					\
110	archive_read.3					\
111	archive_read_disk.3				\
112	archive_util.3					\
113	archive_write.3					\
114	archive_write_disk.3				\
115	cpio.5						\
116	libarchive.3					\
117	libarchive-formats.5				\
118	tar.5
119
120# Symlink the man pages under each function name.
121MLINKS+=	archive_entry.3 archive_entry_acl_add_entry.3
122MLINKS+=	archive_entry.3 archive_entry_acl_add_entry_w.3
123MLINKS+=	archive_entry.3 archive_entry_acl_clear.3
124MLINKS+=	archive_entry.3 archive_entry_acl_count.3
125MLINKS+=	archive_entry.3 archive_entry_acl_next.3
126MLINKS+=	archive_entry.3 archive_entry_acl_next_w.3
127MLINKS+=	archive_entry.3 archive_entry_acl_reset.3
128MLINKS+=	archive_entry.3 archive_entry_acl_text_w.3
129MLINKS+=	archive_entry.3 archive_entry_clear.3
130MLINKS+=	archive_entry.3 archive_entry_clone.3
131MLINKS+=	archive_entry.3 archive_entry_copy_fflags_text.3
132MLINKS+=	archive_entry.3 archive_entry_copy_fflags_text_w.3
133MLINKS+=	archive_entry.3 archive_entry_copy_gname.3
134MLINKS+=	archive_entry.3 archive_entry_copy_gname_w.3
135MLINKS+=	archive_entry.3 archive_entry_copy_hardlink_w.3
136MLINKS+=	archive_entry.3 archive_entry_copy_link.3
137MLINKS+=	archive_entry.3 archive_entry_copy_link_w.3
138MLINKS+=	archive_entry.3 archive_entry_copy_pathname_w.3
139MLINKS+=	archive_entry.3 archive_entry_copy_stat.3
140MLINKS+=	archive_entry.3 archive_entry_copy_symlink_w.3
141MLINKS+=	archive_entry.3 archive_entry_copy_uname.3
142MLINKS+=	archive_entry.3 archive_entry_copy_uname_w.3
143MLINKS+=	archive_entry.3 archive_entry_dev.3
144MLINKS+=	archive_entry.3 archive_entry_devmajor.3
145MLINKS+=	archive_entry.3 archive_entry_devminor.3
146MLINKS+=	archive_entry.3 archive_entry_filetype.3
147MLINKS+=	archive_entry.3 archive_entry_fflags.3
148MLINKS+=	archive_entry.3 archive_entry_fflags_text.3
149MLINKS+=	archive_entry.3 archive_entry_free.3
150MLINKS+=	archive_entry.3 archive_entry_gid.3
151MLINKS+=	archive_entry.3 archive_entry_gname.3
152MLINKS+=	archive_entry.3 archive_entry_gname_w.3
153MLINKS+=	archive_entry.3 archive_entry_hardlink.3
154MLINKS+=	archive_entry.3 archive_entry_ino.3
155MLINKS+=	archive_entry.3 archive_entry_mode.3
156MLINKS+=	archive_entry.3 archive_entry_mtime.3
157MLINKS+=	archive_entry.3 archive_entry_mtime_nsec.3
158MLINKS+=	archive_entry.3 archive_entry_nlink.3
159MLINKS+=	archive_entry.3 archive_entry_new.3
160MLINKS+=	archive_entry.3 archive_entry_pathname.3
161MLINKS+=	archive_entry.3 archive_entry_pathname_w.3
162MLINKS+=	archive_entry.3 archive_entry_rdev.3
163MLINKS+=	archive_entry.3 archive_entry_rdevmajor.3
164MLINKS+=	archive_entry.3 archive_entry_rdevminor.3
165MLINKS+=	archive_entry.3 archive_entry_set_atime.3
166MLINKS+=	archive_entry.3 archive_entry_set_ctime.3
167MLINKS+=	archive_entry.3 archive_entry_set_dev.3
168MLINKS+=	archive_entry.3 archive_entry_set_devmajor.3
169MLINKS+=	archive_entry.3 archive_entry_set_devminor.3
170MLINKS+=	archive_entry.3 archive_entry_set_fflags.3
171MLINKS+=	archive_entry.3 archive_entry_set_gid.3
172MLINKS+=	archive_entry.3 archive_entry_set_gname.3
173MLINKS+=	archive_entry.3 archive_entry_set_hardlink.3
174MLINKS+=	archive_entry.3 archive_entry_set_link.3
175MLINKS+=	archive_entry.3 archive_entry_set_mode.3
176MLINKS+=	archive_entry.3 archive_entry_set_mtime.3
177MLINKS+=	archive_entry.3 archive_entry_set_nlink.3
178MLINKS+=	archive_entry.3 archive_entry_set_pathname.3
179MLINKS+=	archive_entry.3 archive_entry_set_rdev.3
180MLINKS+=	archive_entry.3 archive_entry_set_rdevmajor.3
181MLINKS+=	archive_entry.3 archive_entry_set_rdevminor.3
182MLINKS+=	archive_entry.3 archive_entry_set_size.3
183MLINKS+=	archive_entry.3 archive_entry_set_symlink.3
184MLINKS+=	archive_entry.3 archive_entry_set_uid.3
185MLINKS+=	archive_entry.3 archive_entry_set_uname.3
186MLINKS+=	archive_entry.3 archive_entry_size.3
187MLINKS+=	archive_entry.3 archive_entry_stat.3
188MLINKS+=	archive_entry.3 archive_entry_symlink.3
189MLINKS+=	archive_entry.3 archive_entry_uid.3
190MLINKS+=	archive_entry.3 archive_entry_uname.3
191MLINKS+=	archive_entry.3 archive_entry_uname_w.3
192MLINKS+=	archive_read.3 archive_read_data.3
193MLINKS+=	archive_read.3 archive_read_data_block.3
194MLINKS+=	archive_read.3 archive_read_data_into_buffer.3
195MLINKS+=	archive_read.3 archive_read_data_into_fd.3
196MLINKS+=	archive_read.3 archive_read_data_skip.3
197MLINKS+=	archive_read.3 archive_read_extract.3
198MLINKS+=	archive_read.3 archive_read_extract_set_progress_callback.3
199MLINKS+=	archive_read.3 archive_read_extract_set_skip_file.3
200MLINKS+=	archive_read.3 archive_read_finish.3
201MLINKS+=	archive_read.3 archive_read_new.3
202MLINKS+=	archive_read.3 archive_read_next_header.3
203MLINKS+=	archive_read.3 archive_read_next_header2.3
204MLINKS+=	archive_read.3 archive_read_open.3
205MLINKS+=	archive_read.3 archive_read_open2.3
206MLINKS+=	archive_read.3 archive_read_open_FILE.3
207MLINKS+=	archive_read.3 archive_read_open_fd.3
208MLINKS+=	archive_read.3 archive_read_open_file.3
209MLINKS+=	archive_read.3 archive_read_open_filename.3
210MLINKS+=	archive_read.3 archive_read_open_memory.3
211MLINKS+=	archive_read.3 archive_read_support_compression_all.3
212MLINKS+=	archive_read.3 archive_read_support_compression_bzip2.3
213MLINKS+=	archive_read.3 archive_read_support_compression_compress.3
214MLINKS+=	archive_read.3 archive_read_support_compression_gzip.3
215MLINKS+=	archive_read.3 archive_read_support_compression_lzma.3
216MLINKS+=	archive_read.3 archive_read_support_compression_none.3
217MLINKS+=	archive_read.3 archive_read_support_compression_program.3
218MLINKS+=	archive_read.3 archive_read_support_compression_program_signature.3
219MLINKS+=	archive_read.3 archive_read_support_compression_xz.3
220MLINKS+=	archive_read.3 archive_read_support_format_all.3
221MLINKS+=	archive_read.3 archive_read_support_format_ar.3
222MLINKS+=	archive_read.3 archive_read_support_format_cpio.3
223MLINKS+=	archive_read.3 archive_read_support_format_empty.3
224MLINKS+=	archive_read.3 archive_read_support_format_iso9660.3
225MLINKS+=	archive_read.3 archive_read_support_format_raw.3
226MLINKS+=	archive_read.3 archive_read_support_format_tar.3
227MLINKS+=	archive_read.3 archive_read_support_format_zip.3
228MLINKS+=	archive_read_disk.3 archive_read_disk_entry_from_file.3
229MLINKS+=	archive_read_disk.3 archive_read_disk_gname.3
230MLINKS+=	archive_read_disk.3 archive_read_disk_new.3
231MLINKS+=	archive_read_disk.3 archive_read_disk_set_gname_lookup.3
232MLINKS+=	archive_read_disk.3 archive_read_disk_set_standard_lookup.3
233MLINKS+=	archive_read_disk.3 archive_read_disk_set_symlink_hybrid.3
234MLINKS+=	archive_read_disk.3 archive_read_disk_set_symlink_logical.3
235MLINKS+=	archive_read_disk.3 archive_read_disk_set_symlink_physical.3
236MLINKS+=	archive_read_disk.3 archive_read_disk_set_uname_lookup.3
237MLINKS+=	archive_read_disk.3 archive_read_disk_uname.3
238MLINKS+=	archive_util.3 archive_clear_error.3
239MLINKS+=	archive_util.3 archive_compression.3
240MLINKS+=	archive_util.3 archive_compression_name.3
241MLINKS+=	archive_util.3 archive_errno.3
242MLINKS+=	archive_util.3 archive_error_string.3
243MLINKS+=	archive_util.3 archive_file_count.3
244MLINKS+=	archive_util.3 archive_format.3
245MLINKS+=	archive_util.3 archive_format_name.3
246MLINKS+=	archive_util.3 archive_set_error.3
247MLINKS+=	archive_write.3 archive_write_close.3
248MLINKS+=	archive_write.3 archive_write_data.3
249MLINKS+=	archive_write.3 archive_write_finish.3
250MLINKS+=	archive_write.3 archive_write_finish_entry.3
251MLINKS+=	archive_write.3 archive_write_get_bytes_in_last_block.3
252MLINKS+=	archive_write.3 archive_write_get_bytes_per_block.3
253MLINKS+=	archive_write.3 archive_write_header.3
254MLINKS+=	archive_write.3 archive_write_new.3
255MLINKS+=	archive_write.3 archive_write_open.3
256MLINKS+=	archive_write.3 archive_write_open_FILE.3
257MLINKS+=	archive_write.3 archive_write_open_fd.3
258MLINKS+=	archive_write.3 archive_write_open_file.3
259MLINKS+=	archive_write.3 archive_write_open_filename.3
260MLINKS+=	archive_write.3 archive_write_open_memory.3
261MLINKS+=	archive_write.3 archive_write_set_bytes_in_last_block.3
262MLINKS+=	archive_write.3 archive_write_set_bytes_per_block.3
263MLINKS+=	archive_write.3 archive_write_set_callbacks.3
264MLINKS+=	archive_write.3 archive_write_set_compression_bzip2.3
265MLINKS+=	archive_write.3 archive_write_set_compression_compress.3
266MLINKS+=	archive_write.3 archive_write_set_compression_gzip.3
267MLINKS+=	archive_write.3 archive_write_set_compression_none.3
268MLINKS+=	archive_write.3 archive_write_set_compression_program.3
269MLINKS+=	archive_write.3 archive_write_set_format_pax.3
270MLINKS+=	archive_write.3 archive_write_set_format_shar.3
271MLINKS+=	archive_write.3 archive_write_set_format_ustar.3
272MLINKS+=	archive_write_disk.3 archive_write_disk_new.3
273MLINKS+=	archive_write_disk.3 archive_write_disk_set_group_lookup.3
274MLINKS+=	archive_write_disk.3 archive_write_disk_set_options.3
275MLINKS+=	archive_write_disk.3 archive_write_disk_set_skip_file.3
276MLINKS+=	archive_write_disk.3 archive_write_disk_set_standard_lookup.3
277MLINKS+=	archive_write_disk.3 archive_write_disk_set_user_lookup.3
278MLINKS+=	libarchive.3 archive.3
279
280.PHONY: check test clean-test
281check test:
282	cd ${.CURDIR}/test && make obj && make test
283
284clean-test:
285	cd ${.CURDIR}/test && make clean
286
287.include <bsd.lib.mk>
288