blob: 6ba943ae74d32e21111e3ed80b9412a1c838ed1b (
plain)
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
|
#!/bin/sh
LANG=C
run()
{
"$@"
if test $? -ne 0; then
echo "Failed $@"
exit 1
fi
}
rpmbuild_options=
. /vagrant/env.sh
distribution=$(cut -d " " -f 1 /etc/redhat-release | tr "A-Z" "a-z")
if grep -q Linux /etc/redhat-release; then
distribution_version=$(cut -d " " -f 4 /etc/redhat-release)
else
distribution_version=$(cut -d " " -f 3 /etc/redhat-release)
fi
distribution_version=$(echo ${distribution_version} | sed -e 's/\..*$//g')
architecture="$(arch)"
case "${architecture}" in
i*86)
architecture=i386
;;
esac
run yum groupinstall -y "Development Tools"
run yum install -y rpm-build rpmdevtools tar wget
if [ -x /usr/bin/rpmdev-setuptree ]; then
rm -rf .rpmmacros
run rpmdev-setuptree
else
run cat <<EOM > ~/.rpmmacros
%_topdir ${HOME}/rpmbuild
EOM
run mkdir -p ~/rpmbuild/SOURCES
run mkdir -p ~/rpmbuild/SPECS
run mkdir -p ~/rpmbuild/BUILD
run mkdir -p ~/rpmbuild/RPMS
run mkdir -p ~/rpmbuild/SRPMS
fi
repository="/vagrant/repositories/${distribution}/${distribution_version}"
rpm_dir="${repository}/${architecture}/Packages"
srpm_dir="${repository}/source/SRPMS"
run mkdir -p "${rpm_dir}" "${srpm_dir}"
rpmbuild_options=""
# for debug
# rpmbuild_options="${rpmbuild_options} --define 'optflags -O0 -g3'"
cd
run cp /vagrant/tmp/${PACKAGE}-${VERSION}.* rpmbuild/SOURCES/
run cp /vagrant/tmp/${distribution}/*.spec rpmbuild/SPECS/
package_name=$(cd rpmbuild/SPECS; echo *.spec | sed -e 's/\.spec$//g')
case ${distribution} in
fedora)
USE_MYSQLSERVICES_COMPAT=yes
run yum install -y mariadb-devel
;;
centos)
release_rpm=groonga-release-1.3.0-1.noarch.rpm
if [ ${distribution_version} = 5 ]; then
wget http://packages.groonga.org/${distribution}/${release_rpm}
run yum install -y --nogpgcheck ${release_rpm}
rm -f ${release_rpm}
else
run yum install -y \
http://packages.groonga.org/${distribution}/${release_rpm}
fi
run yum makecache
case ${package_name} in
mysql55-${PACKAGE})
USE_MYSQLSERVICES_COMPAT=yes
run yum install -y scl-utils-build
if [ ${distribution_version} = 6 ]; then
run yum install -y centos-release-scl
fi
run yum install -y mysql55-mysql-devel mysql55-build
;;
mysql5?-community-${PACKAGE})
release_rpm=mysql-community-release-el${distribution_version}-7.noarch.rpm
run yum -y install http://repo.mysql.com/${release_rpm}
if [ "${package_name}" = "mysql57-community-${PACKAGE}" ]; then
run yum install -y yum-utils
run yum-config-manager --disable mysql56-community
run yum-config-manager --enable mysql57-community
if [ ${distribution_version} = 6 ]; then
run yum install -y cmake28
fi
fi
run yum install -y mysql-community-devel
;;
mariadb-${PACKAGE})
run yum install -y mariadb-devel
;;
mariadb-10.1-${PACKAGE})
if [ "${architecture}" = "x86_64" ]; then
mariadb_architecture="amd64"
else
mariadb_architecture="x86"
fi
cat <<REPO > /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/${distribution}${distribution_version}-${mariadb_architecture}
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
REPO
run yum install -y MariaDB-devel
if [ ${distribution_version} = 6 ]; then
run yum install -y cmake28
fi
;;
mariadb-10.2-${PACKAGE})
if [ "${architecture}" = "x86_64" ]; then
mariadb_architecture="amd64"
else
mariadb_architecture="x86"
fi
cat <<REPO > /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/${distribution}${distribution_version}-${mariadb_architecture}
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
REPO
run yum install -y MariaDB-devel
if [ ${distribution_version} = 6 ]; then
run yum install -y cmake28
fi
;;
percona-server-56-${PACKAGE})
release_rpm_version=0.1-4
release_rpm=percona-release-${release_rpm_version}.noarch.rpm
run yum install -y http://www.percona.com/downloads/percona-release/redhat/${release_rpm_version}/${release_rpm}
run yum install -y Percona-Server-devel-56
;;
percona-server-57-${PACKAGE})
release_rpm_version=0.1-4
release_rpm=percona-release-${release_rpm_version}.noarch.rpm
run yum install -y http://www.percona.com/downloads/percona-release/redhat/${release_rpm_version}/${release_rpm}
run yum install -y Percona-Server-devel-57
if [ ${distribution_version} = 6 ]; then
run yum install -y cmake28
fi
;;
esac
;;
esac
run yum install -y ${DEPENDED_PACKAGES}
if [ "${package_name}" = "percona-server-56-${PACKAGE}" ]; then
if [ "${distribution_version}" = "7" ]; then
rpmbuild_options="$rpmbuild_options --define 'dist .el7'"
fi
fi
if [ "${package_name}" = "percona-server-57-${PACKAGE}" ]; then
if [ "${distribution_version}" = "7" ]; then
rpmbuild_options="$rpmbuild_options --define 'dist .el7'"
fi
fi
if [ "${USE_MYSQLSERVICES_COMPAT}" = "yes" ]; then
rpmbuild_options="$rpmbuild_options --define 'mroonga_configure_options --with-libmysqlservices-compat'"
fi
run eval rpmbuild -ba ${rpmbuild_options} rpmbuild/SPECS/${package_name}.spec
run mv rpmbuild/RPMS/*/* "${rpm_dir}/"
run mv rpmbuild/SRPMS/* "${srpm_dir}/"
|