TillMaas/Packaging

From FedoraProject

Jump to: navigation, search

python

%prep
%setup -q -n %{name}-%{version}


%build
python setup.py build


%install
rm -rf $RPM_BUILD_ROOT
mkdir $RPM_BUILD_ROOT

python setup.py install --skip-build --root $RPM_BUILD_ROOT

Haskell

%define ghc_version %(ghc --numeric-version)
%define ghcver ghc%(echo %{ghc_version} | tr --delete .)
%define cabalsetup Setup.lhs

%define debug_package %{nil}

Requires:       %{ghcver}-%{name}

ExcludeArch:    ppc64


%package -n %{ghcver}-%{name}
Summary:         :TODO:
Group:           Development/Libraries
Requires(preun): %{_bindir}/ghc-pkg-%{ghc_version}
Requires(post):  %{_bindir}/ghc-pkg-%{ghc_version}


%build
runhaskell %{cabalsetup} configure \
--with-compiler=%{_bindir}/ghc-%{ghc_version} \
--prefix=%{_prefix} \
--bindir=%{_bindir} \
--datadir=%{_datadir} \
--libdir=%{_libdir} \
--libexecdir=%{_libexecdir}

runhaskell %{cabalsetup} build


%install
rm -rf $RPM_BUILD_ROOT
runhaskell %{cabalsetup} copy --destdir=$RPM_BUILD_ROOT

install .installed-pkg-config $RPM_BUILD_ROOT%{_libdir}/%{name}-%{version}/ghc-%{ghc_version}/%{name}.pkg

%post -n %{ghcver}-%{name}
ghc-pkg-%{ghc_version} -u -g -i %{_libdir}/%{name}-%{version}/ghc-%{ghc_version}/%{name}.pkg


%preun -n %{ghcver}-%{name}
if [ "$1" = 0 ] ; then
rm -f %{_libdir}/%{name}-%{version}/*.o
ghc-pkg-%{ghc_version} -r %{name}-%{version} || :
fi

%files
%defattr(-,root,root,-)


%files -n %{ghcver}-%{name}
%defattr(-,root,root,-)
%doc LICENSE
%{_libdir}/%{name}-%{version}

Old: ghc-pkg-%{ghc_version} -u -g -i %{_libdir}/%{name}-%{version}/ghc-%{ghc_version}/%{name}.pkg New: ghc-pkg-%{ghc_version} --auto-ghci-libs update %{_libdir}/%{name}-%{version}/ghc-%{ghc_version}/%{name}.pkg &> /dev/null

Old: ghc-pkg-%{ghc_version} -r %{name}-%{version} || : New: ghc-pkg-%{ghc_version} unregister %{name}-%{version} &> /dev/null || :