summaryrefslogtreecommitdiffstats
path: root/rules/zlib.make
blob: 8e8d230a14f9c36134b166c737fb7fc6f73fe836 (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
# -*-makefile-*-
# $Id$
#
# Copyright (C) 2002-2006 by Pengutronix e.K., Hildesheim, Germany
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
PACKAGES-$(PTXCONF_ZLIB) += zlib

#
# Paths and names
#
ZLIB_VERSION	:= 1.2.3
ZLIB		:= zlib-$(ZLIB_VERSION)
ZLIB_URL 	:= http://www.zlib.net/$(ZLIB).tar.gz
ZLIB_SOURCE	:= $(SRCDIR)/$(ZLIB).tar.gz
ZLIB_DIR	:= $(BUILDDIR)/$(ZLIB)

-include $(call package_depfile)

# ----------------------------------------------------------------------------
# Get
# ----------------------------------------------------------------------------

zlib_get: $(STATEDIR)/zlib.get

$(STATEDIR)/zlib.get: $(zlib_get_deps_default)
	@$(call targetinfo, $@)
	@$(call touch, $@)

$(ZLIB_SOURCE):
	@$(call targetinfo, $@)
	@$(call get, ZLIB)

# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

zlib_extract: $(STATEDIR)/zlib.extract

$(STATEDIR)/zlib.extract: $(zlib_extract_deps_default)
	@$(call targetinfo, $@)
	@$(call clean, $(ZLIB_DIR))
	@$(call extract, ZLIB)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

zlib_prepare: $(STATEDIR)/zlib.prepare

ZLIB_PATH	:= PATH=$(CROSS_PATH)
ZLIB_ENV	:= $(CROSS_ENV) AR="$(CROSS_AR) rc"
ZLIB_AUTOCONF	:= --shared --prefix=/usr

$(STATEDIR)/zlib.prepare: $(zlib_prepare_deps_default)
	@$(call targetinfo, $@)
	cd $(ZLIB_DIR) && $(ZLIB_ENV) $(ZLIB_PATH) ./configure $(ZLIB_AUTOCONF)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

zlib_compile: $(STATEDIR)/zlib.compile

$(STATEDIR)/zlib.compile: $(zlib_compile_deps_default)
	@$(call targetinfo, $@)
	$(ZLIB_PATH) cd $(ZLIB_DIR) && make
	$(ZLIB_PATH) cd $(ZLIB_DIR) && make libz.a
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

zlib_install: $(STATEDIR)/zlib.install

$(STATEDIR)/zlib.install: $(zlib_install_deps_default)
	@$(call targetinfo, $@)
	cd $(ZLIB_DIR) && $(ZLIB_PATH) make install prefix=$(SYSROOT)/usr
	$(INSTALL) $(ZLIB_DIR)/libz.a $(SYSROOT)/usr/lib/libz.a
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

zlib_targetinstall: $(STATEDIR)/zlib.targetinstall

$(STATEDIR)/zlib.targetinstall: $(zlib_targetinstall_deps_default)
	@$(call targetinfo, $@)

	@$(call install_init, zlib)
	@$(call install_fixup, zlib,PACKAGE,zlib)
	@$(call install_fixup, zlib,PRIORITY,optional)
	@$(call install_fixup, zlib,VERSION,$(ZLIB_VERSION))
	@$(call install_fixup, zlib,SECTION,base)
	@$(call install_fixup, zlib,AUTHOR,"Robert Schwebel <r.schwebel\@pengutronix.de>")
	@$(call install_fixup, zlib,DEPENDS,)
	@$(call install_fixup, zlib,DESCRIPTION,missing)

	@$(call install_copy, zlib, 0, 0, 0644, $(ZLIB_DIR)/libz.so.1.2.3, /usr/lib/libz.so.1.2.3)
	@$(call install_link, zlib, libz.so.1.2.3, /usr/lib/libz.so.1)
	@$(call install_link, zlib, libz.so.1.2.3, /usr/lib/libz.so)

	@$(call install_finish, zlib)

	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Clean
# ----------------------------------------------------------------------------

zlib_clean:
	rm -rf $(STATEDIR)/zlib.*
	rm -rf $(IMAGEDIR)/zlib_*
	rm -rf $(ZLIB_DIR)

# vim: syntax=make