File vuze.spec of Package vuze

#
# spec file for package vuze
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


Name:           vuze
Version:        5.7.6.0
Release:        0
Summary:        A BitTorrent Client
License:        GPL-2.0-or-later
URL:            https://www.vuze.com/
Source0:        http://downloads.sourceforge.net/azureus/Vuze_5760_source.zip
Source2:        vuze.desktop
Source4:        build.xml
# PATCH-FIX-ALT-LINUX/FEDORA
Patch0:         azureus-remove-manifest-classpath.patch
Patch1:         azureus-no-shared-plugins.patch
Patch2:         azureus-SecureMessageServiceClientHelper-bcprov.patch
Patch5:         azureus-4.2.0.4-java5.patch
Patch6:         azureus-4.8.1.2-no-bundled-apache-commons.patch
Patch7:         azureus-5.2.0.0-startupScript.patch
Patch8:         azureus-5.2-no-bundled-json.patch
Patch9:         azureus-5.3.0.0-no-bundled-bouncycastle
Patch10:        azureus-5.4.0.0-fix_compile.patch
Patch11:        vuze-5.3.0.0-disable-updaters.patch
# PATCH-FIX-UPSTREAM https://github.com/BiglySoftware/BiglyBT/pull/559
Patch12:        azureus-5.7.6.0-relicense-allan-crooks-files.patch
Patch13:        vuze-commons-cli.patch
BuildRequires:  ant
BuildRequires:  apache-commons-cli
BuildRequires:  apache-commons-lang3
BuildRequires:  bouncycastle >= 1.33
BuildRequires:  desktop-file-utils
BuildRequires:  eclipse-swt >= 3.5
BuildRequires:  hicolor-icon-theme
BuildRequires:  jpackage-utils >= 1.5
BuildRequires:  json-simple
BuildRequires:  junit
BuildRequires:  reload4j
BuildRequires:  unzip
BuildRequires:  xml-commons-apis
Requires:       apache-commons-cli
Requires:       apache-commons-lang3
Requires:       bouncycastle >= 1.33
Requires:       eclipse-swt >= 3.5
Requires:       java >= 1.6.0
Requires:       json-simple
Requires:       reload4j
Provides:       azureus = %{version}-%{release}
BuildArch:      noarch

%description
Azureus (now Vuze) implements the BitTorrent protocol using java
and comes bundled with many invaluable features for both beginners and
advanced users.

%prep
%setup -q -c

cp %{SOURCE4} .

%patch -P 0 -p1 -b .remove-manifest-classpath
%patch -P 1 -p1 -b .no-shared-plugins

%patch -P 2 -p1 -b .nobcprov

rm org/gudy/azureus2/ui/swt/osx/CarbonUIEnhancer.java
rm org/gudy/azureus2/ui/swt/osx/Start.java
rm org/gudy/azureus2/ui/swt/win32/Win32UIEnhancer.java

%patch -P 5 -p1 -b .java5

%patch -P 6 -p1 -b .no-bundled-apache-commons

%patch -P 7 -p1 -b .startupScript

%patch -P 8 -p1 -b .no-bundled-json
%patch -P 9 -p1 -b .no-bundled-bouncycastle
%patch -P 10 -p1 -b .5.4.0.0_fix_compile
%patch -P 11 -p1 -b .disable_updaters
%patch -P 12 -p1 -b .gplv2orlater
%patch -P 13 -p1 -b .commons-cli

# nuke this file to avoid any confusion of licensing
rm -rf org/gudy/azureus2/ui/console/multiuser/TestUserManager.java

# hacks to org.eclipse.swt.widgets.Tree2 don't compile.
rm -fR org/eclipse

# avoid use of removed API
sed -i -e 's/getEncoded()/getEncoded(false)/' com/aelitis/azureus/core/security/CryptoECCUtils.java
rm META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor org/gudy/azureus2/core3/util/spi/AENameServiceDescriptor.java

# fix line endings
sed -i 's/\r//' ChangeLog.txt
chmod 644 *.txt

# remove bundled libs
rm -fR org/apache
rm -fR org/bouncycastle
rm -fR org/gudy/bouncycastle
rm -fR org/json
#rm -fR org/pf

# trivial port to apache-commons-lang3
for i in $(find -name "*.java"); do
    sed -i "s/org.apache.commons.lang./org.apache.commons.lang3./g" $i;
    sed -i "s/escapeHtml(/escapeHtml4(/g" $i;
done

%build
mkdir -p build/libs
build-jar-repository -p build/libs bcprov apache-commons-cli reload4j junit apache-commons-lang3 json-simple swt

ant jar

%install
install -dm 755 %{buildroot}%{_datadir}/azureus/plugins
install -pm 644 dist/Azureus2.jar %{buildroot}%{_datadir}/azureus/Azureus2.jar

install -p -D -m 0755 org/gudy/azureus2/platform/unix/startupScript %{buildroot}%{_bindir}/vuze

install -Dm 644 org/gudy/azureus2/ui/icons/a16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/vuze.png
install -Dm 644 org/gudy/azureus2/ui/icons/a32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/vuze.png
install -Dm 644 org/gudy/azureus2/ui/icons/a64.png %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/vuze.png

mkdir -p %{buildroot}%{_datadir}/applications
desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE2}

sed -i 's#JAVA_PROGRAM_DIR="%{_prefix}/lib/jvm/jre/bin/"#JAVA_PROGRAM_DIR="%{_bindir}/"#g' %{buildroot}%{_bindir}/%{name}

%files
%doc ChangeLog.txt
%license GPL.txt
%{_datadir}/applications/vuze.desktop
%{_datadir}/icons/hicolor/*x*/apps/vuze.png
%{_bindir}/vuze
%{_datadir}/azureus

%changelog
openSUSE Build Service is sponsored by