Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Understanding debian/rules File

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
RyanEdward
Posts: 2
Joined: 2021-08-28 05:36

Understanding debian/rules File

#1 Post by RyanEdward »

At a high level I understand that the debian/rules file instructs debhelper as to how to build your package.

However, I'm confused regarding these two points:
  1. How does debhelper work? Is there a way I can see what specific commands it is executing? Take this example CMakeLists.txt file:

    Code: Select all

    cmake_minimum_required(VERSION 3.13)
    project(example)
    add_executable(example example.c)  
    How does debhelper automagically translate this? What does the default:

    Code: Select all

    %: 
    	dh $@ 
    actually equate to?
  2. If I have don't have a buildtool and compile with a shell script:

    Code: Select all

    gcc example.c -o example
    How could I translate this into the debian/rules file?

RyanEdward
Posts: 2
Joined: 2021-08-28 05:36

Re: Understanding debian/rules File

#2 Post by RyanEdward »

Forwarded response:

If you want to pass any commands or configuration, you can use override_* targets to override debhelper default.

%:
dh $@

override_dh_auto_build:
gcc example.c -o example

By default debhelper try to detect the build system and try to run the build.

See https://manpages.debian.org/testing/deb ... .7.en.html

℅:

dh $@

Will just pass any arguments passed to debian/rules to debhelper.

So debian/rules build becomes
dh build

And when building a deb, dpkg-buildpackage will call debian/rules configure, debian/rules build, debian/rules install, debian/rules binary etc

and dh build will call make build command if there is a Makefile, similarly for each of the build systems.

Post Reply