Blob Blame History Raw
Name:		arduino
Version:	0021
Release:	2%{?dist}
Summary:	An IDE for Arduino-compatible electronics prototyping platforms
Group:		Development/Tools
License:	GPLv2+ and LGPLv2+ and CC-BY-SA
URL:		http://www.arduino.cc/

# There is presently no source tarball, so grab the code from git:
# curl -L http://github.com/arduino/Arduino/tarball/0021 | tar -xzvf - && mv arduino-Arduino-??????? arduino-0021 && rm -r arduino-0021/build/linux/dist/tools/* && find arduino-0021 \( -type d \( -name macosx -o -name windows \) -o -type f \( -iname '*.jar' -or -iname '*.tgz' -or -iname '*.so' \) \) -print0 | xargs -0 rm -rf && tar -cjf arduino-0021.tar.bz2 arduino-0021
# See also http://code.google.com/p/arduino/issues/detail?id=193
Source0:	%{name}-%{version}.tar.bz2

BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:	noarch

# Use unbundled libs:
Patch0:		arduino-script.patch
Patch1:		arduino-convert_to_debian_oro.patch
Patch2:		arduino-use-system-avrdude.patch
# Requested upstream in http://github.com/arduino/Arduino/pull/5:
Patch3:		arduino-use-system-rxtx.patch

# Requested upstream in http://github.com/arduino/Arduino/pull/6:
Patch4:		arduino-icons-etc.patch

# Shouldn't be necessary once
# https://code.google.com/p/arduino/issues/detail?id=106 has been fixed:
Patch5:		arduino-boards-txt.patch

BuildRequires:	java-devel >= 1:1.6.0 jpackage-utils ant ant-apache-regexp desktop-file-utils ecj jna oro rxtx git
Requires:	%{name}-core = %{version}-%{release}, %{name}-doc = %{version}-%{release}
Requires:	java >= 1:1.6.0 xorg-x11-fonts-Type1 ecj jna oro rxtx


%description
Arduino is an open-source electronics prototyping platform based on
flexible, easy-to-use hardware and software. It's intended for artists,
designers, hobbyists, and anyone interested in creating interactive
objects or environments.

This package contains an IDE that can be used to develop and upload code
to the micro-controller.


%package -n %{name}-core
Summary:	Files required for compiling code for Arduino-compatible micro-controllers
Group:		Development/Tools
Requires:	avr-gcc avr-gcc-c++ avr-libc avrdude


%description -n %{name}-core
Arduino is an open-source electronics prototyping platform based on
flexible, easy-to-use hardware and software. It's intended for artists,
designers, hobbyists, and anyone interested in creating interactive
objects or environments.

This package contains the core files required to compile and upload
Arduino code.


%package -n %{name}-doc
Summary:	Documentation for the Arduino micro-controller platform
Group:		Development/Tools
Requires:	avr-gcc avr-gcc-c++ avr-libc avrdude


%description -n %{name}-doc
Arduino is an open-source electronics prototyping platform based on
flexible, easy-to-use hardware and software. It's intended for artists,
designers, hobbyists, and anyone interested in creating interactive
objects or environments.

This package contains reference documentation.


%prep
%setup -q
find -name '*.class' -exec rm -f '{}' \;
find -name '*.jar' -exec rm -f '{}' \;
%patch0
%patch1
%patch2
%patch3 -p1
git apply -v %{PATCH4} >> /tmp/out
git apply --summary %{PATCH4} >> /tmp/out
%patch5
build-jar-repository -p -s app/lib/ ecj jna oro RXTXcomm


%build
cd core/methods
ant
cd ..
ant
cd ../build
ant dist < /dev/null
tar -xf linux/%{name}-%{version}.tgz


%install
cd build/%{name}-%{version}

mkdir -p $RPM_BUILD_ROOT/%{_bindir}
cp -a arduino $RPM_BUILD_ROOT/%{_bindir}/

mkdir -p $RPM_BUILD_ROOT/%{_datadir}/%{name}
cp -a hardware lib libraries $RPM_BUILD_ROOT/%{_datadir}/%{name}/
rm $RPM_BUILD_ROOT/%{_datadir}/%{name}/lib/*.jar
rm -r $RPM_BUILD_ROOT/%{_datadir}/%{name}/hardware/tools

mkdir -p $RPM_BUILD_ROOT/%{_defaultdocdir}/%{name}-%{version}
cp -a reference $RPM_BUILD_ROOT/%{_defaultdocdir}/%{name}-%{version}/
ln -s %{_defaultdocdir}/%{name}-%{version}/reference $RPM_BUILD_ROOT/%{_datadir}/%{name}/reference

# Requested upstream in http://github.com/arduino/Arduino/pull/4:
find $RPM_BUILD_ROOT -type f -iname *.jpg -or -iname *.java -or -iname *.pde -or -iname *.h -or -iname *.cpp -or -iname *.c -or -iname *.txt -or -iname makefile -or -iname key*.txt -or -iname pref*.txt | xargs chmod -x;

cp -a lib/core.jar lib/pde.jar $RPM_BUILD_ROOT/%{_datadir}/%{name}/

mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1
cp -p ../linux/%{name}.1 $RPM_BUILD_ROOT/%{_mandir}/man1/

desktop-file-install --dir=${RPM_BUILD_ROOT}%{_datadir}/applications ../linux/%{name}.desktop

for dir in ../linux/icons/*; do
    size=`basename $dir`
    mkdir -p $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/$size/apps
    cp $dir/%{name}.png $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/$size/apps/
done

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%{_bindir}/*
%{_datadir}/%{name}/*.jar
%{_datadir}/%{name}/lib/
%{_datadir}/applications/*
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_mandir}/man1/%{name}.1.gz
%{_datadir}/%{name}/reference


%files -n %{name}-core
%defattr(-,root,root,-)
%doc license.txt readme.txt todo.txt
%{_datadir}/%{name}/hardware/
%{_datadir}/%{name}/libraries/


%files -n %{name}-doc
%defattr(-,root,root,-)
%{_defaultdocdir}/%{name}-%{version}/


%changelog
* Fri Dec 17 2010 Peter Oliver <rpm@mavit.org.uk> - 0021-2
- Patch boards.txt to use the "arduino" programmer type for Uno boards,
  allowing Fedora's version of avrdude to work with these boards.

* Thu Oct  7 2010 Peter Oliver <rpm@mavit.org.uk> - 0021-1
- New upstream release 0021.
- Add patch for new upstream icons.
- Override device scan in RXTX to allow use of Arduino Uno.

* Mon Sep 20 2010 Peter Oliver <rpm@mavit.org.uk> - 0019-6
- Explictly mention documentation with doc macro.
- Move reference documentation into -doc package.

* Thu Sep  9 2010 Peter Oliver <rpm@mavit.org.uk> - 0019-5
- Add missing BuildRequires.
- Use build-jar-repository to locate java libraries to build against.
- Eliminate cross-package symlinks.

* Wed Sep  8 2010 Peter Oliver <rpm@mavit.org.uk> - 0019-4
- Make sure all jars are removed from the source bundle.
- Add missing documentation.

* Tue Sep  7 2010 Peter Oliver <rpm@mavit.org.uk> - 0019-3
- Split into two packages, making the IDE optional to install.
- Build during the build phase not the install phase.
- More dependencies.

* Mon Sep  6 2010 Peter Oliver <rpm@mavit.org.uk> - 0019-2
- Expanded dependencies.

* Sun Sep  5 2010 Peter Oliver <rpm@mavit.org.uk> - 0019-1
- Initial version.  Based in part on the Debian package.