Another recipe for mayhem.

This commit is contained in:
Ian A. Mason 2018-05-25 14:59:56 -07:00
parent 08903954e1
commit 87b55c28f9
3 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,102 @@
#iam wrote this monstrosity
THISDIR= $(shell pwd)
ZLIB=zlib-1.2.11
ZLIB_TARBALL=${ZLIB}.tar.gz
ZLIB_URL=https://zlib.net/${ZLIB_TARBALL}
ZLIB_INSTALL=${THISDIR}/install/zlib
LIBEVENT=libevent-2.1.8-stable
LIBEVENT_TARBALL=${LIBEVENT}.tar.gz
LIBEVENT_URL=https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/${LIBEVENT_TARBALL}
LIBEVENT_INSTALL=${THISDIR}/install/libevent
OPENSSL=openssl-1.1.0h
OPENSSL_TARBALL=${OPENSSL}.tar.gz
OPENSSL_URL=https://www.openssl.org/source/${OPENSSL_TARBALL}
OPENSSL_INSTALL=${THISDIR}/install/openssl
TOR=tor-0.3.3.6
TOR_TARBALL=${TOR}.tar.gz
TOR_URL=https://www.torproject.org/dist/${TOR_TARBALL}
TOR_INSTALL=${THISDIR}/install/tor
#LLVMCC=wllvm
#LLVMGET=extract-bc
LLVMCC=gclang
LLVMGET=get-bc
BITCODE = tor.bc libz.a.bc libssl.a.bc libevent.a.bc
all: ${BITCODE}
${TOR_TARBALL}:
wget ${TOR_URL}
${TOR}: ${TOR_TARBALL}
tar xvfz ${TOR_TARBALL}
${TOR_INSTALL}/bin/tor: ${TOR}
cd ${TOR}; CC=${LLVMCC} ./configure --prefix=${TOR_INSTALL}; make && make install
tor.bc: ${TOR_INSTALL}/bin/tor
cd ${TOR_INSTALL}; ${LLVMGET} tor; mv tor.bc ${THISDIR}
${ZLIB_TARBALL}:
wget ${ZLIB_URL}
${ZLIB}: ${ZLIB_TARBALL}
tar xvfz ${ZLIB_TARBALL}
${ZLIB_INSTALL}/lib/libz.a: ${ZLIB}
cd ${ZLIB}; CC=${LLVMCC} ./configure --prefix=${ZLIB_INSTALL}; make && make install
libz.a.bc: ${ZLIB_INSTALL}/lib/libz.a
cd ${ZLIB_INSTALL}/lib; ${LLVMGET} -b libz.a; mv libz.a.bc ${THISDIR}
${OPENSSL_TARBALL}:
wget ${OPENSSL_URL}
${OPENSSL}: ${OPENSSL_TARBALL}
tar xvfz ${OPENSSL_TARBALL}
${OPENSSL_INSTALL}/lib/libssl.a: ${OPENSSL}
cd ${OPENSSL}; CC=${LLVMCC} ./config --prefix=${OPENSSL_INSTALL} --openssldir=${OPENSSL_INSTALL}; make && make install
libssl.a.bc: ${OPENSSL_INSTALL}/lib/libssl.a
cd ${OPENSSL_INSTALL}/lib; ${LLVMGET} -b libssl.a; mv libssl.a.bc ${THISDIR}
${LIBEVENT_TARBALL}:
wget ${LIBEVENT_URL}
${LIBEVENT}: ${LIBEVENT_TARBALL}
tar xvfz ${LIBEVENT_TARBALL}
${LIBEVENT_INSTALL}/lib/libevent.a: ${LIBEVENT}
cd ${LIBEVENT}; CC=${LLVMCC} CFLAGS="-I${OPENSSL_INSTALL}/include" LDFLAGS="-L${OPENSSL_INSTALL}/lib" ./configure --prefix=${LIBEVENT_INSTALL}; make && make install
libevent.a.bc: ${LIBEVENT_INSTALL}/lib/libevent.a
cd ${LIBEVENT_INSTALL}/lib; ${LLVMGET} -b libevent.a; mv libevent.a.bc ${THISDIR}
clean:
rm ${BITCODE}
make -C ${ZLIB} clean
make -C ${LIBEVENT} clean
make -C ${OPENSSL} clean
make -C ${TOR} clean
very_clean: clean
rm -rf install ${TOR} ${ZLIB} ${OPENSSL} ${LIBEVENT}
spotless: very_clean
rm -rf ${TOR_TARBALL} ${ZLIB_TARBALL} ${OPENSSL_TARBALL} ${LIBEVENT_TARBALL}

View File

@ -328,6 +328,10 @@ func extractFile(archive string, filename string, instance int) bool {
arArgs = append(arArgs, "xN")
arArgs = append(arArgs, strconv.Itoa(instance))
} else {
if instance > 1 {
LogWarning("Cannot extract instance %v of %v from archive %s for instance > 1.\n", instance, filename, archive)
return false
}
arArgs = append(arArgs, "x")
}
arArgs = append(arArgs, archive)

View File

@ -163,6 +163,8 @@ func parse(argList []string) parserResult {
"-D": {1, pr.compileBinaryCallback},
"-U": {1, pr.compileBinaryCallback},
"-arch": {1, pr.compileBinaryCallback}, //iam: openssl
"-P": {1, pr.compileUnaryCallback}, //iam: linux kernel stuff (linker script stuff)
"-C": {1, pr.compileUnaryCallback}, //iam: linux kernel stuff (linker script stuff)