2626OS_NAME=$NAME
2727${ECHO} " OS:\t\t${OS_ID} -${OS_VERSION} "
2828
29- # Package dependencies for Debian/Ubuntu
30- if [ ${OS_ID} = " debian" ] || [ ${OS_ID} = " ubuntu" ]; then
31- . ./${OS_ID} -${OS_VERSION} .deps.sh || exit 1
32- fi
33-
34- # ----------------------------------------
35- # Library versions
36- # ----------------------------------------
37- libdispatch_version=5.9.2
38- libcorefoundation_version=5.9.2
39- libcfnetwork_version=129.20
40- libobjc2_version=2.2.1
41- gnustep_make_version=2_9_2
42- gnustep_base_version=1_30_0
43- gnustep_gui_version=0_31_0
44-
45- gorm_version=1_4_0
46- projectcenter_version=0_7_0
47-
48- roboto_mono_version=0.2020.05.08
49- roboto_mono_checkout=master
50-
5129# ----------------------------------------
5230# Paths
5331# ----------------------------------------
@@ -71,6 +49,7 @@ if [ -z $BUILD_RPM ]; then
7149 DEST_DIR=" "
7250 fi
7351else
52+ print_H2 " ===== Create rpmbuild directories..."
7453 RELEASE_USR=" $_PWD /$OS_ID -$OS_VERSION /NSUser"
7554 RELEASE_DEV=" $_PWD /$OS_ID -$OS_VERSION /NSDeveloper"
7655 mkdir -p ${RELEASE_USR}
7958 RPM_SOURCES_DIR=~ /rpmbuild/SOURCES
8059 RPM_SPECS_DIR=~ /rpmbuild/SPECS
8160 RPMS_DIR=~ /rpmbuild/RPMS/` uname -m`
61+ mkdir -p $RPM_SOURCES_DIR
62+ mkdir -p $RPM_SPECS_DIR
8263
8364 ${ECHO} " RPMs directory:\t$RPMS_DIR "
8465fi
8566
67+ . ../functions.sh
68+ # ----------------------------------------
69+ # Package dependencies
70+ # ----------------------------------------
71+ if [ ${OS_ID} = " debian" ] || [ ${OS_ID} = " ubuntu" ]; then
72+ . ./${OS_ID} -${OS_VERSION} .deps.sh || exit 1
73+ else
74+ prepare_environment
75+ fi
76+
77+ # ----------------------------------------
78+ # Library versions
79+ # ----------------------------------------
80+ libdispatch_version=5.9.2
81+ libcorefoundation_version=5.9.2
82+ libcfnetwork_version=129.20
83+ libobjc2_version=2.2.1
84+ gnustep_make_version=2_9_2
85+ gnustep_base_version=1_30_0
86+ gnustep_gui_version=0_31_0
87+
88+ gorm_version=1_4_0
89+ projectcenter_version=0_7_0
90+
91+ roboto_mono_version=0.2020.05.08
92+ roboto_mono_checkout=master
93+
8694# ----------------------------------------
8795# Tools
8896# ----------------------------------------
@@ -137,155 +145,3 @@ if [ "$OS_ID" = "fedora" ] || [ "$OS_LIKE" = "rhel" ] || [ "$OS_ID" = "debian" ]
137145 which clang++ 2>&1 > /dev/null || ` echo " No clang++ compiler found. Please install clang++ package." ; exit 1`
138146 CXX_COMPILER=` which clang++`
139147fi
140-
141- # ##############################################################################
142- # Functions
143- # ##############################################################################
144-
145- git_remote_archive () {
146- local url=" $1 "
147- local dest=" $2 "
148- local branch=" $3 "
149-
150- cd ${BUILD_ROOT}
151-
152- if [ -d " $dest " ]; then
153- echo " $dest exists, skipping"
154- else
155- git clone --recurse-submodules " $url " " $dest "
156- cd " $dest "
157- if [ " $branch " != " master" ]; then
158- git checkout $branch
159- fi
160- fi
161- }
162-
163- install_packages () {
164- apt-get install -y $@ || exit 1
165- }
166-
167- uninstall_packages () {
168- apt-get purge -y $@ || exit 1
169- }
170-
171- prepare_environment ()
172- {
173- print_H1 " Prepare build environment"
174- print_H2 " ===== Create rpmbuild directories..."
175- mkdir -p $RPM_SOURCES_DIR
176- mkdir -p $RPM_SPECS_DIR
177-
178- print_H2 " ===== Install RPM build tools..."
179- rpm -q rpm-build 2>&1 > /dev/null
180- if [ $? -eq 1 ]; then BUILD_TOOLS+=" rpm-build" ; fi
181- rpm -q rpmdevtools 2>&1 > /dev/null
182- if [ $? -eq 1 ]; then BUILD_TOOLS+=" rpmdevtools" ; fi
183- rpm -q make 2>&1 > /dev/null
184- if [ $? -eq 1 ]; then BUILD_TOOLS+=" make" ; fi
185- rpm -q patch 2>&1 > /dev/null
186- if [ $? -eq 1 ]; then BUILD_TOOLS+=" patch" ; fi
187-
188- if [ -f /etc/os-release ]; then
189- if [ " ${OS_LIKE} " = " rhel" ] && [ " ${OS_VERSION} " = " 9" ]; then
190- dnf -y install epel-release
191- dnf config-manager --set-enabled crb
192- dnf -y install clang
193- else
194- if [ " $OS_ID " = " fedora" ]; then
195- dnf -y install clang
196- else
197- print_H2 " >>>>> Can't find /etc/os-release - this OS is unsupported."
198- return 1
199- fi
200- fi
201- fi
202-
203- if [ " ${BUILD_TOOLS} " != " " ]; then
204- sudo yum -y install ${BUILD_TOOLS}
205- fi
206- }
207-
208- rpm_version ()
209- {
210- echo ` rpmspec -q --qf " %{version}-%{release}.%{arch}:" $1 | awk -F: ' {print $1}' `
211- }
212-
213- # $1 - path to spec file
214- build_rpm ()
215- {
216- SPEC_FILE=$1
217- spectool -g -R ${SPEC_FILE}
218- DEPS=` rpmspec -q --buildrequires ${SPEC_FILE} | awk -c ' {print $1}' `
219- sudo yum -y install ${DEPS}
220- rpmbuild -bb ${SPEC_FILE}
221- }
222-
223- # $1 - package name, $2 - rpm file path
224- install_rpm ()
225- {
226- rpm -q $1 2>&1 > /dev/null
227- if [ $? -eq 1 ]; then
228- INST_CMD=install
229- else
230- INST_CMD=reinstall
231- fi
232- sudo yum -y $INST_CMD $2
233- }
234-
235- # Bold
236- print_H1 ()
237- {
238- echo -e -n " \e[1m"
239- echo " ================================================================================"
240- echo -e -n " \e[1m"
241- echo -e " $1 "
242- echo -e -n " \e[1m"
243- echo " ================================================================================"
244- echo -e -n " \e[0m"
245- }
246-
247- # Brown
248- print_H2 ()
249- {
250- echo -e -n " \e[33m"
251- echo -e " $1 "
252- echo -e -n " \e[0m"
253- }
254-
255- # Green
256- print_OK ()
257- {
258- echo -e -n " \e[32m"
259- echo " ================================================================================"
260- echo -e -n " \e[32m"
261- echo -e " $1 "
262- echo -e -n " \e[32m"
263- echo " ================================================================================"
264- echo -e -n " \e[0m"
265- }
266-
267- # Red
268- print_ERR ()
269- {
270- echo -e -n " \e[31m"
271- echo " ================================================================================"
272- echo -e -n " \e[31m"
273- echo -e " $1 "
274- echo -e -n " \e[31m"
275- echo " ================================================================================"
276- echo -e -n " \e[0m"
277- }
278-
279- print_help ()
280- {
281- SCRIPT_NAME=` basename $0 `
282- print_ERR " ERROR: No NEXTSPACE directory specified."
283- printf " \n"
284- print_H2 " You have to specify directory where NEXTSPACE git clone resides."
285- print_H2 " For example, consider this scenario:"
286- printf " \n"
287- print_H2 " $ git clone https://github.com/trunkmaster/nextspace"
288- print_H2 " $ cd nextspace"
289- print_H2 " $ ./scripts/$SCRIPT_NAME ~/nextspace"
290- printf " \n"
291- }
0 commit comments