archrelease: copy trunk to community-any
[ArchLinux/community.git] / mysql-workbench / repos / community-x86_64 / PKGBUILD
blob300d774f6a87422abd76131fca2641415f8ca4b0
1 # Maintainer: Christian Hesse <mail@eworm.de>
2 # Contributor: Alexandre Boily <alexandreboily@gmail.com>
3 # Contributor: Illarion Kovalchuk <illarion.kovalchuk@gmail.com>
4 # Contributor: totoloco <totoloco at gmail _dot_com>
5 # Contributor: Ionut Biru <ibiru@archlinux.org>
7 pkgname=mysql-workbench
8 pkgver=8.0.33
9 pkgrel=3
10 _mysql_version=${pkgver}
11 _connector_version=${pkgver}
12 _gdal_version=3.6.3
13 _boost_version=1.77.0
14 # bump the antlr4 version as required, this is to match the jar file name
15 _antlr4_version=4.12.0
16 pkgdesc='A cross-platform, visual database design tool developed by MySQL'
17 arch=('x86_64')
18 url='https://www.mysql.com/products/workbench/'
19 license=('GPL2')
20 depends=('cairo' 'antlr4-runtime' 'curl' 'desktop-file-utils' 'freetype2' 'giflib'
21          'gtkmm3' 'hicolor-icon-theme' 'json-c' 'libgl' 'libsecret' 'libssh' 'libaio'
22          'libxml2' 'libzip' 'pcre' 'proj' 'python' 'rapidjson' 'unixodbc'
23          'vsqlite++' 'zstd')
24 makedepends=('cmake' 'boost' 'mesa' 'swig' 'java-runtime' 'imagemagick' 'gcc12'
25              "antlr4=${_antlr4_version}" "antlr4-runtime=${_antlr4_version}")
26 validpgpkeys=('859BE8D7C586F538430B19C2467B942D3A79BD29') # MySQL Release Engineering <mysql-build@oss.oracle.com>
27 source=("https://cdn.mysql.com/Downloads/MySQLGUITools/mysql-workbench-community-${pkgver}-src.tar.gz"{,.asc}
28         "https://cdn.mysql.com/Downloads/MySQL-${_mysql_version%.*}/mysql-${_mysql_version}.tar.gz"{,.asc}
29         "https://cdn.mysql.com/Downloads/Connector-C++/mysql-connector-c++-${_connector_version}-src.tar.gz"{,.asc}
30         "https://download.osgeo.org/gdal/${_gdal_version}/gdal-${_gdal_version}.tar.xz"
31         "https://downloads.sourceforge.net/project/boost/boost/${_boost_version}/boost_${_boost_version//./_}.tar.bz2"
32         '0001-mysql-workbench-no-check-for-updates.patch'
33         '0002-disable-unsupported-operating-system-warning.patch'
34         '0003-include-list.patch'
35         'arch_linux_profile.xml')
36 sha256sums=('a6c9b05ee6f8accd45203d8234a43415da65ddc8118d427dd1a2ef2a209261bc'
37             'SKIP'
38             '962002f5d906f42f40b277a39d2db93931248c1f07ff8f4312c288e63803dd12'
39             'SKIP'
40             '160cf6881fbde9bd46cd11aaf12930b676bc6e27589ac5c7ba49c196b97e053b'
41             'SKIP'
42             '3cccbed883b1fb99b913966aa3a650ad930e7c3afc714f5823f9754176ee49ea'
43             'fc9f85fc030e233142908241af7a846e60630aa7388de9a5fafb1f3a26840854'
44             'cdf687f23bc6e8d52dbee9fa02b23d755e80f88476f0fc2e7c4c71cdfed3792f'
45             '2d0f6dcf38f22e49ef7ab9de0230484f1ffac41b7ac40feaf5ef4538ae2f7a18'
46             'e7e66ba68a21a0da87f0513f2b9550359c923a94aa7d16afe6ead063322e3d53'
47             'd816164098c90c432b4fe590708c14f95ab137abfe16ad1b7d498b2e83c0e265')
49 prepare() {
50         cd "${srcdir}/mysql-workbench-community-${pkgver}-src/"
52         # Disable 'Help' -> 'Check for Updates'
53         # Updates are provided via Arch Linux packages
54         patch -Np1 < "${srcdir}"/0001-mysql-workbench-no-check-for-updates.patch
56         # disable unsupported operating system warning
57         patch -Np1 < "${srcdir}"/0002-disable-unsupported-operating-system-warning.patch
59         # add missing include
60         patch -Np1 < "${srcdir}"/0003-include-list.patch
62         # remove '-Werror'
63         sed -i '/^\s*set/s| -Werror||' CMakeLists.txt
65         # GCC 7.x complains about unsupported flag
66         sed -i 's| -Wno-deprecated-register||' ext/scintilla/gtk/CMakeLists.txt
68         # be happy with more recent antlr
69         sed -i "/set(ANTLR_JAR_FILENAME/s/4.11.1/${_antlr4_version}/" CMakeLists.txt
72 build() {
73         # Build mysql
74         mkdir "${srcdir}/mysql-${_mysql_version}-build"
75         cd "${srcdir}/mysql-${_mysql_version}-build"
76         echo "Configure mysql..."
77         cmake "${srcdir}/mysql-${_mysql_version}" \
78                 -DWITHOUT_SERVER=ON \
79                 -DBUILD_CONFIG=mysql_release \
80                 -DCMAKE_INSTALL_PREFIX=/usr \
81                 -DSYSCONFDIR=/etc/mysql \
82                 -DMYSQL_DATADIR=/var/lib/mysql \
83                 -DWITH_BOOST="${srcdir}/boost_${_boost_version//./_}"
84         echo "Build mysql..."
85         make
86         echo "Install mysql..."
87         make DESTDIR="${srcdir}/install-bundle/" install
89         # Build mysql-connector-c++
90         mkdir "${srcdir}/mysql-connector-c++-${_connector_version}-src-build"
91         cd "${srcdir}/mysql-connector-c++-${_connector_version}-src-build"
92         echo "Configure mysql-connector-c++..."
93         cmake "${srcdir}/mysql-connector-c++-${_connector_version}-src" \
94                 -Wno-dev \
95                 -DCMAKE_INSTALL_PREFIX=/usr \
96                 -DCMAKE_BUILD_TYPE=Release \
97                 -DINSTALL_LIB_DIR=lib \
98                 -DMYSQL_DIR="${srcdir}/install-bundle/" \
99                 -DMYSQL_CONFIG_EXECUTABLE="${srcdir}/install-bundle/usr/bin/mysql_config" \
100                 -DWITH_JDBC=ON
101         echo "Build mysql-connector-c++..."
102         make
103         echo "Install mysql-connector-c++..."
104         make DESTDIR="${srcdir}/install-bundle/" install
106         # Build gdal
107         cd "${srcdir}/"
108         echo "Configure gdal..."
109         cmake -B build-gdal -S "${srcdir}/gdal-${_gdal_version}" \
110                 -DCMAKE_INSTALL_PREFIX='/usr' \
111                 -DGDAL_USE_JASPER='OFF' \
112                 -DGDAL_USE_MYSQL='OFF'
113         echo "Build gdal..."
114         make LD_LIBRARY_PATH="${srcdir}/install-bundle/usr/lib/" -C build-gdal
115         echo "Install gdal..."
116         make LD_LIBRARY_PATH="${srcdir}/install-bundle/usr/lib/" DESTDIR="${srcdir}/install-bundle/" -C build-gdal install
117         ln -s '.' "${srcdir}/install-bundle/usr/include/gdal"
119         # fix build with gcc 12.x for now...
120         # TODO: remove when fixed upstream
121         export CXX=/usr/bin/g++-12
122         export CC=/usr/bin/gcc-12
124         # Build MySQL Workbench itself with bundled libs
125         mkdir "${srcdir}/mysql-workbench-community-${pkgver}-src-build"
126         cd "${srcdir}/mysql-workbench-community-${pkgver}-src-build"
127         echo "Configure mysql-workbench..."
128         cmake "${srcdir}/mysql-workbench-community-${pkgver}-src" \
129                 -Wno-dev \
130                 -DCMAKE_INSTALL_PREFIX:PATH=/usr \
131                 -DCMAKE_CXX_FLAGS="-std=c++17" \
132                 -DCMAKE_BUILD_TYPE=Release \
133                 -DMySQL_CONFIG_PATH="${srcdir}/install-bundle/usr/bin/mysql_config" \
134                 -DMySQLCppConn_LIBRARY="${srcdir}/install-bundle/usr/lib/libmysqlcppconn.so" \
135                 -DMySQLCppConn_INCLUDE_DIR="${srcdir}/install-bundle/usr/include/jdbc" \
136                 -DGDAL_INCLUDE_DIR="${srcdir}/install-bundle/usr/include" \
137                 -DGDAL_LIBRARY="${srcdir}/install-bundle/usr/lib/libgdal.so" \
138                 -DUNIXODBC_CONFIG_PATH='/usr/bin/odbc_config' \
139                 -DUSE_BUNDLED_MYSQLDUMP=1 \
140                 -DWITH_ANTLR_JAR="/usr/share/java/antlr-${_antlr4_version}-complete.jar"
141         echo "Build mysql-workbench..."
142         make
145 package() {
146         # install bundled libraries
147         for LIBRARY in $(find "${srcdir}/install-bundle/usr/lib/" -type f -regex '.*/lib\(gdal\|mysql\(client\|cppconn\)\)\.so\..*'); do
148                 BASENAME="$(basename "${LIBRARY}")"
149                 SONAME="$(readelf -d "${LIBRARY}" | grep -Po '(?<=(Library soname: \[)).*(?=\])')"
150                 install -D -m0755 "${LIBRARY}" "${pkgdir}"/usr/lib/mysql-workbench/"${BASENAME}"
151                 ln -s "${BASENAME}" "${pkgdir}"/usr/lib/mysql-workbench/"${SONAME}"
152         done
154         # install bundled mysql and mysqldump
155         install -m0755 "${srcdir}/install-bundle/usr/bin/mysql"{,dump} "${pkgdir}"/usr/lib/mysql-workbench/
157         # install MySQL Workbench itself
158         cd "${srcdir}/mysql-workbench-community-${pkgver}-src-build"
160         make DESTDIR="${pkgdir}" install
162         # icons
163         for SIZE in 16 24 32 48 64 96 128; do
164                 # set modify/create for reproducible builds
165                 convert -scale ${SIZE} +set date:create +set date:modify \
166                         "${srcdir}/mysql-workbench-community-${pkgver}-src/images/icons/MySQLWorkbench-128.png" \
167                         "${srcdir}/mysql-workbench.png"
168                 install -D -m0644 "${srcdir}/mysql-workbench.png" "${pkgdir}/usr/share/icons/hicolor/${SIZE}x${SIZE}/apps/mysql-workbench.png"
169         done
171         install -D -m 0644 "${srcdir}"/arch_linux_profile.xml \
172                 "${pkgdir}"/usr/share/mysql-workbench/mysql.profiles/Arch_Linux_\(MariaDB\).xml