Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 474454 - dev-cpp/gtest should install source files, not binaries
Summary: dev-cpp/gtest should install source files, not binaries
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Thomas Kahle (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-23 06:32 UTC by Ben Longbons
Modified: 2013-07-28 19:38 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
diff for ebuild to add install of sources. Does not remove binaries yet. (gtest-install-src.ebuild.diff,460 bytes, patch)
2013-06-24 05:57 UTC, Ben Longbons
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Longbons 2013-06-23 06:32:26 UTC
Per upstream FAQ [1], Google Test should not be shipped as a library, but instead as a set of source files that can be built with the correct CXXFLAGS. 

The standard location for this seems to be /usr/src/gtest/, with the important file under that as src/gtest-all.cc. On Debian, it is necessary to -I/usr/src/gtest/ to make the includes work, but Arch does some method of combining all the contents to actually be in that single file.

After a period of compatibility, the shared library should be removed.

[1] http://code.google.com/p/googletest/wiki/FAQ#Why_is_it_not_recommended_to_install_a_pre-compiled_copy_of_Goog
Comment 1 Thomas Kahle (RETIRED) gentoo-dev 2013-06-23 16:58:56 UTC
Yes, you are absolutely right.  I'll try to look into this soon.  Please stay tuned (or even better, come up with an ebuild yourself).
Comment 2 Ben Longbons 2013-06-24 05:57:01 UTC
Created attachment 351792 [details, diff]
diff for ebuild to add install of sources. Does not remove binaries yet.

I created this based on the Arch packaging [1]; I couldn't make sense of the Debian packaging. This is enough to make my software's tests build.

In this patch, I only add the installation of the sources. I'm wary of how removing will interact with the multi-abi thing (which will no longer be needed I think).

[1] https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/gtest
Comment 3 Ben Longbons 2013-06-24 06:02:19 UTC
Oh, and I've pushed this to my personal overlay, 'o11c' in layman.

I'm not *actually* sure if (long term) we need anything but the 3 files in fused-src/
Comment 4 Thomas Kahle (RETIRED) gentoo-dev 2013-06-29 20:41:57 UTC
What do you think about the following 

src_install() {
    if use examples ; then
        insinto /usr/share/doc/${PF}/examples
        doins samples/*.{cc,h}
    fi

    doheader -r include/*

    insinto /usr/src/gtest
    doins CMakeLists.txt
    doins -r cmake
    insinto /usr/src/gtest/src
    doins fused-src/gtest/*
 }

That would basically be the entirety of the new ebuild.  No binaries will be shipped.  As you can see, headers go into /usr/include and fused sources (yes you are right, the three files contain everything) go into /usr/src/gtest/src

Users of gtest can no follow the README more or less verbatim.  Maybe we should document these paths somewhere in elog messages?  Could you please test if that works for your use case?
Comment 5 Ben Longbons 2013-06-29 22:09:47 UTC
With a little modification, that works. Note that I don't use cmake, but just build the sole object file directly [1].

Full working ebuild is at [2], including ewarn, dodoc, and disabling the default src_configure and src_compile.

A quick rgrep shows just one package, app-i18n/mozc, depending on gtest in a suspicious way.
However, changes will probably be needed in many other packages when they are built with USE=test, so there should probably be a tracker once this is pushed as -r3 (it's still -r2 in my overlay to keep diffs sane).

At some point in the distant future when all current ebuilds go away, you will need to remove the files/

[1] https://github.com/themanaworld/tmwa/blob/test/Makefile
[2] https://github.com/o11c/ebuilds/blob/master/dev-cpp/gtest/gtest-1.6.0-r2.ebuild
Comment 6 Thomas Kahle (RETIRED) gentoo-dev 2013-07-28 19:38:27 UTC
OK, the discussion on dev wasn't very conclusive.
http://thread.gmane.org/gmane.linux.gentoo.devel/86486

On second thought, I agree that installing the sources is strange.  If packages need sources, their ebuilds should just download them.  There is no benefit to outsource them to a package.  I tend to agree that gtest could be treecleaned, but that would be just breaking stuff that is working at the moment.

Consequently, I'll just do nothing.  Thanks for your input, though.