LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Building .deb package with Meson/Ninja (https://www.linuxquestions.org/questions/debian-26/building-deb-package-with-meson-ninja-4175670818/)

GeekBoy 03-05-2020 07:28 PM

Building .deb package with Meson/Ninja
 
I have seen a lot of guides/How-Tos on building .deb packages using the traditional configure & make method, and those work out great.

However, I am not seeing anything on building packages based on the Meson & Ninja build setup.

Not even Debian's own guide mentions anything on this.

Can anyone point me to something?

Thanks!

shruggy 03-14-2020 09:12 AM

As an example, see debian/rules for xed from Linux Mint.

OTOH, meson and ninja are listed among build systems recognized by debhelper, so I guess for most packages the standard dh magic should work, too. And if debhelper wrongly determines the used build system itself, you may always specify it explicitly:
Code:

%:
        dh $@ --buildsystem=meson


GeekBoy 03-31-2020 08:27 PM

When I tried the normal build, it would report not finding classic stuff like configure.


When I tried entering "dh $@ --buildsystem=meson" it reported back, "dh: error: Unknown sequence --buildsystem=meson (options should not come before the sequence)"

Thanks for responding.

shruggy 04-01-2020 02:29 AM

1. What's your distro?
Code:

grep ^PRETTY /etc/os-release
2. What's your version of debhelper? (meson/ninja support was added in debhelper 10.3, i.e. if you're on Debian 9 (Stretch) you should use debhelper from stretch-backports, and if you're still on Debian 8 (Jessie) or Ubuntu 16.04 LTS (Xenial) you're out of luck)
Code:

dpkg -l debhelper
3. What's the output of
Code:

dh build --no-act --buildsystem=meson
(run the last command from inside your package source directory, i.e. one level above the debian directory).

GeekBoy 04-01-2020 11:30 PM

Here are the responses.


Quote:

PRETTY_NAME="Debian GNU/Linux bullseye/sid"

Quote:

| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii debhelper 12.9 all helper programs for debian/rules
Quote:

dh_testdir -O--buildsystem=meson
dh_update_autotools_config -O--buildsystem=meson
dh_autoreconf -O--buildsystem=meson
debian/rules override_dh_auto_configure
debian/rules override_dh_auto_build
dh_auto_test -O--buildsystem=meson
create-stamp debian/debhelper-build-stamp

shruggy 04-02-2020 02:15 AM

I don't see anything wrong with your setup.

1. What software are you trying to build? Have you tried to build it manually, according to upstream instructions (they are usually in files named INSTALL*, README* and the like)? Did it work?

2. Please show the contents of debian/rules.

GeekBoy 04-03-2020 02:36 PM

It is Budgie Desktop 10.5.

And yes, I have tried the manual build


Here is the content of debian/rules

Code:

#!/usr/bin/make -f
export DH_VERBOSE = 1
export MAKE = ninja -v
export LC_ALL=C.UTF-8
export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow

%:
        dh $@

override_dh_clean:
        dh_clean
        rm -rf debian/build
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo ubuntu),ubuntu)

        @if [ -e ./debian/ubuntu/applied ]; then \
                patch -R -p1 < debian/ubuntu/show_nm-applet_in_tray.patch ; \
                rm ./debian/ubuntu/applied ; \
        fi
endif

override_dh_auto_configure:
        mkdir -p debian/build
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo ubuntu),ubuntu)
        patch -p1 < debian/ubuntu/show_nm-applet_in_tray.patch
        touch ./debian/ubuntu/applied
endif
        cd debian/build && LDFLAGS="-Wl,-z,now -Wl,-z,relro -O1" meson -Dwith-desktop-icons=none --buildtype plain --prefix=/usr --libdir=/usr/lib --sysconfdir=/etc ../..

override_dh_auto_build:
        cd debian/build && $(MAKE)

override_dh_auto_install:
        dh_auto_install
        cd debian/build && DESTDIR=$(CURDIR)/debian/tmp $(MAKE) install
        mkdir -p "$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/girepository-1.0"
        mv "$(CURDIR)/debian/tmp/usr/lib/girepository-1.0/Budgie-1.0.typelib" "$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/girepository-1.0"
        rm -rf "$(CURDIR)/debian/tmp/usr/lib/girepository-1.0"

override_dh_installgsettings:
        # install override but budgie has to take precedence over
        # gnome-shell defaults
        dh_installgsettings --priority=15

override_dh_installchangelogs:
        dh_installchangelogs debian/changelog-announcement.txt


shruggy 04-04-2020 04:06 AM

budgie-desktop 10.5.1-3 is currently in sid. Why not just install it from the official repo?

Just to be sure, I've rebuilt budgie-desktop 10.5.1-6 currently in experimental from source. The only problem was package libmutter-6-dev still being in experimental. So I did
Code:

sudo pbuilder --update --override-config --distribution experimental
Update. Now I've also rebuilt budgie-desktop 10.5.1-3 from sid source with no changes and no problems whatsoever.

GeekBoy 04-09-2020 09:43 PM

Reason for not using packages is to learn how to make various packages, and learn how to make my own repos.

I had downloaded the source packages from the upstream developer repo on Github.
Maybe that is why I am having issues.

I tried downloading source from the Deb source repos using "apt-get source", but I guess I have to do that as sudo user.

shruggy 04-10-2020 12:31 AM

No, it's not necessary to be root in order to use apt-get source. From the apt-get(1) manpage:
Quote:

Note that source packages are not installed and tracked in the dpkg database like binary packages; they are simply downloaded to the current directory, like source tarballs.
But you should have enabled the corresponding deb-src line in /etc/apt/sources.list. From the same manpage:
Quote:

Source packages are tracked separately from binary packages via deb-src lines in the sources.list(5) file. This means that you will need to add such a line for each repository you want to get sources from; otherwise you will probably get either the wrong (too old/too new) source versions or none at all.
Alternatively to apt-get source you can try dget from package devscripts.

From Ubuntu's pbuilder Howto:
Quote:

There will be times when a package you want or need to build is not in the repositories of the current version of Ubuntu you are running. Rather than entering deb-src lines in your sources.list configuration for other versions of Ubuntu you are not running, you can use dget instead to download a package. dget is included in the devscripts package, hence why you should have installed it.

To use dget, first locate the .dsc file of the package you are going to build. Good places to look are http://packages.ubuntu.com/ or http://packages.debian.org/. Once you located the .dsc file, copy the link address to it and then in a command prompt run:
Code:

dget <link_address_to_foo.dsc>

Quote:

Originally Posted by GeekBoy (Post 6109780)
I had downloaded the source packages from the upstream developer repo on Github. Maybe that is why I am having issues.

I don't think so. Just compare your debian/rules with that from the official Debian package. Why are you overriding dh_auto_build? Why changing the MAKE variable?

GeekBoy 04-17-2020 11:57 PM

Been a while. With so many people at the house all the time now, I get endlessly interrupted, and hard to sit down and work on this stuff.



Anyway, I was trying to get the source from apt the wrong way.
Just running "apt-get source budgie-desktop" worked out fine.

Got a folder labeled "budgie-desktop-10.5," archive named, "budgie-desktop_10.5.orig.tar.xz," file named "budgie-desktop_10.5.orig.tar.xz.asc," another archive named "budgie-desktop_10.5-1.debian.tar.xz," and a file named "budgie-desktop_10.5-1.dsc."

At this point, I am not even sure what to do with all the different files as there seems to be no Debian documentation on what to to to get it to compile/patch/make .deb package.


Overriding dh_auto_build? Changing MAKE variable? Not sure what you mean. I have not changed anything. Just trying to learn how to build this, and make a repo package.

Any docs to point me to, or help on that?

Thanks again!

shruggy 04-18-2020 04:31 AM

Code:

sudo apt install build-essential devscripts
cd budgie-desktop-10.5
debuild -us -uc
ls ../*.deb

Quote:

Originally Posted by GeekBoy (Post 6113013)
Any docs to point me to, or help on that?

If all this is just in order to try your hand in rebuilding a Debian package, why not choose something simple like hello?

GeekBoy 04-19-2020 01:05 AM

[QUOTE=shruggy;6113082]
Code:

sudo apt install build-essential devscripts
cd budgie-desktop-10.5
debuild -us -uc
ls ../*.deb

That did not work out. It spit out about 100 or so errors.

I will check out the links.

Reason is because the simples are really not learning to build harder packages. Just do the commands and its done. Here we have something really to learn here.

Thanks

shruggy 04-19-2020 02:26 AM

Quote:

Originally Posted by GeekBoy (Post 6113344)
That did not work out. It spit out about 100 or so errors.

Are you sure the directory budgie-desktop-10.5 was unpacked by apt source and not left behind from your previous experiments?
Code:

rm -rf budgie-desktop-10.5
dpkg-source -x budgie-desktop-10.5-1.dsc

Lather, rinse, repeat :)

GeekBoy 04-19-2020 11:33 PM

No. I removed all previous ones, then made a special directory just for this project on April 17, then did the apt source.

However, I did go ahead and did those two commands above, and reran "debuild -us -uc" and got bit of a different result, but still a failure.



Quote:

[130/265] ccache cc -Isrc/wm/131f9c0@@budgie-wm@exe -Isrc/wm -I../../src/wm -I. -I../../ -Isrc/config -I../../src/config -I/usr/include/mutter -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/mutter/clutter-3 -I/usr/include/atk-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/json-glib-1.0 -I/usr/include/mutter/cogl -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libdrm -I/usr/include/gsettings-desktop-schemas -I/usr/include/gnome-desktop-3.0 -I/usr/include/ibus-1.0 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -std=c11 -fstack-protector -pedantic -Wstrict-prototypes -Wundef -Werror-implicit-function-declaration -Wformat -Wformat-security -Werror=format-security -Wconversion -Wunused-variable -Wunreachable-code -Wall -W '-DGETTEXT_PACKAGE="budgie-desktop"' -g -O2 -fdebug-prefix-map=/home/trent/Developer/budgie/budgie-desktop-10.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -pthread -DGNOME_DESKTOP_USE_UNSTABLE_API -MD -MQ 'src/wm/131f9c0@@budgie-wm@exe/meson-generated_wm.c.o' -MF 'src/wm/131f9c0@@budgie-wm@exe/meson-generated_wm.c.o.d' -o 'src/wm/131f9c0@@budgie-wm@exe/meson-generated_wm.c.o' -c 'src/wm/131f9c0@@budgie-wm@exe/wm.c'
ninja: build stopped: subcommand failed.
make[1]: *** [debian/rules:30: override_dh_auto_build] Error 1
make[1]: Leaving directory '/home/trent/Developer/budgie/budgie-desktop-10.5'
make: *** [debian/rules:8: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
debuild: fatal error at line 1182:
dpkg-buildpackage -us -uc -ui failed


All times are GMT -5. The time now is 10:56 AM.