forked from microsoft/PowerShell-DSC-for-Linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·186 lines (156 loc) · 4.84 KB
/
configure
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#!/bin/bash
BUILD_RPM=1
BUILD_DPKG=1
BUILD_SSL_098=1
BUILD_SSL_100=1
BUILD_SSL_110=1
BUILD_SSL_SYSTEM=0
BUILD_DEBUG=0
BUILD_OMS=
DEBUG_FLAGS=""
DSC_MODULES_PATH="/opt/microsoft/dsc/modules"
DSC_SCRIPT_PATH="/opt/microsoft/dsc/Scripts"
DSC_HOST_BASE_PATH="/opt/dsc"
DSC_PATH_MODIFIER="/dsc"
for opt
do
arg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
case $opt in
-h | --help)
help=1
;;
--enable-debug)
if [ "$build_type" = "Bullseye" ]; then
echo "Cannot build debug if Bullseye is enabled"
exit 1
fi
BUILD_DEBUG=1
DEBUG_FLAGS="--enable-debug"
;;
--no-rpm)
BUILD_RPM=0
;;
--no-dpkg)
BUILD_DPKG=0
;;
--local)
if [ "$BUILD_OMS" = "BUILD_OMS" ]; then
echo "Error: options --oms and --local conflict."
exit 1
fi
BUILD_LOCAL=1
DSC_MODULES_PATH="\$(CONFIG_DATADIR)/dsc/modules"
DSC_SCRIPT_PATH="\$(CONFIG_DATADIR)/dsc/Scripts"
;;
--no-ssl-098)
BUILD_SSL_098=0
;;
--no-ssl-100)
BUILD_SSL_100=0
;;
--no-ssl-110)
BUILD_SSL_110=0
;;
--oms)
if [ "$BUILD_LOCAL" = "1" ]; then
echo "Error: options --oms and --local conflict."
exit 1
fi
BUILD_OMS=BUILD_OMS
DSC_MODULES_PATH="/opt/microsoft/omsconfig/modules"
DSC_SCRIPT_PATH="/opt/microsoft/omsconfig/Scripts"
DSC_HOST_BASE_PATH="/opt/dsc"
DSC_PATH_MODIFIER="/omsconfig"
;;
*)
echo "configure: invalid option '$opt'"
echo "Try configure --help' for more information."
exit 1
;;
esac
done
if [ "$help" = "1" ]; then
cat<<EOF
Usage: ./configure [OPTIONS]
OVERVIEW:
This script configures DSC for Linux for building.
OPTIONS:
-h, --help Print this help message.
--enable-debug Perform a debug build.
--no-rpm Do not build an RPM package
--no-dpkg Do not build a DEB package
--no-ssl-098 Do not build for OpenSSL 0.9.8x
--no-ssl-100 Do not build for OpenSSL 1.0.x
--no-ssl-110 Do not build for OpenSSL 1.1.x
--local Build without packages and for the OpenSSL installed to the system.
EOF
exit 0
fi
pkgconfig=`which pkg-config`
if [ -d "/usr/local_ssl_0.9.8" ] || [ -d "/usr/local_ssl_1.0.0" ] || [ -d "/usr/local_ssl_1.1.0" ]; then
if [ -d "/usr/local_ssl_0.9.8" ]; then
if [ "`uname -m`" == "x86_64" ]; then
openssl098_libdir=/usr/local_ssl_0.9.8/lib
else
openssl098_libdir=/usr/local_ssl_0.9.8/lib
fi
openssl098_cflags=`PKG_CONFIG_PATH=$openssl098_libdir/pkgconfig $pkgconfig --cflags openssl`
openssl098_libs=`PKG_CONFIG_PATH=$openssl098_libdir/pkgconfig $pkgconfig --libs openssl`
else
echo -e "\e[33mYellow SSL version 0.9.8 is not found at path /usr/local_ssl_0.9.8. Skipping build for SSL 0.9.8.\e[0m"
BUILD_SSL_098=0
fi
if [ -d "/usr/local_ssl_1.0.0" ]; then
if [ "`uname -m`" == "x86_64" ]; then
openssl100_libdir=/usr/local_ssl_1.0.0/lib64
else
openssl100_libdir=/usr/local_ssl_1.0.0/lib
fi
openssl100_cflags=`PKG_CONFIG_PATH=$openssl100_libdir/pkgconfig $pkgconfig --cflags openssl`
openssl100_libs=`PKG_CONFIG_PATH=$openssl100_libdir/pkgconfig $pkgconfig --libs openssl`
else
echo -e "\e[33mYellow SSL version 1.0.0 is not found at path /usr/local_ssl_1.0.0. Skipping build for SSL 1.0.0.\e[0m"
BUILD_SSL_100=0
fi
if [ -d "/usr/local_ssl_1.1.0" ]; then
if [ "`uname -m`" == "x86_64" ]; then
openssl110_libdir=/usr/local_ssl_1.1.0/lib
fi
openssl110_cflags=`PKG_CONFIG_PATH=$openssl110_libdir/pkgconfig $pkgconfig --cflags openssl`
openssl110_libs=`PKG_CONFIG_PATH=$openssl110_libdir/pkgconfig $pkgconfig --libs openssl`
else
echo -e "\e[33mYellow SSL version 1.1.0 is not found at path /usr/local_ssl_1.1.0. Skipping build for SSL 1.1.0.\e[0m"
BUILD_SSL_110=0
fi
fi
cat <<EOF > config.mak
BUILD_RPM=$BUILD_RPM
BUILD_DPKG=$BUILD_DPKG
BUILD_SSL_098=$BUILD_SSL_098
BUILD_SSL_100=$BUILD_SSL_100
BUILD_SSL_110=$BUILD_SSL_110
BUILD_LOCAL=$BUILD_LOCAL
BUILD_OMS=$BUILD_OMS
DSC_MODULES_PATH=$DSC_MODULES_PATH
DSC_SCRIPT_PATH=$DSC_SCRIPT_PATH
DSC_HOST_BASE_PATH=$DSC_HOST_BASE_PATH
BUILD_DEBUG=$BUILD_DEBUG
DEBUG_FLAGS=$DEBUG_FLAGS
# DSC cannot build with -Werror
ENABLE_WERROR=0
openssl098_cflags=$openssl098_cflags
openssl098_libs=$openssl098_libs
openssl098_libdir=$openssl098_libdir
openssl100_cflags=$openssl100_cflags
openssl100_libs=$openssl100_libs
openssl100_libdir=$openssl100_libdir
openssl110_cflags=$openssl110_cflags
openssl110_libs=$openssl110_libs
openssl110_libdir=$openssl110_libdir
EOF
cat <<EOF > dsc_config.h
#pragma once
#include "config.h"
#define DSC_ETC_PATH CONFIG_SYSCONFDIR "$DSC_PATH_MODIFIER"
EOF
echo "Configured DSC"