File flatlaf.spec of Package flatlaf

#
# spec file for package flatlaf
#
# 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/
#


%global fonts_inter_version 4.1
%global fonts_jetbrains_mono_version 2.304
%global fonts_roboto_version 2.137
%global fonts_roboto_mono_version 3.000
Name:           flatlaf
Version:        3.6
Release:        0
Summary:        Swing Look and Feel
License:        Apache-2.0
Group:          Development/Libraries/Java
URL:            https://www.formdev.com/%{name}/
Source0:        https://github.com/JFormDesigner/FlatLaf/archive/refs/tags/%{version}.tar.gz
Source1:        https://repo1.maven.org/maven2/com/formdev/%{name}/%{version}/%{name}-%{version}.pom
Source2:        https://repo1.maven.org/maven2/com/formdev/%{name}-extras/%{version}/%{name}-extras-%{version}.pom
Source3:        https://repo1.maven.org/maven2/com/formdev/%{name}-swingx/%{version}/%{name}-swingx-%{version}.pom
Source4:        https://repo1.maven.org/maven2/com/formdev/%{name}-intellij-themes/%{version}/%{name}-intellij-themes-%{version}.pom
Source5:        https://repo1.maven.org/maven2/com/formdev/%{name}-fonts-inter/%{fonts_inter_version}/%{name}-fonts-inter-%{fonts_inter_version}.pom
Source6:        https://repo1.maven.org/maven2/com/formdev/%{name}-fonts-jetbrains-mono/%{fonts_jetbrains_mono_version}/%{name}-fonts-jetbrains-mono-%{fonts_jetbrains_mono_version}.pom
Source7:        https://repo1.maven.org/maven2/com/formdev/%{name}-fonts-roboto/%{fonts_roboto_version}/%{name}-fonts-roboto-%{fonts_roboto_version}.pom
Source8:        https://repo1.maven.org/maven2/com/formdev/%{name}-fonts-roboto-mono/%{fonts_roboto_mono_version}/%{name}-fonts-roboto-mono-%{fonts_roboto_mono_version}.pom
Source10:       %{name}.rpmlintrc
Patch0:         new-jsvg.patch
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  maven-local
BuildRequires:  mvn(com.fifesoft:autocomplete)
BuildRequires:  mvn(com.fifesoft:rsyntaxtextarea)
BuildRequires:  mvn(com.github.weisj:jsvg)
BuildRequires:  mvn(com.miglayout:miglayout-core)
BuildRequires:  mvn(org.swinglabs.swingx:swingx-all)
BuildRequires:  mvn(org.swinglabs.swingx:swingx-plaf)
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(x11)

%description
FlatLaf is a modern open-source cross-platform Look and Feel for Java Swing
desktop applications.

It looks almost flat (no shadows or gradients), clean, simple and elegant.
FlatLaf comes with Light, Dark, IntelliJ and Darcula themes, scales on HiDPI
displays and runs on Java 8 or newer (LTS and latest).

The look is heavily inspired by Darcula and IntelliJ themes from IntelliJ IDEA
2019.2+ and uses almost the same colors and icons.

%package javadoc
Summary:        API documentation for %{name}
Group:          Documentation/HTML
BuildArch:      noarch

%description javadoc
API documentation for %{name}.

%package theme-editor
Summary:        FlatLaf theme editor
Group:          Development/Tools/GUI Builders
BuildArch:      noarch
Requires(post): hicolor-icon-theme
Requires(post): update-desktop-files
Requires(postun): hicolor-icon-theme
Requires(postun): update-desktop-files

%description theme-editor
The FlatLaf Theme Editor supports editing FlatLaf theme properties files.

%prep
%setup -q -n FlatLaf-%{version}
%patch -P 0 -p1

rm %{name}-core/src/main/resources/com/formdev/flatlaf/natives/*

cp %{SOURCE1} %{name}-core/pom.xml
cp %{SOURCE2} %{name}-extras/pom.xml
cp %{SOURCE3} %{name}-swingx/pom.xml
cp %{SOURCE4} %{name}-intellij-themes/pom.xml
cp %{SOURCE5} %{name}-fonts/%{name}-fonts-inter/pom.xml
cp %{SOURCE6} %{name}-fonts/%{name}-fonts-jetbrains-mono/pom.xml
cp %{SOURCE7} %{name}-fonts/%{name}-fonts-roboto/pom.xml
cp %{SOURCE8} %{name}-fonts/%{name}-fonts-roboto-mono/pom.xml

%pom_xpath_remove 'pom:scope[.="runtime"]' %{name}-{extras,swingx,intellij-themes}

%pom_add_dep org.swinglabs.swingx:swingx-all %{name}-swingx
%pom_add_dep com.miglayout:miglayout-core %{name}-core

cat <<__POM__ >pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project
	xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd"
	>
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.formdev</groupId>
	<artifactId>%{name}-parent</artifactId>
	<name>Flat Look and Feel</name>
	<version>%{version}</version>
	<packaging>pom</packaging>
	<modules>
		<module>%{name}-core</module>
		<module>%{name}-extras</module>
		<module>%{name}-swingx</module>
		<module>%{name}-intellij-themes</module>
		<module>%{name}-theme-editor</module>
		<module>%{name}-fonts/%{name}-fonts-inter</module>
		<module>%{name}-fonts/%{name}-fonts-jetbrains-mono</module>
		<module>%{name}-fonts/%{name}-fonts-roboto</module>
		<module>%{name}-fonts/%{name}-fonts-roboto-mono</module>
	</modules>
</project>
__POM__

cat <<__POM__ >%{name}-theme-editor/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project
	xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd"
	>
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.formdev</groupId>
	<artifactId>%{name}-theme-editor</artifactId>
	<name>Flat Look and Feel — Theme Editor</name>
	<version>%{version}</version>
</project>
__POM__

%pom_change_dep com.formdev:%{name} com.formdev:%{name}:%{version}:compile: \
	%{name}-fonts/%{name}-fonts-{inter,jetbrains-mono,roboto{,-mono}}

%pom_add_dep com.formdev:%{name}:%{version} %{name}-theme-editor
%pom_add_dep com.formdev:%{name}-extras:%{version} %{name}-theme-editor
%pom_add_dep com.fifesoft:rsyntaxtextarea %{name}-theme-editor
%pom_add_dep com.fifesoft:autocomplete %{name}-theme-editor
%pom_add_dep com.miglayout:miglayout-swing %{name}-theme-editor
%pom_add_dep com.formdev:%{name}-fonts-inter:%{fonts_inter_version} %{name}-theme-editor
%pom_add_dep com.formdev:%{name}-fonts-jetbrains-mono:%{fonts_jetbrains_mono_version} %{name}-theme-editor
%pom_add_dep com.formdev:%{name}-fonts-roboto:%{fonts_roboto_version} %{name}-theme-editor
%pom_add_dep com.formdev:%{name}-fonts-roboto-mono:%{fonts_roboto_mono_version} %{name}-theme-editor

%build
g++ -fPIC -shared -Wl,-soname,lib%{name}-natives-linux.so \
	-I %{name}-natives/%{name}-natives-linux/src/main/headers \
	-I %{_jvmdir}/java/include -I %{_jvmdir}/java/include/linux \
%ifarch i586
	-o %{name}-core/src/main/resources/com/formdev/%{name}/natives/lib%{name}-linux-x86.so \
%else
	-o %{name}-core/src/main/resources/com/formdev/%{name}/natives/lib%{name}-linux-%{_arch}.so \
%endif
	$(pkg-config --libs --cflags x11) \
	%{name}-natives/%{name}-natives-linux/src/main/cpp/*.cpp

%{mvn_build} -f -- \
	-Dproject.build.outputTimestamp=$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ)

%install
%{mvn_package} :%{name}-parent __noinstall
%{mvn_package} :%{name}-theme-editor theme-editor

%mvn_install
%fdupes %{buildroot}%{_javadocdir}/%{name}

ln -s %{_jnidir}/%{name}/%{name}.jar %{buildroot}%{_javadir}/%{name}/
echo %{_javadir}/%{name}/%{name}.jar >>.mfiles

%jpackage_script com.formdev.flatlaf.themeeditor.FlatLafThemeEditor "" "" %{name}:rsyntaxtextarea:autocomplete:jsvg:miglayout:swingx %{name}-theme-editor true

install -dm0755 %{buildroot}%{_datadir}/applications
cat <<__DESKTOP__ >%{buildroot}%{_datadir}/applications/%{name}-theme-editor.desktop
[Desktop Entry]
Name=FlatLaf Theme Editor
Comment=Editing FlatLaf properties files
Exec=%{name}-theme-editor
Terminal=false
Type=Application
Icon=%{name}
Categories=Development;GUIDesigner;
__DESKTOP__

install -dm0755 %{buildroot}%{_datadir}/icons/hicolor/scalable/apps
install -Dm0644 %{name}-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLaf.svg \
	%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg

%post theme-editor
%desktop_database_post
%icon_theme_cache_post
:

%postun theme-editor
%desktop_database_postun
%icon_theme_cache_postun
:

%files -f .mfiles
%license LICENSE
%doc {CHANGELOG,README}.md

%files theme-editor -f .mfiles-theme-editor
%license LICENSE
%{_bindir}/%{name}-theme-editor
%{_datadir}/applications/%{name}-theme-editor.desktop
%{_datadir}/icons/hicolor

%files javadoc -f .mfiles-javadoc
%license LICENSE

%changelog
openSUSE Build Service is sponsored by