[opensuse-packaging] Defining a macro if it is NOT yet defined
![](https://seccdn.libravatar.org/avatar/65c6b3439f77fd121a63e42e7537a5d5.jpg?s=120&d=mm&r=g)
Hi, I am trying to define a macro unless this is already defined in the project configuration. I am doing this: %{!?go_arches: %define go_arches %ix86 x86_64 aarch64 ppc64le} But the build fails in openSUSE:Factory:Staging:adi:333 where go_arches is not defined. However, if I explicetly define it in the spec file, as in %define go_arches %ix86 x86_64 aarch64 ppc64le the builds success ... so my guess is that I am not really defining go_arches if go_arches is not defined. Does anyone knows how to correctly check that? What am I doing wrong? thanks in advance jordi -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/833649deea07c68de42500ad14c257f6.jpg?s=120&d=mm&r=g)
On Sep 19 2016, Jordi Massaguer Pla <jmassaguerpla@suse.de> wrote:
I am trying to define a macro unless this is already defined in the project configuration.
I am doing this:
%{!?go_arches: %define go_arches %ix86 x86_64 aarch64 ppc64le}
You need to use %global instead of %define. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/65c6b3439f77fd121a63e42e7537a5d5.jpg?s=120&d=mm&r=g)
On 09/19/2016 11:46 AM, Andreas Schwab wrote:
On Sep 19 2016, Jordi Massaguer Pla <jmassaguerpla@suse.de> wrote:
I am trying to define a macro unless this is already defined in the project configuration.
I am doing this:
%{!?go_arches: %define go_arches %ix86 x86_64 aarch64 ppc64le} You need to use %global instead of %define.
oh! Thanks a lot! Why is it so?
Andreas.
-- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (2)
-
Andreas Schwab
-
Jordi Massaguer Pla