{"action":"opened","issue":{"url":"https://api.github.com/repos/ascherer/debbuild-0.11.3/issues/4","labels_url":"https://api.github.com/repos/ascherer/debbuild-0.11.3/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/ascherer/debbuild-0.11.3/issues/4/comments","events_url":"https://api.github.com/repos/ascherer/debbuild-0.11.3/issues/4/events","html_url":"https://github.com/ascherer/debbuild-0.11.3/issues/4","id":116815428,"number":4,"title":"[RFE] Support complex macro logic and %bcond logic","user":{"login":"Conan-Kudo","id":276796,"avatar_url":"https://avatars.githubusercontent.com/u/276796?v=3","gravatar_id":"","url":"https://api.github.com/users/Conan-Kudo","html_url":"https://github.com/Conan-Kudo","followers_url":"https://api.github.com/users/Conan-Kudo/followers","following_url":"https://api.github.com/users/Conan-Kudo/following{/other_user}","gists_url":"https://api.github.com/users/Conan-Kudo/gists{/gist_id}","starred_url":"https://api.github.com/users/Conan-Kudo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Conan-Kudo/subscriptions","organizations_url":"https://api.github.com/users/Conan-Kudo/orgs","repos_url":"https://api.github.com/users/Conan-Kudo/repos","events_url":"https://api.github.com/users/Conan-Kudo/events{/privacy}","received_events_url":"https://api.github.com/users/Conan-Kudo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-13T17:44:57Z","updated_at":"2015-11-13T17:44:57Z","closed_at":null,"body":"In `rpmbuild`, it is possible to adjust the conditions and build for a spec using `--with <flag>` and `--without <flag>`. In RPM, these are automatically converted to the appropriate internal flag definitions.\r\n\r\nIn RPM spec files, these can be utilized in a couple of ways:\r\n\r\n* Using `%if %{defined _with_flag}`, `%if %{undefined _with_flag}`, `%if %{defined _without_flag}`, and `%if %{undefined _without_flag}`.\r\n\r\n   * With this type of check, I don't care what the value is, only that it exists.\r\n\r\n   * An example:\r\n   ```\r\n   %if %{defined _without_stuff}\r\n   ... do things ...\r\n   %endif\r\n\r\n   %if %{undefined _with_stuff}\r\n   ... do things ...\r\n   %endif\r\n   ```\r\n\r\n* Using `%{?_without_flag:<output>}`, `%{?!_without_flag:<output>}`, `%{?_with_flag:<output>}`, `%{?!_with_flag:<output>}`\r\n\r\n   * With this type of check, I can have it write out a line only in the event of the appropriate flag being passed at the build command.\r\n\r\n   * An example: `%{?_without_stuff:BuildRequires: git}`\r\n\r\nAdditionally, I can pre-set defaults in the spec that will be honored at build by declaring what the options are using `%bcond_with <flag>` and `%bcond_without <flag>`.\r\n\r\n* `%bcond_with <flag>` indicates that the **default** is defined as the equivalent of `--without <flag>`. Thus, in order to enable it, you must pass in `--with <flag>` on the build command. Meaning, it's saying that the flag is ***disabled by default***, and can be enabled by passing in the switch noted earlier.\r\n\r\n* `%bcond_without <flag>` indicates that the **default** is defined as the equivalent of `--with <flag>`. Thus, in order to disable it, you must pass in `--without <flag>` on the build command. Meaning, it's saying that the flag is ***enabled by default***, and can be enabled by passing in the switch noted earlier.\r\n\r\nHaving this functionality in debbuild will allow for more advanced and useful complex build control logic by build systems and the like."}}