<commit_before>TARG = openssl
LIB = libssl.a
DEPS= zlib
# TODO: add perl, patch to DEPS

<$mkbuild/mk.common-noinst

openssl:QV:
	# apply patches
	patch -p1 < ../openssl-1.0.0a-ldflags.patch #327421
	patch -p1 < ../openssl-1.0.0d-windres.patch #373743
	patch -p1 < ../openssl-1.0.0h-pkg-config.patch
	patch -p1 < ../openssl-1.0.1-parallel-build.patch
	patch -p1 < ../openssl-1.0.1-x32.patch
	patch -p0 < ../openssl-1.0.1e-ipv6.patch
	# disable fips in the build
	# make sure the man pages are suffixed #302165
	# don't bother building man pages if they're disabled
	sed -i \
		-e '/DIRS/s: fips : :g' \
		-e '/^MANSUFFIX/s:=.*:=ssl:' \
		-e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
		-e '/^MANDIR=/s:=.*:=/share/man:' \
		Makefile.org \
		|| die
	# show the actual commands in the log
	sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared
	#
	sed -i '1s,^:$,#!/usr/bin/perl,' Configure #141906
	#./config --test-sanity || die "I AM NOT SANE"
	#
	sed -i 's/-DTERMIO/-DTERMIOS/g' Configure
	sed -i 's/defined(linux)/0/' crypto/ui/ui_openssl.c
	#
	# this is asm generated by perl (asm/cast-586.pl) which will cause textrel's that
	# will require musl's dynlinker to mprotect(PROT_EXEC), which is not allowed by grsec.
	sed -i 's@cast-586.o:@c_enc.o:@' Configure
	#
	export CFLAGS="-fPIC -Wa,--noexecstack -fno-strict-aliasing -D_GNU_SOURCE -Wl,-Bsymbolic \
	$optcflags $DEPS_CFLAGS"
	export LDFLAGS="$optldflags $DEPS_LDFLAGS"
	#
	#disable_asm=
	disable_asm=no-asm
	#
	./config --prefix="$prefix" --openssldir="$prefix"/etc/ssl \
	  --libdir="$prefix"/lib no-dso $disable_asm zlib enable-md2 $CFLAGS
		# Clean out hardcoded flags that openssl uses
		local CFLAG=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
			-e 's:^CFLAG=::' \
			-e 's:-fomit-frame-pointer ::g' \
			-e 's:-O[0-9] ::g' \
			-e 's:-march=[-a-z0-9]* ::g' \
			-e 's:-mcpu=[-a-z0-9]* ::g' \
			-e 's:-m[a-z0-9]* ::g' \
		)
		for mak in Makefile ; do
	#	for mak in Makefile crypto/cast/Makefile ; do
		sed -i \
			-e "/^CFLAG/s|=.*|=${CFLAG} ${CFLAGS} ${INCLUDES}|" \
			-e "/^SHARED_LDFLAGS=/s|$| ${LDFLAGS}|" \
			"$mak" || die
		done
		# second part of our cast-586 fix: CFLAGS need to be picked up by the makefile.
		sed -i 's@CFLAG=-g@CFLAG=${CFLAG} ${CFLAGS}@' crypto/cast/Makefile
	#sed -i 's@#include "e_os.h"@#define CAST_LONG unsigned@' crypto/cast/cast_lcl.h
	make -j$nprocs depend
	make -j$nprocs build_libs
<commit_msg>Don't use the local keyword<commit_after>TARG = openssl
LIB = libssl.a
DEPS= zlib
# TODO: add perl, patch to DEPS

<$mkbuild/mk.common-noinst

openssl:QV:
	# apply patches
	patch -p1 < ../openssl-1.0.0a-ldflags.patch #327421
	patch -p1 < ../openssl-1.0.0d-windres.patch #373743
	patch -p1 < ../openssl-1.0.0h-pkg-config.patch
	patch -p1 < ../openssl-1.0.1-parallel-build.patch
	patch -p1 < ../openssl-1.0.1-x32.patch
	patch -p0 < ../openssl-1.0.1e-ipv6.patch
	# disable fips in the build
	# make sure the man pages are suffixed #302165
	# don't bother building man pages if they're disabled
	sed -i \
		-e '/DIRS/s: fips : :g' \
		-e '/^MANSUFFIX/s:=.*:=ssl:' \
		-e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
		-e '/^MANDIR=/s:=.*:=/share/man:' \
		Makefile.org \
		|| die
	# show the actual commands in the log
	sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared
	#
	sed -i '1s,^:$,#!/usr/bin/perl,' Configure #141906
	#./config --test-sanity || die "I AM NOT SANE"
	#
	sed -i 's/-DTERMIO/-DTERMIOS/g' Configure
	sed -i 's/defined(linux)/0/' crypto/ui/ui_openssl.c
	#
	# this is asm generated by perl (asm/cast-586.pl) which will cause textrel's that
	# will require musl's dynlinker to mprotect(PROT_EXEC), which is not allowed by grsec.
	sed -i 's@cast-586.o:@c_enc.o:@' Configure
	#
	export CFLAGS="-fPIC -Wa,--noexecstack -fno-strict-aliasing -D_GNU_SOURCE -Wl,-Bsymbolic \
	$optcflags $DEPS_CFLAGS"
	export LDFLAGS="$optldflags $DEPS_LDFLAGS"
	#
	#disable_asm=
	disable_asm=no-asm
	#
	./config --prefix="$prefix" --openssldir="$prefix"/etc/ssl \
	  --libdir="$prefix"/lib no-dso $disable_asm zlib enable-md2 $CFLAGS
		# Clean out hardcoded flags that openssl uses
		CFLAG=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
			-e 's:^CFLAG=::' \
			-e 's:-fomit-frame-pointer ::g' \
			-e 's:-O[0-9] ::g' \
			-e 's:-march=[-a-z0-9]* ::g' \
			-e 's:-mcpu=[-a-z0-9]* ::g' \
			-e 's:-m[a-z0-9]* ::g' \
		)
		for mak in Makefile ; do
	#	for mak in Makefile crypto/cast/Makefile ; do
		sed -i \
			-e "/^CFLAG/s|=.*|=${CFLAG} ${CFLAGS} ${INCLUDES}|" \
			-e "/^SHARED_LDFLAGS=/s|$| ${LDFLAGS}|" \
			"$mak" || die
		done
		# second part of our cast-586 fix: CFLAGS need to be picked up by the makefile.
		sed -i 's@CFLAG=-g@CFLAG=${CFLAG} ${CFLAGS}@' crypto/cast/Makefile
	#sed -i 's@#include "e_os.h"@#define CAST_LONG unsigned@' crypto/cast/cast_lcl.h
	make -j$nprocs depend
	make -j$nprocs build_libs

{'fraction_non_alphanumeric': 0.1972689075630252, 'fraction_numerical': 0.029831932773109245, 'mean_word_length': 3.0347457627118644, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2051775', 'n_tokens_mistral': 2278, 'n_tokens_neox': 2074, 'n_words': 481}