-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
140 lines (104 loc) · 4.17 KB
/
build.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
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
130
131
132
133
134
135
136
137
138
139
140
#!/bin/bash
#set -x
####################################################################################################
# Configuration
# Platform version / name
JBOSS_DIST=$1
JBOSS_ROOT_DIR=$2
JBOSS_ARCHIVE="$JBOSS_DIST/$3"
GDS_DIST=$4
GDS_RELEASE=$5
GDS_ROOT_DIR="${GDS_RELEASE}"
# JBoss native version
JBOSS_NATIVE_VERSION="2.0.10"
# Temporary directories
BASE_DIR=`pwd`
BUILD_DIR="build"
COMMON_DIR="common"
SAMPLES_DIR="samples"
/bin/rm -rf "${BUILD_DIR}" "${COMMON_DIR}/graniteds"
/bin/mkdir "${BUILD_DIR}"
####################################################################################################
# Extract JBoss
echo "Building community platform ${GDS_ROOT_DIR} from ${JBOSS_ARCHIVE}..."
# Extract JBoss distribution, excluing unused configurations/features
echo "Unziping ${JBOSS_ARCHIVE} to ${BUILD_DIR}..."
UNZIP_JBOSS_EXCLUDE="\
$JBOSS_ROOT_DIR/server/all/* \
$JBOSS_ROOT_DIR/server/minimal/* \
$JBOSS_ROOT_DIR/server/standard/* \
$JBOSS_ROOT_DIR/server/web/* \
$JBOSS_ROOT_DIR/server/default/deployers/webbeans.deployer/* \
$JBOSS_ROOT_DIR/server/default/deploy/management/*"
unzip -q "${JBOSS_ARCHIVE}" -d "${BUILD_DIR}" -x ${UNZIP_JBOSS_EXCLUDE}
# Rename jboss root directory.
/bin/mv "${BUILD_DIR}/${JBOSS_ROOT_DIR}" "${BUILD_DIR}/${GDS_ROOT_DIR}"
####################################################################################################
# Extract distribution artifacts
echo "Unzipping GraniteDS distribution to ${COMMON_DIR}..."
unzip -q "dist/${GDS_DIST}.zip" -d "${COMMON_DIR}"
####################################################################################################
# Overwrite / add JBoss files
# Copy samples from previous job
echo "Copying ${SAMPLES_DIR}..."
/bin/cp -rf "${SAMPLES_DIR}" "${BUILD_DIR}/${GDS_ROOT_DIR}/server/default/."
# Update/add platform files
echo "Copying common platform files..."
/bin/cp -rf "${COMMON_DIR}"/* "${BUILD_DIR}/${GDS_ROOT_DIR}"
####################################################################################################
# Zip/tar common platform files (without APR libraries)
COMMON_TAR="${GDS_ROOT_DIR}.tar"
COMMON_ZIP="${GDS_ROOT_DIR}.zip"
echo ""
echo "Creating common platform archive: ${BUILD_DIR}/${COMMON_TAR}..."
tar --directory="${BUILD_DIR}" -cf "${BUILD_DIR}/${COMMON_TAR}" "${GDS_ROOT_DIR}"
echo "Creating common platform archive: ${BUILD_DIR}/${COMMON_ZIP}..."
cd "${BUILD_DIR}"
zip -n ".zip" -qr "${COMMON_ZIP}" "${GDS_ROOT_DIR}"
cd ..
####################################################################################################
# Add APR libraries to archives.
TMP="${BUILD_DIR}/tmp"
function distrib_tar() {
echo ""
/bin/rm -rf "${TMP}"
/bin/mkdir "${TMP}"
DISTRIB_TAR="${BUILD_DIR}/${GDS_ROOT_DIR}-${1}.tar"
echo "Copying ${BUILD_DIR}/${COMMON_TAR} to ${DISTRIB_TAR}..."
/bin/cp "${BUILD_DIR}/${COMMON_TAR}" "${DISTRIB_TAR}"
NATIVE_TAR_GZ="${JBOSS_DIST}/jboss-native-${JBOSS_NATIVE_VERSION}-${1}.tar.gz"
echo "Unarchiving ${NATIVE_TAR_GZ} into ${TMP}/${GDS_ROOT_DIR}..."
/bin/mkdir "${TMP}/${GDS_ROOT_DIR}"
tar --directory "${TMP}/${GDS_ROOT_DIR}" -zxf "${NATIVE_TAR_GZ}"
cd "${BASE_DIR}"
echo "Updating ${DISTRIB_TAR} with ${TMP}/${GDS_ROOT_DIR}..."
cd "${TMP}"
tar rf "${BASE_DIR}/${DISTRIB_TAR}" "${GDS_ROOT_DIR}"
cd "${BASE_DIR}"
echo "Gziping ${DISTRIB_TAR} to ${DISTRIB_TAR}.gz..."
gzip "${DISTRIB_TAR}"
/bin/rm -rf "${TMP}"
}
function distrib_zip() {
echo ""
/bin/rm -rf "${TMP}"
/bin/mkdir "${TMP}"
DISTRIB_ZIP="${BUILD_DIR}/${GDS_ROOT_DIR}-${1}.zip"
echo "Copying ${BUILD_DIR}/${COMMON_ZIP} to ${DISTRIB_ZIP}..."
/bin/cp "${BUILD_DIR}/${COMMON_ZIP}" "${DISTRIB_ZIP}"
NATIVE_ZIP="${JBOSS_DIST}/jboss-native-${JBOSS_NATIVE_VERSION}-${1}.zip"
echo "Unziping ${NATIVE_ZIP} into ${TMP}/${GDS_ROOT_DIR}..."
/bin/mkdir "${TMP}/${GDS_ROOT_DIR}"
unzip -q "${NATIVE_ZIP}" -d "${TMP}/${GDS_ROOT_DIR}"
echo "Updating ${DISTRIB_ZIP} with ${TMP}/${GDS_ROOT_DIR}..."
cd "${TMP}"
zip -qr "${BASE_DIR}/${DISTRIB_ZIP}" "${GDS_ROOT_DIR}"
cd "${BASE_DIR}"
/bin/rm -rf "${TMP}"
}
distrib_tar "linux2-x64"
distrib_tar "linux2-x86"
distrib_tar "macosx-x86"
distrib_zip "windows-x64"
distrib_zip "windows-x86"
/bin/rm -f "${BUILD_DIR}/${COMMON_TAR}" "${BUILD_DIR}/${COMMON_ZIP}"