Build contrib modules
|Assignee:||Eugene Dubinin||% Done:|
Building contrib modules fails with the following error message:
Building contrib make -f Makefile -j1 Makefile:5: ../src/Makefile.global: No such file or directory make: *** No rule to make target '../src/Makefile.global'. Stop. Command '['/bin/sh', '/tmp/tmpxgmn5skk', 'make', '-f', 'Makefile', '-j1']' returned non-zero exit status 2
The problem here seems to be that src/contrib/Makefile includes ../src/Makefile.global via a relative path and the snapcraft make plugin wasn't designed for this use case.
Our options are:
- either patch the source code or
- write a custom make plugin or
- report this as a bug to snapcraft developers
and then hope they fix it. The latter is ideal, though, because PostgreSQL may not be the only program that includes a Makefile in a Makefile.
#1 Updated by Eugene Dubinin 12/01/2016 (almost 5 years) ago
- Assignee set to Eugene Dubinin
After some research, I have discovered that the root cause of the issue is not in the Snapcraft plugin limitations, but in the source tree being used.
Lets take a look at the contrib part of snapcraft.yaml:
contrib: plugin: make source: parts/postgresql/src/contrib/ after: - postgresql
It acquires its source code from the Postgresql part's src/contrib subdir. It is a part of the pristine source tree without any makefiles generated by Autotools.
The contrib source tree relies on the parent directory Makefile.global, which is not there since the contrib is being used as a root and does not have the correct parent directory structure.
But even if the path is adjusted to be one dir higher in the hierarchy (e.g. source: parts/postgresql/src/contrib/) this will not help either because the parent dir does not have Autotools-generated Makefile.global, but only the Makefile.global.in
Here is the adjusted contrib part:
contrib: plugin: make source: ./parts/postgresql/build source-subdir: contrib after: - postgresql
The idea is to steal the Autotools-processed/configured source tree from the postgres part, that's why the parts/postgresql/build subtree is being used
The source-subdir directive will tell the make plugin change the CWD to the contrib subdir before the build process starts
Hope this helps to solve the issue.