debhelperdebian-packagingdpkg-buildpackage

Debian Packaging Without Build Tool


I want to create a Debian package from a C program without the use of a build tool such as autotools or CMake. My debian/rules file:

#!/usr/bin/make -f

%:
    dh $@

override_dh_auto_clean:
    rm -f program

override_dh_auto_build:
    gcc program.c -o program

override_dh_auto_install:
    cp program /usr/local/bin

Upon running dpkg-buildpackage, I get: dh: error: Unknown sequence application (choose from: binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep)


Solution

  • It seems the issue was related to the fact that I was creating the file in a shell script heredoc that was expanding the $@, e.g.

    cat <<EOF > debian/rules.temp
    #!/usr/bin/make -f
    
    %:
        dh $@
    EOF
    

    Which should be:

    all_symbol='$@'
    cat <<EOF > debian/rules.temp
    #!/usr/bin/make -f
    
    %:
        dh $all_symbol
    EOF
    

    An unrelated issue is to the location of the override_dh_auto_install To manually create Debian file hierarchy it should be:

    override_dh_auto_install:
        mkdir -p debian/PACKAGENAME/usr/bin 
        cp program debian/PACKAGENAME/usr/bin
    

    Or, to have this done automatically:

    cat <<EOF > debian/PACKAGENAME.install
    program usr/bin
    EOF