File ghmessen.spec of Package ghmessen
#
# spec file for package ghmessen
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#
%if 0%{?fedora}
%global _missing_build_ids_terminate_build 0
%define debug_package %{nil}
%endif
#
# spec file for package ghmessen
#
# Copyright (c) 2015 Frank Schütte fschuett@gymnasium-himmelsthuer.de
#
# 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/
#
Name: ghmessen
BuildRequires: java-devel >= 1.9
Version: 0.23.0.git
Release: 0
Summary: Program to collect data from computer measuring interfaces like CASSY
License: GPL-2.0
Group: Amusements/Teaching/Other
Url: http://ghmessen2.sourceforge.net
Source: %{name}-%{version}.tar.gz
Source1: %{name}
Source2: %{name}.desktop
Source3: %{name}.xml
Source4: ghmessen.png
Source5: 48-ldusb-%{name}.rules
Source11: README.SUSE
Source12: %{name}.1.gz
Source31: cassylab.xml
BuildRequires: ant
BuildRequires: beansbinding >= 1.2.1
BuildRequires: bsaf >= 1.9.1
BuildRequires: desktop-file-utils
BuildRequires: java-devel >= 1.7
BuildRequires: jna >= 4.1.0
BuildRequires: rxtx-java
BuildRequires: shared-mime-info
BuildRequires: unzip
Requires: beansbinding >= 1.2.1
Requires: bsaf >= 1.9.1
Requires: dbus-java
Requires: desktop-file-utils
Requires: java >= 1.7
Requires: jna >= 4.1.0
Requires: jre >= 1.7
Requires: libGoIO2 >= 2.53.0
Requires: libc.so.6
Requires: libjnidispatch >= 4.1.0
Requires: libudev1
Requires: rxtx-java
Requires: shared-mime-info
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%undefine _missing_build_ids_terminate_build
%if 0%{?suse_version}
BuildRequires: fdupes
BuildRequires: update-desktop-files
%endif
%if ! 0%{?sles_version}
%if 0%{?suse_version} || 0%{?fedora}
BuildRequires: javahelp2
Requires: javahelp2
%endif
%endif
%description
The program GHMessen is used to collect data from computer measuring
interfaces like CASSY(trademark from Leybold). It is targeted for school usage.
%prep
%setup -q
%build
# nichts zu tun
ant clean
ant -DJNIDIR=%{_jnidir}
ant create_run_jar
%install
install -D dist/GHMessen.jar %{buildroot}%{_datadir}/ghmessen/GHMessen.jar
install -D lib/flanagan.jar %{buildroot}%{_datadir}/ghmessen/flanagan.jar
install -D lib/janino-2.5.11.jar %{buildroot}%{_datadir}/ghmessen/janino-2.5.11.jar
install -D lib/bridj-0.6.2-linux-only.jar %{buildroot}%{_datadir}/ghmessen/bridj-0.6.2-linux-only.jar
install -D dist/ldapi.jar %{buildroot}%{_datadir}/ghmessen/ldapi.jar
install -D dist/antlr-4.4-complete.jar %{buildroot}%{_datadir}/ghmessen/antlr-4.4-complete.jar
# create shell script
mkdir -p %{buildroot}%{_bindir}
cat <<- 'EOF' > %{buildroot}%{_bindir}/ghmessen
#!/bin/bash
#
# build class path and start app
#
export GHMESSEN=/usr/share/ghmessen
export JL=/usr/share/java
CLASSPATH=${GHMESSEN}/GHMessen.jar
for jar in flanagan janino-2.5.11 antlr-4.4-complete bridj-0.6.2-linux-only ldapi; do
CLASSPATH=${CLASSPATH}:${GHMESSEN}/${jar}.jar
done;
for jar in bsaf dbus beansbinding jna jna-platform; do
CLASSPATH=${CLASSPATH}:${JL}/${jar}.jar
done;
CLASSPATH=${CLASSPATH}:%{_jnidir}/RXTXcomm.jar
if [ -e ${JL}/javahelp2.jar ]; then
CLASSPATH=${CLASSPATH}:${JL}/javahelp2.jar
elif [ -e ${JL}/jh.jar ]; then
CLASSPATH=${CLASSPATH}:${JL}/jh.jar:${JL}/jh-client.jar
elif [ -e ${GHMESSEN}/javahelp2.jar ]; then
CLASSPATH=${CLASSPATH}:${GHMESSEN}/javahelp2.jar
fi
java -classpath $CLASSPATH ghmessen.GHMessen "$@"
exit 0
EOF
# create shell script finished
install -D %{SOURCE2} %{buildroot}%{_datadir}/applications/ghmessen.desktop
install -D %{SOURCE3} %{buildroot}%{_datadir}/mime/packages/ghmessen.xml
install -D %{SOURCE31} %{buildroot}%{_datadir}/mime/packages/cassylab.xml
install -D %{SOURCE4} %{buildroot}%{_datadir}/pixmaps/ghmessen.png
install -D %{SOURCE4} %{buildroot}%{_datadir}/icons/oxygen/256x256/mimetypes/ghmessen.png
install -D %{SOURCE4} %{buildroot}%{_datadir}/icons/hicolor/256x256/mimetypes/ghmessen.png
install -D %{SOURCE5} %{buildroot}%{_libexecdir}/udev/rules.d/48-ldusb-%{name}.rules
install -D %{SOURCE11} %{buildroot}/%{_docdir}/%{name}/README.SUSE
install -D %{SOURCE12} %{buildroot}%{_mandir}/man1/%{name}.1.gz
install -D src/ghmessen/ghmessen.dtd %{buildroot}%{_datadir}/ghmessen/dtd/ghmessen.dtd
%if 0%{?suse_version}
%fdupes %{buildroot}%{_datadir}/icons
%suse_update_desktop_file ghmessen
%endif
export NO_BRP_CHECK_BYTECODE_VERSION=true
%post
touch %{_datadir}/icons/oxygen
update-mime-database %{_datadir}/mime
update-desktop-database
# adding net users to lock group
FILE=%{_sysconfdir}/security/group.conf
WB="# ghmessen-BEGIN"
WE="# ghmessen-ENDE"
sed -e "/$WB/,/$WE/ d" -i $FILE
if grep -q "# End of group.conf file" $FILE; then
sed "
/^#.*/ {
N
/\n# End of group.conf file.*/ {
i\
$WB\n\
*;*;*;Al0000-2400;lock,dialout,lp\n\
$WE
}
P
D
}" -i $FILE
else
echo "$WB" >>$FILE
echo "*;*;*;Al0000-2400;lock,dialout,lp" >>$FILE
echo "$WE" >>$FILE
echo "#" >>$FILE
echo "# End of group.conf file" >>$FILE
echo "#" >>$FILE
fi
%postun
touch %{_datadir}/icons/oxygen
update-mime-database %{_datadir}/mime
update-desktop-database
if [ $1 -gt 0 ]; then
exit 0;
fi
# removing net users from group lock,dialout,lp
FILE=%{_sysconfdir}/security/group.conf
WB="# ghmessen-BEGIN"
WE="# ghmessen-ENDE"
sed -e "/$WB/,/$WE/ d" -i $FILE
%files
%defattr(755,root,root,755)
%{_bindir}/ghmessen
%attr(644,root,root) %{_mandir}/man1/ghmessen.1.gz
%{_datadir}/ghmessen
%attr(644,root,root) %{_datadir}/ghmessen/dtd/ghmessen.dtd
%dir %{_libexecdir}/udev
%dir %{_libexecdir}/udev/rules.d
%attr(644,root,root) %{_libexecdir}/udev/rules.d/48-ldusb-%{name}.rules
%attr(644,root,root) %{_datadir}/applications/ghmessen.desktop
%attr(644,root,root) %{_datadir}/mime/packages/ghmessen.xml
%attr(644,root,root) %{_datadir}/mime/packages/cassylab.xml
%attr(644,root,root) %{_datadir}/pixmaps/ghmessen.png
%{_datadir}/icons/oxygen
%attr(644,root,root) %{_datadir}/icons/oxygen/256x256/mimetypes/ghmessen.png
%{_datadir}/icons/hicolor
%attr(644,root,root) %{_datadir}/icons/hicolor/256x256/mimetypes/ghmessen.png
%dir %{_docdir}/%{name}
%doc %attr(644,root,root) %{_docdir}/%{name}/README.SUSE
%changelog