-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildX86.sh
executable file
·57 lines (48 loc) · 2.11 KB
/
buildX86.sh
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
#!/bin/sh
# BEGIN - Change Variables for Platform, Architecture & Source Code Version
BUILD_PLATFORM="linux-generic32"
BUILD_ARCHITECTURE="x86"
ARCHIVE_NAME="openssl-1.0.1j"
SRC_ARCHIVE="$ARCHIVE_NAME.tar.gz"
# END - Change Variables for Platform, Architecture & Source Code Version
# Directory Variables
BUILD_ENV_DIR="BuildEnvironments/$BUILD_ARCHITECTURE/sys-root"
APP_PREFIX="OpenSSL"
SRC_TAR_ROOT="openssl"
SRC_DIR="appSrc/$SRC_TAR_ROOT"
BUILD_DIR="appBuild/$APP_PREFIX"
CONFIG_DIR="Apps/$APP_PREFIX/config"
QPKG_DIR="package"
QPKG_ENV="$QPKG_DIR/$BUILD_ARCHITECTURE"
QPKG_CONFIG="$QPKG_ENV/config"
QPKG_BUILD="$QPKG_DIR/build"
# Get the Script's Current Directory
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
PACKAGE_ROOT="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
PACKAGE_PARENT="$(dirname "$PACKAGE_ROOT")"
# Clean any Existing Source Code & Installed Binaries
rm -rf $PACKAGE_PARENT/$BUILD_ENV_DIR/$SRC_DIR
rm -rf $PACKAGE_PARENT/$BUILD_ENV_DIR/$BUILD_DIR
rm -rf $PACKAGE_PARENT/$BUILD_ENV_DIR/$CONFIG_DIR
# Extract Source Code Archive
mkdir -p $PACKAGE_PARENT/$BUILD_ENV_DIR/$SRC_DIR
mkdir -p $PACKAGE_PARENT/$BUILD_ENV_DIR/$BUILD_DIR
mkdir -p $PACKAGE_PARENT/$BUILD_ENV_DIR/$CONFIG_DIR
tar -xf $SRC_ARCHIVE -C $PACKAGE_PARENT/$BUILD_ENV_DIR/$SRC_DIR
# Clean, Build & Install the Source Code
chroot $PACKAGE_PARENT/$BUILD_ENV_DIR bash -c "cd /$SRC_DIR/$ARCHIVE_NAME && make clean"
chroot $PACKAGE_PARENT/$BUILD_ENV_DIR bash -c "cd /$SRC_DIR/$ARCHIVE_NAME && ./Configure $BUILD_PLATFORM --prefix=/$BUILD_DIR --openssldir=/$CONFIG_DIR && make && make test && make install"
# Clean the QDK Package Environment
rm -rf $PACKAGE_ROOT/$QPKG_ENV/*
rm -rf $PACKAGE_ROOT/$QPKG_BUILD/
# Copy the Installed Binaries & Configs to the QDK Package Environment
mkdir -p $PACKAGE_ROOT/$QPKG_CONFIG
cp -r $PACKAGE_PARENT/$BUILD_ENV_DIR/$BUILD_DIR/* $PACKAGE_ROOT/$QPKG_ENV
cp -r $PACKAGE_PARENT/$BUILD_ENV_DIR/$CONFIG_DIR/* $PACKAGE_ROOT/$QPKG_CONFIG
# Build the QPKG File
qbuild --root $PACKAGE_ROOT/$QPKG_DIR