How to print all dependencies in meson? - meson-build

I checked out a gtk project inside a docker and during meson build found many dependencies are missing eg. libwayland-dev, libxrandr-dev...
Because meson fails at the first missing dependency, I had to redo this over and over to get install the entire list of dependencies that will be looked for using pkg-config. And, in projects with multiple git submodules, this becomes a lengthy process.
Wondering if I'm doing this whole thing wrong or if there is a way to get to the complete list of dependencies.

To get dependencies for your project, from build directory run:
meson introspect --dependencies

Related

How to handle package dependencies for some build targets when building with Copr?

I want to have a rpm package build with Copr1. My current build target list is Fedora 35, 36, rawhide and Centos 7 and Stream 8. I have not yet created the copr project.
Compiling on one of my machines, the package builds successfully on the Fedora variants with mock. The problem is that on Centos variants one of the build dependencies and some of its dependencies are not available. I have found appropriate srpm files and compiled them on one of my machines with the Centos Stream 8 (one of them required two custom patches). With those custom dependencies I am able to successfully compile the original package.
So just to be clear, the problem is that the spec file contains for example
BuildRequires: libsomething
where libsomething is available as a plain upstream package in some of the build targets while needs an additional custom repo for some other build targets.
The FAQ says the following about dependencies:
Can I depend on other packages, which are not in Fedora/EPEL?
Yes, they just need to be available in some yum repository. It can either be another Copr repo or a third-party yum repo (e.g jpackage). Click on “Edit” in your project and add the appropriate repositories into the “Repos” field. Packages from your project are available to be used at build time as well, but only for the project you are currently building and not from your other projects.
But this sounds like an all or nothing approach, and I absolutely do not want to override the already existing upstream packages, only provide them when they are missing.
So what strategy do people use to handle this?
Update: I have now created copr projects and made some attempts at building (after resolving dependencies of dependencies in several levels), but the problem is as I describe above. If I add copr://hlovdal/projectname as a build dependency then epel-8-x86_64 compiles fine because it is provided with the missing dependencies while fedora-35-x86_64 fails because the repository does not have any fedora packages. If I remove the repo epel fails while fedora succeeds.
I also attempted to add the base url from the corresponding /etc/yum.d.repo file, and only hardcode epel instead of $distname hoping that the fedora builds would just ignore non-existing/wrong repo setting, but the build does not like that and still fails.
1 Copr is Fedora's freely available build system.

How do I tell ReadTheDocs to build my project packages from a sub-directory?

I have a repository that contains three python packages: a main package, and two addon packages, with shared documentation. Each project is in its own directory, with its own setup.py, as so:
Repository
Main Project
setup.py
Addon One
setup.py
Addon Two
setup.py
Documentation
RST files, RTD conf, etc.
Previously, I was using setuptools.find_packages() to build my packages, but was having issues with the contents of the packages bleeding together, as they shared namespaces. So I switched to specifying the packages I wanted to build, such as
packages=["Main Package"]
However, this broke my ReadTheDocs auto-build, where I had specified
- method: setuptools
path: Main Project
in .readthedocs.yml, with RTD now complaining my package (inside the Main Project directory) doesn't exist, as it attempts to build it.
In my project, I use a script to build the packages, where I move into each directory, run its setup, then move out. Works fine, my packages and documentation all build locally. However, it looks like RTD is only using the defined path to prepend my setup.py script, and therefore not finding the source package as the working directory is the parent directory (but I could be wrong!).
I've read through the documentation, including https://github.com/readthedocs/readthedocs.org/issues/4354 where the feature was originally added, but I have not been able to find a solution myself yet.
How can I tell RTD to change directory before building the packages, or is there an alternative approach that will support my repo structure?
Repository in question is here.
I found a solution:
I changed my local build script to use the root project directory, as per-RTD. I then added the directive package_dir={"": "[directory]"} to the setuptools.setup() calls in each project's setup.py.

Unable to get the wrap-file option in meson build system working

I was trying to cross compile glib for arm. It has a dependency on libffi, but found that a meson build for libffi was last updated 2 yrs back and there is a problem with what is available.
Therefore i had to define a wrap file to take the latest source of libffi.
My first idea was to use a wrap file as below -
[wrap-git]
directory=libffi
url=https://github.com/libffi/libffi
revision=head
p.s its the head revision that has the right source code for libffi. But it needed a meson revision and doesn't seem to take the head.
Therefore i went for the [wrap-file] option,
[wrap-file]
directory = libffi-3.3
source_url = https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz
source_filename = libffi-3.3.tar.gz
source_hash = 72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056
But still i get this error "Subproject exists but has no meson.build file" when doing a meson build.
This is the original wrap file that came alongwith glib.
[wrap-git]
directory=libffi
url=https://github.com/centricular/libffi.git
revision=meson
what is the easiest way to get a wrap file working.
As far I can see, someone forked project and added support for meson, named that branch meson, so revision is just a name of branch containing meson.build
Official project does not have support for meson.build. What is really happening is when you build your project that uses wrap git/file, that project is fetched/downloaded&unzip and it searches for meson.build to build that dependency for your project.
You have couple options:
Fork project and add support for meson (optionally: make PR to official project)
Install and use it as dependency
Use conan package manager to get your dependency, you can even integrate it with meson (https://conan.io/center/libffi/3.3/?user=&channel=)

Why doesn't Yarn install all executables in .bin folder?

I've just started using the Yarn package manager and I downloaded a starter Ionic 2 project.
In this project, we have a lot of help from scripts that compile, minify, lint and bundle our code. All of this is provided by ionic-app-scripts, which has several dependencies which it uses to run commands.
The problem is when I use Yarn to install, the node_modules/.bin/ folder does not contain all the necessary executables, like tslint, which is a dependency of ionic-app-scripts, so it is not directly in my package.json.
The result is that when I use Yarn, ionic-app-scripts doesn't work because it expects that the .bin folder contains a tslint executable!
What can I do? Are the ionic-app-scripts's definitions a problem?
[note]: npm install works, but Yarn is much faster!
This is a known issue, and there's a pull request with more information.
In short, if you want to fix this now, you'll have to explicitly include the packages from which you need binaries in your dependencies.
I had this issue but a different solution.
The solution was from this ticket https://github.com/yarnpkg/yarn/issues/992#issuecomment-318996260
... my workaround is going to file manager, right click on /node_modules main folder, selecting properties, and check-uncheck "read-only". You can do it also using attrib in command line. Then you retry installation and it works.

question on mvn -e clean install

In maven, what does "-e" stands for in the following command.
mvn -e clean install
Moreover, what is the difference between
mvn clean install
and
mvn clean compile
As Satish stated, the "-e" switch will display execution errors in the maven output.
As to the difference in "install" vs "compile", those are different Maven lifecycle stages. See the Introduction to the Build Lifecycle documentation for help with that. The key to remember is that Maven will execute all lifecycle stages up to and including the one you specify, and then stop.
Specifically in your case, "mvn clean compile" will run Maven with two lifecycle targets, the first being "clean", and the second being "compile". The "compile" lifecycle phase will run the build up to and including the compilation of project source code. The "install" lifecycle phase will run all the way through packaging your project into it's container (jar, war, etc) and will install it to your local maven repository, which resides on your local machine. When a project is installed to your local repository, other projects you build on your machine can reference it without having to have any knowledge of where the source code or project build artifacts actually reside.
the e flag (e = errors) prints out more detailed error messages.
mvn clean install, does compilation, linking and installs (copies to app server etc)
for more maven options look at this ref card
http://www.scribd.com/doc/15778516/DZone-Refcard-55-Apache-Maven-2
or maven command list
http://cvs.peopleware.be/training/maven/maven2/mvnCommand.html
mvn clean install - First, cleans already compiled class files (probably in target/ directory). Then, it compiles the classes, generate the jar, and then install the created jar to your local m2 repository (probably located at ~/.m2/repository/).
mvn clean compile - The clean does the same thing as above. And, then, it compiles the java files in the project. And, stops there. It doesn't create the jar nor install anything to the local maven repository.
-e switch will display the stack-traces occur when your build is failed. It's a normal stack-trace that java programs produce when exceptions occur. Do note that Maven itself is a Java program.