Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake build style doesn't allow to choose source dir #20878

Closed
yopito opened this issue Apr 11, 2020 · 7 comments
Closed

cmake build style doesn't allow to choose source dir #20878

yopito opened this issue Apr 11, 2020 · 7 comments
Labels
bug Something isn't working

Comments

@yopito
Copy link
Contributor

yopito commented Apr 11, 2020

System

  • xuname: Void 5.4.31_1 x86_64-musl GenuineIntel uptodate rrnFF

  • package: packaging shiboken2 update to 5.14.2 (WIP)

Expected behavior

want to use cmake with sources of a subdir of $wkrsrc via -S cmake flag:

[...]
wrksrc="${_pkgname}"
build_style=cmake
configure_args=" ... -S sources/shiboken2"
[...]

Actual behavior

-S <subdir> has no effect.

Additional details

xbps-src append "../" to cmake arguments unconditionally.
Resulting command is something like cmake (args) -S sources/shiboken2 ../

So cmake uses sources of ${wrksrc}/build/.. instead of ${wrksrc}/sources/shiboken2/

Implied by common/build-style/cmake.sh on sed expression L63:

    60          # Override flags: https://gitlab.kitware.com/cmake/cmake/issues/19590
    61          CFLAGS="${CFLAGS/ -pipe / }" CXXFLAGS="${CXXFLAGS/ -pipe / }" \
    62                  cmake ${cmake_args} ${configure_args} $(echo ${cmake_builddir}|sed \
    63                          -e 's|[^/]$|/|' -e 's|[^/]*||g' -e 's|/|../|g')
    64

Workaround

My current workaround: adding subdir to $wrksrc:

wrksrc="${_pkgname}/sources/shiboken2"
build_style=cmake
configure_args=" ... "  # removed " -S sources/shiboken2 "
[...]

... that makes xlint nervous:

srcpkgs/shiboken2/template:7: wrksrc should be a top-level directory
@pullmoll
Copy link
Member

Can't you use build_wrksrc="sources/shiboken2" here?

@yopito
Copy link
Contributor Author

yopito commented Apr 11, 2020

nope: need to manage source dir at the configure step, not the build one.

@pullmoll
Copy link
Member

Despite its name build_wrksrc is a modifier for all steps, not just build. See common/xbps-src/shutils/common.sh and there ch_wrksrc() which is called from every run_step().

@yopito
Copy link
Contributor Author

yopito commented Apr 11, 2020

I was not aware of that.
But within its do_configure() , cmake.sh (re)changes current dir to $cmake_builddir, so build_wrksrc is is not relevant in this case:

$ cat -n common/build-style/cmake.sh 
     1  #
     2  # This helper is for templates using cmake.
     3  #
     4  do_configure() {
     5          local cmake_args=
     6          [ ! -d ${cmake_builddir:=build} ] && mkdir -p ${cmake_builddir}
     7          cd ${cmake_builddir}
     8
[...]

@pullmoll
Copy link
Member

pullmoll commented Apr 11, 2020

Hmm... I think it's just that instead of :=build there should be something like :=$PWD/build which would then create the build directory below the possible $build_wrksrcsub-directory inside $wrksrc, or simply below $wrksrc. Anyway, this should be fixed in a way that doesn't complicate things :)

@yopito
Copy link
Contributor Author

yopito commented Apr 13, 2020

my bad !
As suggested by @pullmoll : build_wrksrc is working perfectly fine in this case.

FTR, my template is now:

[...]
wrksrc="${_pkgname}"
build_wrksrc="sources/shiboken2"
build_style=cmake
configure_args="(args not specific to this issue)"
[...]

... let's close this non-issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants
@pullmoll @yopito and others