File dbeaver.spec of Package dbeaver

#
# spec file for dbeaver
#
# Copyright (c) 2025 kkaempf
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%define java_version 21
Name:           dbeaver
Version:        25.2.3
Release:        0
License:        Apache-2.0
Summary:        Free universal database tool and SQL client 
Url:            https://dbeaver.io

Source0:        https://github.com/%{name}/%{name}/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        https://github.com/%{name}/%{name}-common/archive/refs/heads/devel.zip#/%{name}-common-devel.zip
Source2:        https://github.com/%{name}/%{name}-jdbc-libsql/archive/refs/heads/devel.zip#/%{name}-jdbc-libsql-devel.zip
Source3:        https://github.com/%{name}/%{name}-deps-ce/archive/refs/heads/devel.zip#/%{name}-deps-ce-devel.zip
Source4:        https://github.com/%{name}/%{name}-osgi-common/archive/refs/heads/devel.zip#/%{name}-osgi-common-devel.zip
# See README
Source5:        m2.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildRequires:  maven
BuildRequires:  fdupes
BuildRequires:  java-devel = %{java_version}
BuildRequires:  unzip

Provides:       dbeaver = %{version}
Requires:       java = %{java_version}
Requires:       ca-certificates-mozilla

%description
Free multi-platform database tool for developers, SQL programmers,
database administrators and analysts.

Supports any database which has JDBC driver (which basically means - ANY
database). Commercial versions also support non-JDBC datasources such as
MongoDB, Cassandra, Couchbase, Redis, BigTable, ScyllaDB, DynamoDB, etc.

%prep
%setup -q
cd ..
unzip %{S:1}
mv dbeaver-common-devel dbeaver-common
unzip %{S:2}
mv dbeaver-jdbc-libsql-devel dbeaver-jdbc-libsql
unzip %{S:3}
mv dbeaver-deps-ce-devel dbeaver-deps-ce
unzip %{S:4}
mv dbeaver-osgi-common-devel dbeaver-osgi-common
tar xf %{S:5}

%build
cd ..
export NO_BRP_CHECK_BYTECODE_VERSION=true
export PROJECT_PREFIX=`readlink -e .`
export LANG=en_US.UTF-8

cd %{name}-deps-ce
mvn -Dmaven.repo.local=$PROJECT_PREFIX/m2 package
cd p2
mvn -Dmaven.repo.local=$PROJECT_PREFIX/m2 package
cd ../..

cd %{name}-%{version}
cd product/aggregate  
mvn \
  -Dmaven.repo.local=$PROJECT_PREFIX/m2 \
  --strict-checksums \
  -o \
  -T 1C \
  compile

%install
cd ..
export NO_BRP_CHECK_BYTECODE_VERSION=true
export PROJECT_PREFIX=`readlink -e .`
export LANG=en_US.UTF-8
cd %{name}-%{version}
cd product/aggregate  
mvn \
  -Dmaven.repo.local=$PROJECT_PREFIX/m2 \
  --strict-checksums \
  -o \
  -T 1C \
  install
cd ../..

mkdir -p %{buildroot}%{_libdir}
# remove unused binaries
(cd product/community/target/products/org.jkiss.dbeaver.core.product;
 rm -rf macos;
 rm -rf win32;
 cd linux/gtk/x86_64//dbeaver/plugins/com.sun.jna_5.17.0.v20250316-1700/com/sun/jna;
  rm -rf aix-ppc aix-ppc64;
  rm -rf darwin-aarch64 darwin-x86-64;
  rm -rf dragonflybsd-x86-64;
  rm -rf freebsd-aarch64 freebsd-x86 freebsd-x86-64;
  rm -rf linux-arm;
  rm -rf linux-armel;
  rm -rf linux-loongarch64;
  rm -rf linux-mips64el;
  rm -rf linux-ppc;
  rm -rf linux-ppc64le;
  rm -rf linux-riscv64;
  rm -rf linux-s390x;
  rm -rf linux-x86;
%ifarch aarch64
  rm -rf linux-x86-64;
%endif
%ifarch x86_64
  rm -rf linux-aarch64;
%endif
  rm -rf openbsd-x86;
  rm -rf openbsd-x86-64;
  rm -rf sunos-sparc;
  rm -rf sunos-sparcv9;
  rm -rf sunos-x86;
  rm -rf sunos-x86-64;
  rm -rf win32;
  rm -rf win32-aarch64;
  rm -rf win32-x86;
  rm -rf win32-x86-64;
)
cp -a product/community/target/products/org.jkiss.dbeaver.core.product/linux/gtk/x86_64/%{name} %{buildroot}%{_libdir}
rm %{buildroot}%{_libdir}/%{name}/p2/org.eclipse.equinox.p2.engine/profileRegistry/DefaultProfile.profile/.lock
chmod 644 %{buildroot}%{_libdir}/%{name}/icon.xpm
mkdir -p %{buildroot}%{_bindir}
(cd %{buildroot}%{_bindir}; ln -s %{_libdir}/%{name}/%{name} .)

%fdupes %{buildroot}%{_libdir}/%{name}

%files
%defattr(-,root,root)
%license LICENSE.md
%license docs/root/licenses/commons_license.txt
%license docs/root/licenses/dbeaver-community-license.txt
%license docs/root/licenses/eclipse_license.html
%license docs/root/licenses/gis-license.txt
%license docs/root/licenses/jsch-license.txt
%license docs/root/licenses/jsql-license.txt
%license docs/root/licenses/openai-license.txt
%license docs/root/licenses/poi-license.txt
%license docs/root/licenses/sshj-license.txt
%doc README.md
%doc SECURITY.md

%{_bindir}/%{name}
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/*
%{_libdir}/%{name}/.eclipseproduct

%changelog
openSUSE Build Service is sponsored by