bundle.cross
3.82 KB
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
#!/bin/bash
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# Copyright (C) 2023 Perry Werneck <perry.werneck@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
MINGW_PREFIX="/usr/x86_64-w64-mingw32/sys-root/mingw"
PKG_CONFIG="/usr/bin/x86_64-w64-mingw32-pkg-config"
MINGW_PACKAGE_PREFIX="mingw64"
REPOSITORY_NAME="pw3270"
# Load bundle functions
. "$(dirname $(readlink -f "${0}"))/bundle.gtk3"
argument "help" > /dev/null
if [ "$?" == "0" ]; then
echo " --install-requires Install required packages"
echo " --build Build application from source"
fi
prepare
# List of pre-req packages
# gdk-pixbuf-loader-rsvg
# List of pre-built packages
packages="lib3270 libv3270 libipc3270 libhllapi pw3270-plugin-ipc"
dev_packages="lib3270 libv3270 libipc3270"
install_prereqs() {
local list
local package
list="${packages}"
for package in ${dev_packages}
do
list="${list} ${package}-devel"
done
echo "Installing: ${list}"
REPONUMBER=$(zypper lr | grep "${REPOSITORY_NAME}" | cut -d\| -f1)
if [ -z "${REPONUMBER}" ]; then
echo "Cant locate repository ${REPOSITORY_NAME}"
exit -1
fi
sudo zypper ref ${REPONUMBER}
if [ "$?" != "0" ]; then
echo "Cant refresh repository ${REPOSITORY_NAME}"
exit -1
fi
for package in ${list}
do
sudo zypper in --repo ${REPONUMBER} "${MINGW_PACKAGE_PREFIX}-${package}"
if [ "$?" != "0" ]; then
echo "Cant install ${MINGW_PACKAGE_PREFIX}-${package} from ${REPOSITORY_NAME}"
exit -1
fi
done
}
argument "install-requires" > /dev/null
if [ "$?" == "0" ]; then
install_prereqs
fi
argument "build" > /dev/null
if [ "$?" == "0" ]; then
NOCONFIGURE=1 ./autogen.sh
if [ "$?" != "0" ]; then
echo "Configure failed"
exit -1
fi
${MINGW_PACKAGE_PREFIX}-configure
if [ "$?" != "0" ]; then
echo "Configure failed"
exit -1
fi
build_package
else
packages="${packages} pw3270"
fi
unpack_rpm() {
local package
local list
local PACKAGE_NAME
for package in ${packages}
do
PACKAGE_NAME=$(rpm -qa | grep "${MINGW_PACKAGE_PREFIX}-${package}" | grep -v devel | head --lines=1)
if [ -z "${PACKAGE_NAME}" ]; then
echo "No data from ${MINGW_PACKAGE_PREFIX}-${package}"
exit -1
fi
echo "Copy ${PACKAGE_NAME}"
for FILE in $(rpm -ql "${PACKAGE_NAME}")
do
if [ ! -d ${FILE} ]; then
FILEPATH="${buildroot}${FILE}"
mkdir -p "$(dirname ${FILEPATH})"
if [ "$?" != "0" ]; then
exit -1
fi
cp "${FILE}" "${FILEPATH}"
if [ "$?" != "0" ]; then
echo "Cant copy '${FILE}' from '${PACKAGE_NAME}'"
exit -1
fi
fi
done
done
for package in ${dev_packages}
do
PACKAGE_NAME=$(rpm -qa | grep "${MINGW_PACKAGE_PREFIX}-${package}" | grep devel | head --lines=1)
if [ -z "${PACKAGE_NAME}" ]; then
echo "No data from ${MINGW_PACKAGE_PREFIX}-${package}-devel"
exit -1
fi
echo "Copy ${PACKAGE_NAME}"
for FILE in $(rpm -ql "${PACKAGE_NAME}")
do
if [ ! -d ${FILE} ]; then
FILEPATH="${buildroot}${FILE}"
mkdir -p "$(dirname ${FILEPATH})"
if [ "$?" != "0" ]; then
exit -1
fi
cp "${FILE}" "${FILEPATH}"
if [ "$?" != "0" ]; then
echo "Cant copy '${FILE}' from '${PACKAGE_NAME}'"
exit -1
fi
fi
done
done
}
unpack_rpm
install_gtk3_runtime
install_license
make_packages
echo "Bundle build complete"