On Mon Jan 03, 2022 at 08:37:00AM +0000, Klemens Nanni wrote:
> On Sat, Dec 18, 2021 at 11:53:11AM +0100, Rafael Sadowski wrote:
> > Help ports to find hidden (QUIET) dependencies in cmake ports by disabling
> > QUIET
> > option in the ports tree build.
> >
> > For examle:
> >
> > $ Qt5_DIR=/usr/local/lib/qt5/cmake cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug
> > ~/src/github/openbsdisks2
> > -- The C compiler identification is Clang 13.0.0
> > -- The CXX compiler identification is Clang 13.0.0
> > -- Detecting C compiler ABI info
> > -- Detecting C compiler ABI info - done
> > -- Check for working C compiler: /usr/bin/cc - skipped
> > -- Detecting C compile features
> > -- Detecting C compile features - done
> > -- Detecting CXX compiler ABI info
> > -- Detecting CXX compiler ABI info - done
> > -- Check for working CXX compiler: /usr/bin/c++ - skipped
> > -- Detecting CXX compile features
> > -- Detecting CXX compile features - done
> > -- Configuring done
> > -- Generating done
> > -- Build files have been written to: /home/rsadowski/build/openbsdisks
> >
> > $ rg QUIET ~/src/github/openbsdisks2
> > /home/rsadowski/src/github/openbsdisks2/CMakeLists.txt
> > 30:find_package(Threads REQUIRED QUIET)
> >
> > $ MODCMAKE_PORT_BUILD=yes Qt5_DIR=/usr/local/lib/qt5/cmake cmake -G Ninja
> > -DCMAKE_BUILD_TYPE=Debug ~/src/github/openbsdisks2
> > -- The C compiler identification is Clang 13.0.0
> > -- The CXX compiler identification is Clang 13.0.0
> > -- Detecting C compiler ABI info
> > -- Detecting C compiler ABI info - done
> > -- Check for working C compiler: /usr/bin/cc - skipped
> > -- Detecting C compile features
> > -- Detecting C compile features - done
> > -- Detecting CXX compiler ABI info
> > -- Detecting CXX compiler ABI info - done
> > -- Check for working CXX compiler: /usr/bin/c++ - skipped
> > -- Detecting CXX compile features
> > -- Detecting CXX compile features - done
> > -- Looking for pthread.h
> > -- Looking for pthread.h - found
> > -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
> > -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
> > -- Looking for pthread_create in pthreads
> > -- Looking for pthread_create in pthreads - not found
> > -- Looking for pthread_create in pthread
> > -- Looking for pthread_create in pthread - found
> > -- Found Threads: TRUE
> > ^^^^^^^^^^^^^^^^^^^^^^
> > You can see the output even QUIET is set.
> >
> > -- Configuring done
> > -- Generating done
> > -- Build files have been written to: /home/rsadowski/build/openbsdisks
>
> Even with QUIET, configure would still fail if the REQUIRED Threads
> package is no t found, right?
>
> > Feedback, OK?
>
> I like the idea, given that it's opt-in behind a ports option.
> This should help reduce grepping and trial-and-error while porting.
>
> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/devel/cmake/Makefile,v
> > retrieving revision 1.199
> > diff -u -p -u -p -r1.199 Makefile
> > --- Makefile 6 Jul 2021 16:55:32 -0000 1.199
> > +++ Makefile 18 Dec 2021 10:50:19 -0000
> > @@ -8,7 +8,7 @@ VER = 3.20.3
> > EPOCH = 0
> > DISTNAME = cmake-${VER}
> > CATEGORIES = devel
> > -REVISION = 0
> > +REVISION = 1
> >
> > HOMEPAGE = https://www.cmake.org/
> >
> > Index: patches/patch-Source_cmFindPackageCommand_cxx
> > ===================================================================
> > RCS file: patches/patch-Source_cmFindPackageCommand_cxx
> > diff -N patches/patch-Source_cmFindPackageCommand_cxx
> > --- /dev/null 1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-Source_cmFindPackageCommand_cxx 18 Dec 2021 10:50:19
> > -0000
> > @@ -0,0 +1,22 @@
> > +$OpenBSD$
> > +
> > +Disable find_package QUIET option in openbsd ports build.
> > +
> > +Index: Source/cmFindPackageCommand.cxx
> > +--- Source/cmFindPackageCommand.cxx.orig
> > ++++ Source/cmFindPackageCommand.cxx
> > +@@ -256,7 +256,13 @@ bool cmFindPackageCommand::InitialPass(std::vector<std
> > + std::set<unsigned int> moduleArgs;
> > + for (unsigned int i = 1; i < args.size(); ++i) {
> > + if (args[i] == "QUIET") {
> > +- this->Quiet = true;
> > ++ std::string openbsd_build;
> > ++ bool quiet = true;
> > ++ if (cmSystemTools::GetEnv("MODCMAKE_PORT_BUILD", openbsd_build)) {
>
> So this will only work when passed through *_ENV and not on the command
> line, right? That seems little off, given that all MODCMAKE_* variables
> are make variables and can therefore be passed either way.
Yes it will only work when we passe through *_ENV and not on the command line.
But we already do that for some cmake modules. Check out
devel/cmake/cmake.port.mk:
127 # Disable cmake's default optimization flags, putting them under ports
control
128 CONFIGURE_ENV += MODCMAKE_PORT_BUILD=yes
129 MAKE_ENV += MODCMAKE_PORT_BUILD=yes
>
> > ++ if (openbsd_build == std::string("yes"))
> > ++ quiet = false;
> > ++ }
> > ++ this->Quiet = quiet;
> > + doing = DoingNone;
> > + } else if (args[i] == "EXACT") {
> > + this->VersionExact = true;
> >
>