summaryrefslogtreecommitdiff
path: root/package/openssl/Makefile
blob: 2c77ea3c93fe754346205083bc6745412e90d931 (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
# This file is part of the OpenADK project. OpenADK is copyrighted
# material, please see the LICENCE file in the top-level directory.

include ${ADK_TOPDIR}/rules.mk

PKG_NAME:=		openssl
PKG_VERSION:=		1.0.2a
PKG_RELEASE:=		4
PKG_HASH:=		15b6393c20030aab02c8e2fe0243cb1d1d18062f6c095d67bca91871dc7f324a
PKG_DESCR:=		secure socket layer libraries
PKG_SECTION:=		libs/crypto
PKG_DEPENDS:=		zlib
PKG_BUILDDEP:=		zlib
PKG_URL:=		http://www.openssl.org/
PKG_SITES:=		http://www.openssl.org/source/
PKG_LIBNAME:=		libopenssl
PKG_OPTS:=		dev

DISTFILES:=		${PKG_NAME}-${PKG_VERSION}.tar.gz

PKG_SUBPKGS:=		LIBOPENSSL OPENSSL_UTIL
PKGSD_OPENSSL_UTIL:=	openssl command line tool
PKGSC_OPENSSL_UTIL:=	app/crypto
PKGSS_OPENSSL_UTIL:=	libopenssl

PKG_FLAVOURS_LIBOPENSSL:=	WITH_CRYPTODEV
PKGFD_WITH_CRYPTODEV:=		enable support for cryptodev-linux

include ${ADK_TOPDIR}/mk/host.mk
include ${ADK_TOPDIR}/mk/package.mk

$(eval $(call HOST_template,OPENSSL,openssl,${PKG_VERSION}-${PKG_RELEASE}))
$(eval $(call PKG_template,LIBOPENSSL,libopenssl,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},$(PKG_OPTS)))
$(eval $(call PKG_template,OPENSSL_UTIL,openssl-util,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_OPENSSL_UTIL},${PKGSD_OPENSSL_UTIL},${PKGSC_OPENSSL_UTIL}))

ifeq ($(ADK_TARGET_USE_STATIC_LIBS),y)
OPENSSL_OPTIONS:=	no-shared zlib no-dso
else
OPENSSL_OPTIONS:=	shared zlib-dynamic
ALL_TARGET+=		build-shared
TARGET_CFLAGS+=		-ldl
endif

OPENSSL_OPTIONS+= threads no-err no-krb5 no-engines no-camellia no-idea no-rc5 no-mdc2 no-sha0 no-smime no-aes192 no-cast

HOST_STYLE:=		manual
CONFIG_STYLE:=		manual
BUILD_STYLE:=		manual

INSTALL_TARGET:=	install_sw
FAKE_FLAGS+=		INSTALL_PREFIX=${WRKINST}

ifneq ($(ADK_PACKAGE_LIBOPENSSL_WITH_CRYPTODEV),)
OPENSSL_OPTIONS+= -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS
endif

ifeq ($(ADK_TARGET_ARCH_MICROBLAZE),y)
TARGET_CFLAGS:=		$(subst g3,g,$(TARGET_CFLAGS))
endif
ifeq ($(ADK_TARGET_ARCH_XTENSA),y)
TARGET_CFLAGS:=		$(subst g3,g,$(TARGET_CFLAGS))
endif
ifeq ($(ADK_TARGET_ARCH_PPC),y)
TARGET_CFLAGS:=		$(subst g3,g,$(TARGET_CFLAGS))
endif

CONFIG:=		linux-generic32
ifeq ($(ADK_TARGET_ARCH_X86_64),y)
CONFIG:=		linux-x86_64
endif

ifneq (,$(filter CYGWIN%,${OStype}))
HOSTCONFIG:=		Cygwin-x86_64
endif
ifeq ($(OStype),Darwin)
HOSTCONFIG:=		darwin64-x86_64-cc
endif

host-configure:
ifeq ($(HOSTCONFIG),)
	(cd $(WRKBUILD); ./config --prefix='$(STAGING_HOST_DIR)/usr' -fPIC -ldl)
else
	(cd $(WRKBUILD); ./Configure $(HOSTCONFIG) --prefix='$(STAGING_HOST_DIR)/usr')
endif

host-build:
	(cd $(WRKBUILD); make)

openssl-hostinstall:
	(cd $(WRKBUILD); make install)

post-extract:
	-mkdir -p $(STAGING_TARGET_DIR)/usr/include/crypto
	$(CP) ./files/cryptodev.h $(STAGING_TARGET_DIR)/usr/include/crypto/

do-configure:
	(cd $(WRKBUILD); \
		PATH='$(TARGET_PATH)' \
		./Configure $(CONFIG) \
		  --prefix=/usr \
		  --openssldir=/etc/ssl \
		  -I$(STAGING_TARGET_DIR)/usr/include \
		  -L$(STAGING_TARGET_DIR)/usr/lib \
		  -DOPENSSL_SMALL_FOOTPRINT \
		  $(OPENSSL_OPTIONS) \
	);
	$(SED) "s:-O[0-9]:$(TARGET_CFLAGS) -fPIC:" $(WRKBUILD)/Makefile

do-build:
	$(MAKE) -C $(WRKBUILD) \
		CC="$(TARGET_CC)" \
		AR="$(TARGET_CROSS)ar r" \
		RANLIB="$(TARGET_CROSS)ranlib" \
		$(ALL_TARGET)

libopenssl-install:
	${INSTALL_DIR} ${IDIR_LIBOPENSSL}/usr/lib
	${CP} ${WRKINST}/usr/lib*/lib*.so* ${IDIR_LIBOPENSSL}/usr/lib
	chmod 644 ${IDIR_LIBOPENSSL}/usr/lib/lib*.so*

openssl-util-install:
	${INSTALL_DIR} ${IDIR_OPENSSL_UTIL}/usr/bin
	${CP} ${WRKINST}/usr/bin/openssl ${IDIR_OPENSSL_UTIL}/usr/bin
	${INSTALL_DIR} ${IDIR_OPENSSL_UTIL}/etc/ssl/{,certs,private}
	${CP} ${WRKSRC}/apps/openssl.cnf ${IDIR_OPENSSL_UTIL}/etc/ssl/
	chmod 0700 ${IDIR_OPENSSL_UTIL}/etc/ssl/private

include ${ADK_TOPDIR}/mk/host-bottom.mk
include ${ADK_TOPDIR}/mk/pkg-bottom.mk