[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rules makefile and packaging basics

On Fri, Feb 11, 2011 at 06:27:34PM +0000, james frize wrote:
> Thanks Etienne,
> I think I'm starting to get it now, I'll have to read a bit more on
> how a makefile works before my next attempt, all this "binary target"
> stuff is confusing me.

debian/rules is a Makefile which has several targets (list of commands
that are named). One is 'install' which should copy files on a
suitable location, one is 'binary' which should build a .deb file from
the those copied files (hence the dependency : 'binary' can only be
run after 'install' is completed). Note that these names are just a
convention that is enforced by the debian policy.

> So, my current understanding is that the rules makefile tells it how
> and where to install the files, then dh_builddeb is called and that
> does the dirty work of actually installing the files??

As a Makefile writer, your job is to provide several targets that will
do the job (copy files, build deb, clean stuff, etc). How you
implement them is up to you : you could copy files with cp/install,
build a .deb file with low-level tools (tar, gzip, ar), but you should
instead use tools made for that. The debhelper suite (dh_* commands)
is widely used and you can find examples in existing packages (apt-get
source packagename).

> Not sure what you mean by - "You probably ran the build as root ('sudo
> debian/rules binary' or
> something like that)" The only command I use in the process that has
> sudo in it is - sudo dpkg-buildpackage, is this what you are referring
> to?

Yes, internally dpkg-buildpackage will call debian/rules, so it will
be invoked as root. This is an unnecessary priviledge. If you run
dpkg-buildpackage as your normal user, it won't be able to directly
install files to your host system during the build process, so it will
be safer.

> Thanks again for your help
> Jim.
> ps - I tried to email you on the debian-mentors list, but I couldn't
> use the mailto link as I only do email in browser. After copying the
> email address from the link it just spat out your personal
> email...sorry, I don't know how to email back to you on the list :(

I CC'd you, something like "reply to all" should work.

Etienne Millon

Etienne Millon

Attachment: signature.asc
Description: Digital signature

Reply to: