Error when trying to use ninja in Portfile

Paulo Moura pmoura at logtalk.org
Fri Feb 8 10:51:41 UTC 2019


> On 7 Feb 2019, at 12:39, Paulo Moura <pmoura at logtalk.org> wrote:
> 
> Hi,
> 
> I need to use cmake and ninja in an update to a portfile. All goes well until the destroot phase where I get:
> 
> Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_swi-prolog/swi-prolog/work/swipl-8.0.1" && ninja install DESTDIR=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_swi-prolog/swi-prolog/work/destroot 
> DEBUG: system:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_swi-prolog/swi-prolog/work/swipl-8.0.1" && ninja install DESTDIR=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_swi-prolog/swi-prolog/work/destroot 
> ninja: error: unknown target 'DESTDIR=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_swi-prolog/swi-prolog/work/destroot'
> Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_swi-prolog/swi-prolog/work/swipl-8.0.1" && ninja install DESTDIR=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_swi-prolog/swi-prolog/work/destroot 
> Exit code: 1
> 
> For some reason MacPorts is generating the command with the arguments in the wrong order. I.e. is trying:
> 
> ninja install DESTDIR=/opt/local/...
> 
> instead of:
> 
> DESTDIR=/opt/local/... ninja install
> 
> Any help is most appreciated. I looked for other cases of using ninja in the portfiles but there's only a handful of them and I didn't find any clues in them. The relevant part of the portfile that I'm trying to write is:
> 
> depends_build   \
> 	port:cmake     \
> 	port:ninja     \
>        ...
> 
> configure.cmd	\
> 	cmake
> 
> configure.pre_args	\
> 	-DCMAKE_INSTALL_PREFIX=${prefix}            \
> 	-DCMAKE_BUILD_TYPE=Release                  \
> 	-DCMAKE_INCLUDE_PATH=${prefix}/include      \
> 	-DCMAKE_LIBRARY_PATH=/usr/lib:${prefix}/lib
> 
> configure.args	\
> 	"-G Ninja ."
> 
> build.cmd	\
> 	ninja

Mojca Miklavec kindly pointed me to the solution. Simply starting the portfile with "PortGroup cmake 1.1" at adding the setting

cmake.generator  \
	Ninja

solved the problem. No need for the configure.args and build.cmd settings

Cheers,
Paulo

-----------------------------------------------------------------
Paulo Moura
Logtalk developer






More information about the macports-users mailing list