[CMake] java_home usage

2018-10-22 Thread Stéphane Ancelot

Hi,

If I set java_home in cmake 3.12 , Java_JAVAC_EXECUTABLE is not using my 
java_home env but /usr/bin/javac



what is wrong ?

Regards,

S.Ancelot

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


[CMake] Signing individual binary and problem with PackageMaker CPack generator

2018-10-22 Thread Anatoly Belyaev

We use CMake

|add_custom_command(TARGET POST_BUILD COMMAND codesign ...) |

for signing executable files on build. It works fine, but when CPack 
generates package it rewrites rpath on executable files and call strip 
command on them. This changes the file and invalidates the signature. Is 
there any way in CMake to sign binary files after CPack finishes install 
and before actual packaging?


--

Best regards, Anatoly Belyaev

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


[CMake] Howot add jar files in final jar file

2018-10-22 Thread Stéphane Ancelot

Hi,

I have to package some jar files in the final jar.

I can compile it with add_jar specifying INCLUDE_JARS but unfortunately, 
they are not added to the final target jarfile


Regards

S.Ancelot
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Howot add jar files in final jar file

2018-10-22 Thread Marc CHEVRIER
Option INCLUDE_JARS is used to specify classpath javac option for java
sources compilation.
Currently, there is no possibility to add jars using add_jar command. You
have to use a custom command for that purpose.


Le lun. 22 oct. 2018 à 11:05, Stéphane Ancelot  a
écrit :

> Hi,
>
> I have to package some jar files in the final jar.
>
> I can compile it with add_jar specifying INCLUDE_JARS but unfortunately,
> they are not added to the final target jarfile
>
> Regards
>
> S.Ancelot
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] java_home usage

2018-10-22 Thread Marc CHEVRIER
Variable must be specified using upper case. So 'set (JAVA_HOME ...)'
should be OK (or environment variable JAVA_HOME is OK as well). javac is
expected to be in $JAVA_HOME/bin.


Le lun. 22 oct. 2018 à 10:16, Stéphane Ancelot  a
écrit :

> Hi,
>
> If I set java_home in cmake 3.12 , Java_JAVAC_EXECUTABLE is not using my
> java_home env but /usr/bin/javac
>
>
> what is wrong ?
>
> Regards,
>
> S.Ancelot
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] java_home usage

2018-10-22 Thread Stéphane Ancelot



Le 22/10/2018 à 11:19, Marc CHEVRIER a écrit :
Variable must be specified using upper case. So 'set (JAVA_HOME ...)' 
should be OK (or environment variable JAVA_HOME is OK as well). javac 
is expected to be in $JAVA_HOME/bin.



Yes, It is :
set(JAVA_HOME /usr/lib/jvm/jdk1.6.0_45)



Le lun. 22 oct. 2018 à 10:16, Stéphane Ancelot 
mailto:sance...@numalliance.com>> a écrit :


Hi,

If I set java_home in cmake 3.12 , Java_JAVAC_EXECUTABLE is not
using my
java_home env but /usr/bin/javac


what is wrong ?

Regards,

S.Ancelot

-- 


Powered by www.kitware.com 

Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community.
For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake



-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Signing individual binary and problem with PackageMaker CPack generator

2018-10-22 Thread Anatoly Belyaev
We use "PackageMaker" generator on MacOS.  But i don't think it is CPack 
specific tool does call strip command.  The code for RPATH rewrite and 
strip cmd is located in cmake_install.cmake. As i understand CPack calls 
make install to tmp dir and then creates package.


Having different RPATH for build tree is useful. May be there is a way 
to call sign tool in the install stage? But reading the doc to CMake 
install command, doesn't help me find solution for this.



Best regards, Anatoly Belyaev


On 22.10.2018 11:55, Eric Noulard wrote:



Le lun. 22 oct. 2018 à 10:21, Anatoly Belyaev > a écrit :


We use CMake

|add_custom_command(TARGET POST_BUILD COMMAND codesign ...) |

for signing executable files on build. It works fine, but when
CPack generates package it rewrites rpath on executable files and
call strip command on them. This changes the file and invalidates
the signature. Is there any way in CMake to sign binary files
after CPack finishes install and before actual packaging?

As you discovered CPack runs at a different moment than CMake (see: 
https://github.com/dev-cafe/cmake-cookbook/blob/master/figures/cmake-times/cmake-times.jpg)


RPATH is rewritten because you may have different build and install RPATH.
https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling.

Concerning the strip part I'm not sure CPack does that. May be the 
CPack generator specific tool does it?
I bet there is no generic way to that without extending CPack or the 
particular generator ou are using.

What CPack generator(s) do you use?

--
Eric


-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Signing individual binary and problem with PackageMaker CPack generator

2018-10-22 Thread Eric Noulard
Le lun. 22 oct. 2018 à 11:56, Anatoly Belyaev  a écrit :

> We use "PackageMaker" generator on MacOS.  But i don't think it is CPack
> specific tool does call strip command.  The code for RPATH rewrite and
> strip cmd is located in cmake_install.cmake. As i understand CPack calls
> make install to tmp dir and then creates package.
>

Sorry I've just realized it was in the title of your message.
I wasn't aware that stripping was done during install.


> Having different RPATH for build tree is useful. May be there is a way to
> call sign tool in the install stage? But reading the doc to CMake install
> command, doesn't help me find solution for this.
>

Yes I agree that having build rpath is useful.
I am not aware of any mechanism that enable calling some tool during
CPack's install step.
Moreover I don't use MacOS at all so I don't have any experience with
PackageMaker.

May be some Mac user may shed some more light on this.

-- 
Eric
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Signing individual binary and problem with PackageMaker CPack generator

2018-10-22 Thread Craig Scott
On Tue, Oct 23, 2018 at 12:32 AM Eric Noulard 
wrote:

>
>
> Le lun. 22 oct. 2018 à 11:56, Anatoly Belyaev  a
> écrit :
>
>> We use "PackageMaker" generator on MacOS.  But i don't think it is CPack
>> specific tool does call strip command.  The code for RPATH rewrite and
>> strip cmd is located in cmake_install.cmake. As i understand CPack calls
>> make install to tmp dir and then creates package.
>>
> Unrelated to your question, but PackageMaker is deprecated (by Apple).
Recent macOS releases don't even have it. You may want to look into
productbuild instead.



>
> Sorry I've just realized it was in the title of your message.
> I wasn't aware that stripping was done during install.
>
>
>> Having different RPATH for build tree is useful. May be there is a way to
>> call sign tool in the install stage? But reading the doc to CMake install
>> command, doesn't help me find solution for this.
>>
>
> Yes I agree that having build rpath is useful.
> I am not aware of any mechanism that enable calling some tool during
> CPack's install step.
> Moreover I don't use MacOS at all so I don't have any experience with
> PackageMaker.
>
> May be some Mac user may shed some more light on this.
>

You should be able to do this using install(SCRIPT) or install(CODE),
invoking the code signing through execute_process() as part of that
script/code.

Taking a step back though, I don't know what your package contains, but if
you're creating an app bundle, then you don't need CPack at all. An app
bundle is already self contained and you should be able to get it to build
with install RPATH, at which point it should find everything it needs. An
advantage of building with install RPATH is that you can also make use of
the XCODE_ATTRIBUTE target property support to set up the code signing and
have Xcode/xcodebuild drive the whole code signing process for you. It's
likely to be easier that way and is more compatible with tools like Fastlane
, if you end up heading in that direction. But if
you have embedded frameworks, then yeah, you probably end up having to do
things manually yourself (CMake doesn't yet handle those well and has no
direct support for it).

-- 
Craig Scott
Melbourne, Australia
https://crascit.com

New book released: Professional CMake: A Practical Guide

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Signing individual binary and problem with PackageMaker CPack generator

2018-10-22 Thread Eric Noulard
Le lun. 22 oct. 2018 à 23:05, Craig Scott  a
écrit :

>
>> Yes I agree that having build rpath is useful.
>> I am not aware of any mechanism that enable calling some tool during
>> CPack's install step.
>> Moreover I don't use MacOS at all so I don't have any experience with
>> PackageMaker.
>>
>> May be some Mac user may shed some more light on this.
>>
>
> You should be able to do this using install(SCRIPT) or install(CODE),
> invoking the code signing through execute_process() as part of that
> script/code.
>

I wasn't sure of that.

So just to be clear  do we know for sure that install(SCRIPT) install(CODE)
will run after the CMake builtin-generated install scripts?
The builtin generated install script for target includes stripping, so for
signing to work as expect we should be sure of the execution order?
Or may be you suggest not to install(TARGET) for the concerned target and
write install(SCRIPT) replacement for those?


Taking a step back though, I don't know what your package contains, but if
> you're creating an app bundle, then you don't need CPack at all. An app
> bundle is already self contained and you should be able to get it to build
> with install RPATH, at which point it should find everything it needs. An
> advantage of building with install RPATH is that you can also make use of
> the XCODE_ATTRIBUTE target property support to set up the code signing and
> have Xcode/xcodebuild drive the whole code signing process for you. It's
> likely to be easier that way and is more compatible with tools like
> Fastlane , if you end up heading in that
> direction. But if you have embedded frameworks, then yeah, you probably end
> up having to do things manually yourself (CMake doesn't yet handle those
> well and has no direct support for it).
>
> --
> Craig Scott
> Melbourne, Australia
> https://crascit.com
>
> New book released: Professional CMake: A Practical Guide
> 
>

-- 
Eric
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] how to debug CPack creation

2018-10-22 Thread Илья Шипицин
Eric, thank you for your review.
I still wonder why is it so complicated (my expectation was "ok, since I
use both cmake and cpack, they should work together")

can you please review
https://github.com/SoftEtherVPN/SoftEtherVPN/commit/139fffe6e0c218f580cd8a397d94856be37fa947
(it is based on your suggestions)

сб, 20 окт. 2018 г. в 17:59, Eric Noulard :

>
>
> Le sam. 20 oct. 2018 à 10:54, Илья Шипицин  a
> écrit :
>
>>
>>
>> сб, 20 окт. 2018 г. в 13:30, Eric Noulard :
>>
>>>
>>>
>>> Le sam. 20 oct. 2018 à 10:15, Илья Шипицин  a
>>> écrit :
>>>
 hi,

 we use cmake/cpack for mangling systemd scripts


 https://github.com/SoftEtherVPN/SoftEtherVPN/blob/master/src/vpnserver/CMakeLists.txt#L26

 what happens:

 (*) deb installs files to /usr/libexec
 (*) cmake sets location as /usr/local/libexec

>>>
>>> It looks like your get default "/usr/local" prefix from somewhere.
>>>
>>
>> exactly.
>>
>
> So I I understand it well (correct me if I'm wrong) when you do:
>
> 1) make install
> You get all installed files prefixed by /usr/local
> which is the expected behaviour unless you configure
> CMAKE_INSTALL_PREFIX
> or you use
> DESTDIR=/your/prefix make install
>
> 2) deb created by CPack get "/usr" prefix instead
>which is the expected behaviour unless you specify an alternate value
> using
>CPACK_PACKAGING_INSTALL_PREFIX
>
> go to your build tree and try:
> cpack -G DEB -D  CPACK_PACKAGING_INSTALL_PREFIX=/opt
>
> and you'll see that the .deb will have /opt prefix.
>
> The question is what do expect as a prefix?
> /usr/local
> /usr
> something else ??
>
> The rules are the following when using install rule.
> 1) if your DESTINATION is a relative path then it will be prefix with
>CMAKE_INSTALL_PREFIX when doing make install
>CPACK_PACKAGING_INSTALL_PREFIX when building package with CPack
>
> 2) if your DESTINATION is "absolute" like /etc/whatever/confdir
> It'll get install there when doing make install (whatever the value
> of  CMAKE_INSTALL_PREFIX)
>
> With CPack, it depends on the generator.
>Some generators (like DEB a,nd RPM) try to catch "absolute" install
> file and handle them
>as config file. RPM generator is more verbose about it see below.
>
> Is the RPM containing what you expect?
>>>
>>
>> I did not check it yet.
>>
>
> I tried using:
> $  cpack -G RPM
>
> and you get expected warning about the mix of absolute and relative
> install path:
> CPack: Create package using RPM
> CPack: Install projects
> CPack: - Install project: SoftEtherVPN
> CPack: -   Install component: vpnserver
> CPack: -   Install component: vpnclient
> CPack: -   Install component: vpnbridge
> CPack: -   Install component: vpncmd
> CPack: Create package
> CMake Warning (dev) at
> /home/enoulard/local/share/cmake-3.12/Modules/Internal/CPack/CPackRPM.cmake:135
> (message):
>   CPackRPM:Warning: Path /lib/systemd/system/softether-vpnbridge.service is
>   not on one of the relocatable paths! Package will be partially
> relocatable.
> Call Stack (most recent call first):
>
> /home/enoulard/local/share/cmake-3.12/Modules/Internal/CPack/CPackRPM.cmake:1001
> (cpack_rpm_prepare_relocation_paths)
>
> /home/enoulard/local/share/cmake-3.12/Modules/Internal/CPack/CPackRPM.cmake:1870
> (cpack_rpm_generate_package)
> This warning is for project developers.  Use -Wno-dev to suppress it.
>
> [...]
>
> CPack: - package: []/build/softether-vpnbridge-5.1.9660-1.x86_64.rpm
> generated.
> CPack: - package: []/build/softether-vpnclient-5.1.9660-1.x86_64.rpm
> generated.
> CPack: - package: []/build/softether-vpncmd-5.1.9660-1.x86_64.rpm
> generated.
> CPack: - package: []/build/softether-vpnserver-5.1.9660-1.x86_64.rpm
> generated.
>
> And the content is:
> $ rpm -qpl softether-vpnserver-5.1.9660-1.x86_64.rpm
> /lib
> /lib/systemd
> /lib/systemd/system
> /lib/systemd/system/softether-vpnserver.service
> /usr/libexec
> /usr/libexec/softether
> /usr/libexec/softether/vpnserver
> /usr/libexec/softether/vpnserver/hamcore.se2
> /usr/libexec/softether/vpnserver/vpnserver
> /usr/local
> /usr/local/bin
> /usr/local/bin/vpnserver
>
> the content of the .deb is similar:
> $ dpkg-deb -c softether-vpnserver_5.1.9660_amd64.deb
> drwxr-xr-x root/root 0 2018-10-20 14:45 ./lib/
> drwxr-xr-x root/root 0 2018-10-20 14:45 ./lib/systemd/
> drwxr-xr-x root/root 0 2018-10-20 14:45 ./lib/systemd/system/
> -rw-r--r-- root/root   700 2018-10-20 14:45
> ./lib/systemd/system/softether-vpnserver.service
> drwxr-xr-x root/root 0 2018-10-20 14:45 ./usr/
> drwxr-xr-x root/root 0 2018-10-20 14:45 ./usr/libexec/
> drwxr-xr-x root/root 0 2018-10-20 14:45 ./usr/libexec/softether/
> drwxr-xr-x root/root 0 2018-10-20 14:45
> ./usr/libexec/softether/vpnserver/
> -rw-r--r-- root/root   1770716 2018-10-20 14:45
> ./usr/libexec/softether/vpnserver/hamcore.se2
> -rwxr-xr-x root/root   2088960 2018-10-20 14:45
> ./usr/libexec/softeth

Re: [CMake] how to debug CPack creation

2018-10-22 Thread Eric Noulard
Le mar. 23 oct. 2018 à 08:07, Илья Шипицин  a écrit :

> Eric, thank you for your review.
> I still wonder why is it so complicated (my expectation was "ok, since I
> use both cmake and cpack, they should work together")
>

The main reason is that CPack was first design as a standalone tool that
can be used without CMake.
I guess that some project may still be using that way.
CMake has a "simple" way to generate CPackConfig.cmake file that drives the
CPack run but you can generate those files
by other mean and still be using CPack, without CMake.



> can you please review
> https://github.com/SoftEtherVPN/SoftEtherVPN/commit/139fffe6e0c218f580cd8a397d94856be37fa947
> (it is based on your suggestions)
>

I made comment on this commit, basically don't generate *any* file in
source tree it's a [relatively] bad habit.
If a file is an artefact of the build then it belongs to build tree.

As a matter of fact you CI build tree seems to /tmp (from your
configure script) but if ever this is changing it'll break the build
use CMAKE_BINARY_DIR.

I think it should work now but your CI will show you if it's ok.

Now concerning your CMAKE_INSTALL_PREFIX if your CI is producing ready to
use .deb / .rpm etc... package then
you'd better use "/opt" as a prefix as suggested by Craig.




> сб, 20 окт. 2018 г. в 17:59, Eric Noulard :
>
>>
>>
>> Le sam. 20 oct. 2018 à 10:54, Илья Шипицин  a
>> écrit :
>>
>>>
>>>
>>> сб, 20 окт. 2018 г. в 13:30, Eric Noulard :
>>>


 Le sam. 20 oct. 2018 à 10:15, Илья Шипицин  a
 écrit :

> hi,
>
> we use cmake/cpack for mangling systemd scripts
>
>
> https://github.com/SoftEtherVPN/SoftEtherVPN/blob/master/src/vpnserver/CMakeLists.txt#L26
>
> what happens:
>
> (*) deb installs files to /usr/libexec
> (*) cmake sets location as /usr/local/libexec
>

 It looks like your get default "/usr/local" prefix from somewhere.

>>>
>>> exactly.
>>>
>>
>> So I I understand it well (correct me if I'm wrong) when you do:
>>
>> 1) make install
>> You get all installed files prefixed by /usr/local
>> which is the expected behaviour unless you configure
>> CMAKE_INSTALL_PREFIX
>> or you use
>> DESTDIR=/your/prefix make install
>>
>> 2) deb created by CPack get "/usr" prefix instead
>>which is the expected behaviour unless you specify an alternate value
>> using
>>CPACK_PACKAGING_INSTALL_PREFIX
>>
>> go to your build tree and try:
>> cpack -G DEB -D  CPACK_PACKAGING_INSTALL_PREFIX=/opt
>>
>> and you'll see that the .deb will have /opt prefix.
>>
>> The question is what do expect as a prefix?
>> /usr/local
>> /usr
>> something else ??
>>
>> The rules are the following when using install rule.
>> 1) if your DESTINATION is a relative path then it will be prefix with
>>CMAKE_INSTALL_PREFIX when doing make install
>>CPACK_PACKAGING_INSTALL_PREFIX when building package with CPack
>>
>> 2) if your DESTINATION is "absolute" like /etc/whatever/confdir
>> It'll get install there when doing make install (whatever the value
>> of  CMAKE_INSTALL_PREFIX)
>>
>> With CPack, it depends on the generator.
>>Some generators (like DEB a,nd RPM) try to catch "absolute" install
>> file and handle them
>>as config file. RPM generator is more verbose about it see below.
>>
>> Is the RPM containing what you expect?

>>>
>>> I did not check it yet.
>>>
>>
>> I tried using:
>> $  cpack -G RPM
>>
>> and you get expected warning about the mix of absolute and relative
>> install path:
>> CPack: Create package using RPM
>> CPack: Install projects
>> CPack: - Install project: SoftEtherVPN
>> CPack: -   Install component: vpnserver
>> CPack: -   Install component: vpnclient
>> CPack: -   Install component: vpnbridge
>> CPack: -   Install component: vpncmd
>> CPack: Create package
>> CMake Warning (dev) at
>> /home/enoulard/local/share/cmake-3.12/Modules/Internal/CPack/CPackRPM.cmake:135
>> (message):
>>   CPackRPM:Warning: Path /lib/systemd/system/softether-vpnbridge.service
>> is
>>   not on one of the relocatable paths! Package will be partially
>> relocatable.
>> Call Stack (most recent call first):
>>
>> /home/enoulard/local/share/cmake-3.12/Modules/Internal/CPack/CPackRPM.cmake:1001
>> (cpack_rpm_prepare_relocation_paths)
>>
>> /home/enoulard/local/share/cmake-3.12/Modules/Internal/CPack/CPackRPM.cmake:1870
>> (cpack_rpm_generate_package)
>> This warning is for project developers.  Use -Wno-dev to suppress it.
>>
>> [...]
>>
>> CPack: - package: []/build/softether-vpnbridge-5.1.9660-1.x86_64.rpm
>> generated.
>> CPack: - package: []/build/softether-vpnclient-5.1.9660-1.x86_64.rpm
>> generated.
>> CPack: - package: []/build/softether-vpncmd-5.1.9660-1.x86_64.rpm
>> generated.
>> CPack: - package: []/build/softether-vpnserver-5.1.9660-1.x86_64.rpm
>> generated.
>>
>> And the content is:
>> $ rpm -qpl softether-vpnserver-5.1.9660-1.x86_64.rpm
>> /lib
>> /lib/systemd
>> /lib/systemd/system
>> /lib/syst