On Fri, Oct 28, 2022 at 1:24 AM Adam Williamson <adamwill@fedoraproject.org> wrote:
On Thu, 2022-10-27 at 19:42 -0500, Richard Shaw wrote:
> On Thu, Oct 27, 2022 at 5:15 PM Tom Rix <trix@redhat.com> wrote:
>
> > Sorry, I did not run into the freeglut-devel problem with the manual build
> >
>
> I think I have something funny going on with the conditionals. Initially
> they were negative conditionals:
>
> %if ! 0%{?bootstrap} || ! 0%{?rhel}
> %global docs 1
> %global tests 1
> %endif
>
>
> And I noticed that the build was trying to pull in build deps that it
> should not. As an experiment I changed it to a full positive conditional
> and that seemed to have *MOSTLY* worked:
>
> %if 0%{?bootstrap} || 0%{?rhel}
> %global docs 0
> %global tests 0
> %else
> %global docs 1
> %global tests 1
> %endif
>
> The BR's are not getting pulled in, and yet, on the cmake command, both
> docs and tests are still true, which from what I can tell should not be:
>
> %cmake -DCMAKE_CXX_STANDARD=14 \
>        -DOCIO_BUILD_DOCS=%{?docs:ON}%{?!docs:OFF} \
>        -DOCIO_BUILD_TESTS=%{?tests:ON}%{?!tests:OFF} \
>        -DOCIO_USE_HEADLESS=ON \
>        -DOCIO_INSTALL_EXT_PACKAGES=NONE \
> %ifnarch x86_64
>        -DOCIO_USE_SSE=OFF \
> %endif
>        -DOpenGL_GL_PREFERENCE=GLVND
>
> ...
>
> + /usr/bin/cmake -S . -B redhat-linux-build
> -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG
> -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG
> -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG
> -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF
> -DCMAKE_INSTALL_PREFIX:PATH=/usr
> -DINCLUDE_INSTALL_DIR:PATH=/usr/include
> -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc
> -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_SUFFIX=64
> -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_CXX_STANDARD=14
> *-DOCIO_BUILD_DOCS=ON -DOCIO_BUILD_TESTS=ON* -DOCIO_USE_HEADLESS=ON
> -DOCIO_INSTALL_EXT_PACKAGES=NONE -DOpenGL_GL_PREFERENCE=GLVND
>
> So I'm pretty much at a WTF moment...

I think the problem may be that this:

%{?docs:ON}%{?!docs:OFF}

will give you ON if %docs is *defined*, not if it's *truthy*.

Gotcha... I figured it was something I did, but I changed the top conditional because it wasn't working properly, pulling in BRs that should have been skipped. I'll refactor.

Thanks,
Richard