summaryrefslogtreecommitdiffstats
path: root/rules/openssl.make
blob: 57503ec24a6b511e828bfeacbdb9980755859cfc (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
# -*-makefile-*-
# $Id$
#
# Copyright (C) 2002 by Jochen Striepe for Pengutronix e.K., Hildesheim, Germany
#               2003 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_OPENSSL) += openssl

#
# Paths and names 
#
OPENSSL_VERSION		= 0.9.7g
OPENSSL			= openssl-$(OPENSSL_VERSION)
OPENSSL_URL 		= http://www.openssl.org/source/$(OPENSSL).tar.gz
OPENSSL_SOURCE		= $(SRCDIR)/$(OPENSSL).tar.gz
OPENSSL_DIR 		= $(BUILDDIR)/$(OPENSSL)

ifdef PTXCONF_ARM_ARCH_LE
	THUD = linux-arm
endif
ifdef PTXCONF_ARM_ARCH_BE
	THUD = linux-armeb
endif
ifdef PTXCONF_MIPS_ARCH_LE
	THUD = linux-mipsel
endif
ifdef PTXCONF_MIPS_ARCH_BE
	THUD = linux-mips
endif
ifdef PTXCONF_ARCH_X86
	THUD = linux-i386
endif
ifdef PTXCONF_OPT_I586
	THUD = linux-i386-i586
endif
ifdef PTXCONF_OPT_I686
	THUD = linux-i386-i686/cmov
endif
ifdef PTXCONF_ARCH_PPC
	THUD = linux-ppc
endif
ifdef PTXCONF_ARCH_SPARC
	THUD = linux-sparc
endif


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

openssl_get: $(STATEDIR)/openssl.get

$(STATEDIR)/openssl.get: $(openssl_get_deps_default)
	@$(call targetinfo, $@)
	@$(call touch, $@)

$(OPENSSL_SOURCE):
	@$(call targetinfo, $@)
	@$(call get, OPENSSL)

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

openssl_extract: $(STATEDIR)/openssl.extract

$(STATEDIR)/openssl.extract: $(openssl_extract_deps_default)
	@$(call targetinfo, $@)
	@$(call clean, $(OPENSSL_DIR))
	@$(call extract, OPENSSL)
	@$(call patchin, OPENSSL)
	@$(call touch, $@)

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

openssl_prepare: $(STATEDIR)/openssl.prepare

OPENSSL_PATH	= PATH=$(CROSS_PATH)
OPENSSL_MAKEVARS = \
	$(CROSS_ENV_CC) \
	$(CROSS_ENV_RANLIB) \
	AR='$(CROSS_AR) r' \
	MANDIR=/man

OPENSSL_AUTOCONF = \
	--openssldir=/etc/ssl

ifdef PTXCONF_OPENSSL_SHARED
OPENSSL_AUTOCONF	+= shared
else
OPENSSL_AUTOCONF	+= no-shared
endif

$(STATEDIR)/openssl.prepare: $(openssl_prepare_deps_default)
	@$(call targetinfo, $@)
	cd $(OPENSSL_DIR) && \
		$(OPENSSL_PATH) \
		./Configure $(THUD) $(OPENSSL_AUTOCONF)
	@$(call touch, $@)

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

openssl_compile: $(STATEDIR)/openssl.compile

$(STATEDIR)/openssl.compile: $(openssl_compile_deps_default)
	@$(call targetinfo, $@)
#
# generate openssl.pc with correct path inside
#
	cd $(OPENSSL_DIR) && $(OPENSSL_PATH) make INSTALLTOP=$(SYSROOT) openssl.pc
	cd $(OPENSSL_DIR) && $(OPENSSL_PATH) make $(OPENSSL_MAKEVARS)
	@$(call touch, $@)

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

openssl_install: $(STATEDIR)/openssl.install

$(STATEDIR)/openssl.install: $(openssl_install_deps_default)
	@$(call targetinfo, $@)
#
# broken Makefile, generates dir with wrong permissions...
# chmod 755 fixed that
#
	mkdir -p $(SYSROOT)/lib/pkgconfig
	chmod 755 $(SYSROOT)/lib/pkgconfig
	$(OPENSSL_PATH) make -C $(OPENSSL_DIR) install $(OPENSSL_MAKEVARS) \
		INSTALL_PREFIX=$(SYSROOT) INSTALLTOP=''
	chmod 755 $(SYSROOT)/lib/pkgconfig
#
# FIXME:
# 	OPENSSL=${D}/usr/bin/openssl /usr/bin/perl tools/c_rehash ${D}/etc/ssl/certs
#
	@$(call touch, $@)

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

openssl_targetinstall: $(STATEDIR)/openssl.targetinstall

$(STATEDIR)/openssl.targetinstall: $(openssl_targetinstall_deps_default)
	@$(call targetinfo, $@)

	@$(call install_init, openssl)
	@$(call install_fixup, openssl,PACKAGE,openssl)
	@$(call install_fixup, openssl,PRIORITY,optional)
	@$(call install_fixup, openssl,VERSION,$(OPENSSL_VERSION))
	@$(call install_fixup, openssl,SECTION,base)
	@$(call install_fixup, openssl,AUTHOR,"Robert Schwebel <r.schwebel\@pengutronix.de>")
	@$(call install_fixup, openssl,DEPENDS,)
	@$(call install_fixup, openssl,DESCRIPTION,missing)
	
ifdef PTXCONF_OPENSSL_SHARED
	@$(call install_copy, openssl, 0, 0, 0644, $(OPENSSL_DIR)/libssl.so.0.9.7, /usr/lib/libssl.so.0.9.7)
	@$(call install_link, openssl, libssl.so.0.9.7, /usr/lib/libssl.so.0)
	@$(call install_link, openssl, libssl.so.0.9.7, /usr/lib/libssl.so)

	@$(call install_copy, openssl, 0, 0, 0644, $(OPENSSL_DIR)/libcrypto.so.0.9.7, /usr/lib/libcrypto.so.0.9.7)
	@$(call install_link, openssl, libcrypto.so.0.9.7, /usr/lib/libcrypto.so.0)
	@$(call install_link, openssl, libcrypto.so.0.9.7, /usr/lib/libcrypto.so)
endif
	@$(call install_finish, openssl)
	@$(call touch, $@)

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

openssl_clean: 
	rm -rf $(STATEDIR)/openssl.* 
	rm -rf $(IMAGEDIR)/openssl_* 
	rm -rf $(OPENSSL_DIR)

# vim: syntax=make