Thanks for the help. But what I was looking for was something simple like %cmake and %cmake_install in the .spec file instead of setting up the CLIB_INSTALL_DIR etc. variables myself. The other link given by Michal seem to be useful and as per my requirements (not tried yet). Sankar
On 9/11/2013 at 01:35 AM, in message
, Marguerite Su wrote: Hi, 1. library install path (DLIB_INSTALL_DIR) is defined by CMakeLists.txt itself, no matter where you are. the same applys to binary install path.
see this CMakeLists.txt from fcitx:
https://github.com/fcitx/fcitx/blob/master/CMakeLists.txt
starting from line 189 and it will answer all your questions.
2. fetching rpm dependencies from CMakeLists.txt on the fly is not possible.
Because the name in find_package() is not the same as our package name. OBS doesn't have this implemented.
3. actually it's not a cmake thing. it's a rpm thing.
You need something called conditional builds and a little tweak to your source (if you want to _just_ upload 5 targets as Source)
In details you can read rpm manual, this chapter:
http://rpm.org/gitweb?p=rpm.git;a=blob;f=doc/manual/conditionalbuilds;hb=HEA D
And this in our wiki (written by me btw):
http://en.opensuse.org/openSUSE:RPM_conditional_builds
Here I'll just give you some briefings:
1. Tweak your source code to make the additional targets supplemental and their dependencies optional which can be turned on with a "-DXXX=On", also see fcitx CMakeLists.txt for example.
The final result should be this: you `rm -rf` you conditional directory, the source still builds just by disabling those targets.
Then you can uploaded a _clean_ source (maybe cut version of Novell product for example)
2. use %define or anything I mentioned in the wiki to define a switch in specfile.
eg: %define _with_gtk3 0
This means "with gtk3" is _false_
Then tweak BuildRequires, eg:
%if %{_with_gtk3} == 1 BuildRequires: gtk3-devel Requires: gtk3-tools %endif
This means, if true, blabla, so you have to build it locally first to get all the things when it is true (obs will build it as a false, so you will not know what will be generated under a true situation)
And in %build section, turn on your "optional" targets if "withg_gtk3" is 1, eg:
%build cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIB_INSTALL_DIR=%{_libdir} \ %if %{_with_gtk3} == 1 -DENABLE_GTK3=ON \ %endif ..
And your %files section:
%files [...] %if %{_with_gtk3} == 1 %{_libdir}/gtk3.so %endif
Here you got it!
But notice that the _with_gtk3 macro is "defined" by me. so rpm won't recognize it without the specfile, which means, if you download the src.rpm, you can just:
rpmbuild --rebuild --with-gtk3=1 *.src.rpm
Something like that, because the _with_gtk3 is only usable inside _this_ specfile.
So you _must_ unrpm and change the number then rpmbuild -ba *.spec to get that.
While rpm seems to have a "%bcond_with(out)" macro defined by default, which is harder to learn but is rebuild friendly.
Good luck!
Greetings
Marguerite -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
-- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org