Linux/Fedora
From Sigrok
This page describes how to build or install sigrok on Fedora Linux. For more information that is not related to sigrok see the fedora page about building RPM packages.
Contents |
Packaging
You need to install the Fedora rpm development group. As root:
$ yum groupinstall "Development Tools" $ yum install rpmdevtools
Once you're logged in as the user who is creating packages, create the directory structure in your home directory by executing:
$ rpmdev-setuptree
The rpmdev-setuptree program will create a ~/rpmbuild directory. Underneath rpmbuild are a set of subdirectories (such SPECS and BUILD), which you will use for creating your packages. The rpmdev-setuptree also creates an ~/.rpmmacros file which will cause rpm and rpmbuild to use them when appropriate. Then create in the SPECS folder the sigrok.spec file which is described below. And also in the SOURCES directory the needed patch for the paths. So the directory structure should like this:
rpmbuild │ ├── BUILD │ └── sigrok-0.1 ├── BUILDROOT ├── RPMS │ └── i686 ├── SOURCES │ ├── sigrok-0.1-qmake_fix.patch │ ├── sigrok-0.1.tar.gz ├── SPECS │ └── sigrok.spec └── SRPMS └── sigrok-0.1-1.fc12.src.rpm
First create the tar.gz file from the git repository with the correct version number. So all the files should be put for version 0.1 in sigrok-0.1 directory and then be tarred with tar -czvf sigrok-0.1.tar.gz sigrok-0.1/ Then cd to the SPECS folder and execute rpmbuild -ba sigrok.spec and everything should build and work as expected. Then you can find the RPM file in the RPMS subdirectory.
Spec file
file: sigrok.spec
Name: sigrok
Version: 0.1
Release: 1%{?dist}
Summary: Logic analyzer software that supports various (usually USB-based) hardware logic analyzers.
Group: Research
License: GPL
URL: http://sigrok.org
Source: http://sigrok.xor-gate.org/%{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Patch1: sigrok-0.1-qmake_fix.patch
Requires: qt libftdi glib2 libusb1 libzip python
BuildRequires: glib2-devel libusb1-devel libzip-devel python-devel qt-devel
BuildRequires: libftdi-devel libtool
%description
%prep
%setup -q
%patch1 -p1 -b .qmake_fix
%build
# Create libsigrok and libsigrokdecode
./autogen.sh
%configure
make %{?_smp_mflags}
# Create sigrok-cli
cd cli
make
# Create sigrok-gui
cd ../gui
qmake-qt4
lrelease-qt4 sigrok-gui.pro
qmake-qt4
make
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
cd cli
make install DESTDIR=$RPM_BUILD_ROOT
cd ../gui
make install INSTALL_ROOT=$RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{_bindir}/*
%{_includedir}/*
%{_libdir}/*
%{_datadir}/%{name}/
%{_mandir}/*
%doc
%changelog
* Wed Apr 28 2010 Jerry Jacobs <xor.gate.engineering[at]gmail[dot]com> - 0.1-1
- Initial RPM release.
Needed patches
Because some paths and are different on Fedora compared to other distributions like Debian we have apply one or more patches.
file: sigrok-0.1-qmake_fix.patch
--- sigrok.orig/gui/sigrok-gui.pro 2010-04-28 21:50:21.080060013 +0200 +++ sigrok-0.1/gui/sigrok-gui.pro 2010-04-28 21:29:50.369603240 +0200 @@ -45,18 +45,18 @@ CONFIG += link_pkgconfig debug_and_release build_all PKGCONFIG = gmodule-2.0 glib-2.0 libusb-1.0 libzip -LIBS += -L/usr/local/lib -L../libsigrok/.libs -L../libsigrokdecode \ +LIBS += -L/usr/lib -L../libsigrok/.libs -L../libsigrokdecode \ -lsigrok -lsigrokdecode -INCLUDEPATH += /usr/local/include ../libsigrok ../libsigrokdecode +INCLUDEPATH += /usr/include ../libsigrok ../libsigrokdecode RESOURCES += sigrok-gui.qrc # Installation -target.path = /usr/local/bin -locale.path = /usr/local/share/sigrok/translations +target.path = /usr/bin +locale.path = /usr/share/sigrok/translations locale.files = locale/*.qm -locale.extra = lrelease sigrok-gui.pro +locale.extra = lrelease-qt4 sigrok-gui.pro INSTALLS += target locale # Python @@ -86,3 +86,6 @@ #FILETYPES.path = Contents/Frameworks #QMAKE_BUNDLE_DATA += FILETYPES } + +!mac:unix:BIN_DIR = $(DESTDIR)/usr/bin +!mac:unix:DATA_DIR = $(DESTDIR)/usr/share/packagename
