forked from dxFeed/dxfeed-c-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcombine_package.sh
executable file
·93 lines (77 loc) · 2.61 KB
/
combine_package.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
#!/bin/sh
# Script CPack archives with specified platform and configuration. After
# packing all files extracted to single release directory.
# Usage:
# combine_package <project-name> <configuration> <platform> <version> [no-tls] [static]
# where:
# project-name - The name of target project package
# configuration - Debug or Release
# platform - x86 or x64
# version - version of application i.e. 1.2.6
# no-tls - build without TLS support
# static - build the framework as a static library, static samples and tests (without TLS support)
#
# WARNING: you must set the next environment variables
# PACKAGE_WORK_DIR - the working directory where cpack result arhive will be stored and unpacked
# Check cpack application in PATH
#rem Check cpack application in PATH
which cpack > /dev/null
if [ $? -ne 0 ]; then
echo "The 'cpack' application is missing. Ensure it is installed and placed in your PATH."
exit 31
fi
# Check 7z archiver in PATH
which 7z > /dev/null
if [ $? -ne 0 ]; then
echo "The '7z' application is missing. Ensure it is installed and placed in your PATH."
exit 32
fi
# Check PACKAGE_WORK_DIR environment variable
if [ "$PACKAGE_WORK_DIR" = "" ]; then
echo "ERROR: Environment variable PACKAGE_WORK_DIR is not specified!"
echo "Please set 'PACKAGE_WORK_DIR=...' in your caller script or command line."
exit 33
fi
PROJECT_NAME=$1
CONFIG=$2
PLATFORM=$3
VERSION=$4
NO_TLS_OR_BUILD_STATIC_LIBS=$5
BUILD_STATIC_LIBS=$6
PACKAGE_SUFFIX=""
if [ "$PROJECT_NAME" = "" ]; then
echo "ERROR: Project package name is not specified!"
exit 34
fi
if [ ! "$CONFIG" = "Debug" ]; then
if [ ! "$CONFIG" = "Release" ]; then
echo "ERROR: Invalid configuration value '$CONFIG'"
exit 35
fi
fi
if [ ! "$PLATFORM" = "x86" ]; then
if [ ! "$PLATFORM" = "x64" ]; then
echo "ERROR: Invalid platform value '$PLATFORM'"
exit 36
fi
fi
if [ "$NO_TLS_OR_BUILD_STATIC_LIBS" = "no-tls" ]; then
PACKAGE_SUFFIX="-no-tls"
if [ "$BUILD_STATIC_LIBS" = "static" ]; then
PACKAGE_SUFFIX="-static-no-tls"
fi
elif [ "$NO_TLS_OR_BUILD_STATIC_LIBS" = "static" ]; then
PACKAGE_SUFFIX="-static-no-tls"
fi
cpack -G ZIP -C $CONFIG --config $PLATFORM/$CONFIG/DXFeedAllCPackConfig.cmake
if [ $? -ne 0 ]; then
exit $?
fi
PACKAGE_NAME=$PROJECT_NAME-$VERSION-$PLATFORM$PACKAGE_SUFFIX
ARCHIVE_NAME=$PROJECT_NAME-$VERSION-$PLATFORM$CONFIG$PACKAGE_SUFFIX
mv -f $PACKAGE_NAME.zip $PACKAGE_WORK_DIR/$ARCHIVE_NAME.zip
7z x -y -o$PACKAGE_WORK_DIR $PACKAGE_WORK_DIR/$ARCHIVE_NAME.zip
if [ $? -ne 0 ]; then
exit $?
fi
exit 0