include Config
-VER = 0.9.8d
+PKG_NAME = openssl
+PKG_VER = 0.9.8j
-THISAPP = openssl-$(VER)
+THISAPP = $(PKG_NAME)-$(PKG_VER)
DL_FILE = $(THISAPP).tar.gz
-DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
-TARGET = $(DIR_INFO)/$(THISAPP)
-###############################################################################
-# Top-level Rules
-###############################################################################
+OBJECT = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
-objects = $(DL_FILE)
+ifneq "$(MACHINE)" "i686"
+ SSL_ARCH = no-asm 386 # 386 implies no-sse2
+endif
-$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+# These arches do support sse2.
+ifneq "$(TARGET)" "via-c7"
+ifneq "$(TARGET)" "atom330"
+ifneq "$(TARGET)" "core2duo"
+ SSL_ARCH += no-sse2
+endif
+endif
+endif
-$(DL_FILE)_MD5 = 8ed1853538e1d05a1f5ada61ebf8bffa
-
-install : $(TARGET)
-
-check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+###############################################################################
+# Top-level Rules
+###############################################################################
-download :$(patsubst %,$(DIR_DL)/%,$(objects))
+objects = $(DL_FILE) \
+ $(THISAPP)-fix_manpages-1.patch \
+ $(THISAPP)-enginesdir.patch
-md5 : $(subst %,%_MD5,$(objects))
+info:
+ $(DO_PKG_INFO)
-###############################################################################
-# Downloading, checking, md5sum
-###############################################################################
+install: $(OBJECT)
-$(patsubst %,$(DIR_CHK)/%,$(objects)) :
- @$(CHECK)
+download : $(objects)
-$(patsubst %,$(DIR_DL)/%,$(objects)) :
+$(objects) :
@$(LOAD)
-$(subst %,%_MD5,$(objects)) :
- @$(MD5)
-
###############################################################################
# Installation Details
###############################################################################
-$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+$(OBJECT) :
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
- @rm -rf /etc/ssl
- cd $(DIR_APP) && sed -i -e 's/mcpu/march/' config
- cd $(DIR_APP) && sed -i -e 's/-O3/-O2/' -e 's/-march=i486/-march=i586/' Configure
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/$(THISAPP)-fix_manpages-1.patch
- cd $(DIR_APP) && ./config --openssldir=/etc/ssl --prefix=/usr shared
- cd $(DIR_APP) && make MANDIR=/usr/share/man
- cd $(DIR_APP) && make MANDIR=/usr/share/man install
- rm -rf /etc/ssl/lib
- install -m 0644 $(DIR_SRC)/config/ssl/openssl.cnf /etc/ssl
- @rm -rf $(DIR_APP)
+ cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-fix_manpages-1.patch
+ cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-enginesdir.patch
+
+ cd $(DIR_APP) && sed -i -e 's/-O3 -fomit-frame-pointer/$(CFLAGS)/' Configure
+
+ cd $(DIR_APP) && sed -e 's/__OpenBSD__/__linux__/' -e 's/arandom/urandom/' \
+ -i.orig crypto/rand/randfile.c
+
+ cd $(DIR_APP) && sed 's/__OpenBSD__/__linux__/' -i.orig crypto/uid.c
+
+ cd $(DIR_APP) && find crypto/ -name Makefile -exec \
+ sed 's/^ASFLAGS=/&-Wa,--noexecstack /' -i.orig {} \;
+
+ cd $(DIR_APP) && \
+ ./Configure \
+ --prefix=/usr \
+ --openssldir=/etc/pki/tls \
+ --enginesdir=/usr/lib/openssl/engines \
+ linux-elf $(SSL_ARCH) \
+ shared \
+ zlib-dynamic \
+ enable-camellia \
+ enable-seed \
+ enable-tlsext \
+ enable-rfc3779 \
+ no-idea \
+ no-mdc2 \
+ no-rc5 \
+ no-ec \
+ no-ecdh \
+ no-ecdsa \
+ -DSSL_FORBID_ENULL
+
+ # Build.
+ cd $(DIR_APP) && make all build-shared #$(PARALLELISMFLAGS)
+
+ # Generate hashes for the included certs.
+ cd $(DIR_APP) && make rehash build-shared
+
+ cd $(DIR_APP) && make install build-shared
+ cd $(DIR_APP) && cp -v -r certs /etc/pki/tls
+
+ mv -v /usr/lib/{libcrypto,libssl}.a /usr/lib/static
+ install -d /usr/lib/openssl
+ mv -v /usr/lib/engines /usr/lib/openssl
+
+ -mkdir -m700 /etc/pki/CA
+ -mkdir -m700 /etc/pki/CA/private
+
+ install -m 0644 $(DIR_SRC)/config/ssl/openssl.cnf /etc/pki/tls
+
+ @rm -rf $(DIR_APP) /etc/pki/tls/man
@$(POSTBUILD)