tags:

views:

492

answers:

1

I have to port one RPM (made for Fedora) to Ubuntu as a deb package.

In the RPM .spec file I'm using several variables ($RPM_BUILD_ROOT, %{_libdir}, %{name}, %{version}) to create a symlink:

%install
...
(cd $RPM_BUILD_ROOT/%{_bindir}; ln -sf %{_libdir}/%{name}-%{version}/%{name} . )

(Relative symlinks are forbidden (please don't ask why) -- that is why ln command looks strange.)

So, what are equivalents of those variables in debian/rules makefile?

Thanks in advance.

+1  A: 

(Aside: This seems like something that the upstream Makefile ought to be doing, instead of the downstream packaging.)

Depends on which framework you're using for your rules file.

In CDBS, something like this should work...

#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
# probably what you want (automagic happens),
# but I don't know details of your package
#include /usr/share/cdbs/1/class/automake.mk

DEBVERS := $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/^[[:digit:]]*://' -e 's/[~-].*//')

install/$(DEB_ALL_PACKAGES)::
        dh_link -p$(cdbs_curpkg) \
                /usr/lib/$(cdbs_curpkg)-$(VERSION)/$(cdbs_curpkg) \
                /usr/bin/$(cdbs_curpkg)

If you have a better way of getting the version (say, $(shell cat version.txt))), use it. The Debian version is not always the source package version; here, I strip out the epoch and packaging version, if any, but this isn't always correct.

Other CDBS classes might define $${libdir} and $${bindir}, but I haven't seen anything common.

Note that dh_link will make relative links if possible, even when given absolute paths. If this is a problem, you might have to resort to something really nasty like

        cd debian/$(cdbs_curpkg) && ln -s ...
ephemient
Thank you for the answer. I was using just a skeleton from dh_make. CDBS looks quite interesting.
Henry Flower
`dh_make -b` will give you a skeleton CDBS rules.
ephemient