diff mbox

[1/2] qt5connectivity: add sdpscanner tool for Qt5Bluetooth

Message ID 1459763762-31640-1-git-send-email-corjon.j@ecagroup.com
State Accepted
Headers show

Commit Message

Julien Corjon April 4, 2016, 9:56 a.m. UTC
Signed-off-by: Julien Corjon <corjon.j@ecagroup.com>
---
 package/qt5/qt5connectivity/qt5connectivity.mk | 1 +
 1 file changed, 1 insertion(+)

Comments

Yegor Yefremov April 4, 2016, 10:02 a.m. UTC | #1
Hi Julien, all,

On Mon, Apr 4, 2016 at 11:56 AM, Julien Corjon <corjon.j@ecagroup.com> wrote:
> Signed-off-by: Julien Corjon <corjon.j@ecagroup.com>
> ---
>  package/qt5/qt5connectivity/qt5connectivity.mk | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/package/qt5/qt5connectivity/qt5connectivity.mk b/package/qt5/qt5connectivity/qt5connectivity.mk
> index a68f5ec..936bc6f 100644
> --- a/package/qt5/qt5connectivity/qt5connectivity.mk
> +++ b/package/qt5/qt5connectivity/qt5connectivity.mk
> @@ -43,6 +43,7 @@ endif
>
>  define QT5CONNECTIVITY_INSTALL_TARGET_CMDS
>         cp -dpf $(STAGING_DIR)/usr/lib/libQt5Bluetooth.so.* $(TARGET_DIR)/usr/lib
> +       cp -dpf $(STAGING_DIR)/usr/bin/sdpscanner $(TARGET_DIR)/usr/bin

would $(INSTALL) be preferable here? Do we have any rules?

Yegor

>         $(QT5CONNECTIVITY_INSTALL_TARGET_QMLS)
>  endef
>
> --
> 2.5.0
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Arnout Vandecappelle April 4, 2016, 8:26 p.m. UTC | #2
On 04/04/16 12:02, Yegor Yefremov wrote:
> Hi Julien, all,
>
> On Mon, Apr 4, 2016 at 11:56 AM, Julien Corjon <corjon.j@ecagroup.com> wrote:
>> Signed-off-by: Julien Corjon <corjon.j@ecagroup.com>
>> ---
>>   package/qt5/qt5connectivity/qt5connectivity.mk | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/package/qt5/qt5connectivity/qt5connectivity.mk b/package/qt5/qt5connectivity/qt5connectivity.mk
>> index a68f5ec..936bc6f 100644
>> --- a/package/qt5/qt5connectivity/qt5connectivity.mk
>> +++ b/package/qt5/qt5connectivity/qt5connectivity.mk
>> @@ -43,6 +43,7 @@ endif
>>
>>   define QT5CONNECTIVITY_INSTALL_TARGET_CMDS
>>          cp -dpf $(STAGING_DIR)/usr/lib/libQt5Bluetooth.so.* $(TARGET_DIR)/usr/lib
>> +       cp -dpf $(STAGING_DIR)/usr/bin/sdpscanner $(TARGET_DIR)/usr/bin
>
> would $(INSTALL) be preferable here? Do we have any rules?

  We generally prefer install, but in this case it's nice to keep the same 
construct as the previous line, so I'm OK with it. So:

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>


  That said, I wonder why we are doing all this manual copying for qt5, instead 
of just running 'make install'. AFAICS the only thing that isn't already cleaned 
up in the finalize step are the QML files, and these can easily be cleaned up as 
a finalize hook. Thomas, do you remember why you did it this way?

  Regards,
  Arnout

>
> Yegor
>
>>          $(QT5CONNECTIVITY_INSTALL_TARGET_QMLS)
>>   endef
>>
>> --
>> 2.5.0
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot@busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
Thomas Petazzoni April 5, 2016, 2:25 p.m. UTC | #3
Hello,

On Mon, 4 Apr 2016 22:26:12 +0200, Arnout Vandecappelle wrote:

>   That said, I wonder why we are doing all this manual copying for qt5, instead 
> of just running 'make install'. AFAICS the only thing that isn't already cleaned 
> up in the finalize step are the QML files, and these can easily be cleaned up as 
> a finalize hook. Thomas, do you remember why you did it this way?

No, I don't quite remember. It is worth trying to use "make install"
and see if there is any problem. I think the reason for qt5base.mk is
that we want to conditionally install some libraries. But for the other
qt5* packages, I don't remember.

Thomas
Thomas Petazzoni April 13, 2016, 9:50 p.m. UTC | #4
Hello,

On Mon,  4 Apr 2016 11:56:01 +0200, Julien Corjon wrote:
> Signed-off-by: Julien Corjon <corjon.j@ecagroup.com>
> ---
>  package/qt5/qt5connectivity/qt5connectivity.mk | 1 +
>  1 file changed, 1 insertion(+)

Applied to master, thanks.

Thomas
Thomas Petazzoni April 18, 2016, 10:10 p.m. UTC | #5
Hello,

On Mon, 4 Apr 2016 22:26:12 +0200, Arnout Vandecappelle wrote:

>   That said, I wonder why we are doing all this manual copying for qt5, instead 
> of just running 'make install'. AFAICS the only thing that isn't already cleaned 
> up in the finalize step are the QML files, and these can easily be cleaned up as 
> a finalize hook. Thomas, do you remember why you did it this way?

I had a look at this, and I know why. If you look at the staging
installation, we do just:

	$(MAKE) -C $(@D) install

without passing any DESTDIR=$(STAGING_DIR) or anything like that.

The makefiles generated by qmake support a $(INSTALL_ROOT) variable
that prefixes all installation paths. However, due to how we configure
qmake, the fixed path (after $(INSTALL_ROOT)) already contains the full
path to our staging directory. From some random Qt5-generated Makefile:

-$(INSTALL_PROGRAM) ../../lib/$(TARGET) $(INSTALL_ROOT)/home/test/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/$(TARGET)

That's why we don't pass any DESTDIR/INSTALL_ROOT during staging
installation, and why we do the target installation manually.

So one could say that our initial qmake configuration in qt5base.mk is
broken. That's possible. But I believe that if we try to fix this (so
that the generated Makefile don't contain this hardcoded path to the
staging directory), then qmake would no longer work "automagically" as
it currently. However, it would be really interesting to have a look at
that and see if a good solution can be found. If our Qt5 folks (Julien
and Peter Seiderer) want to have a look, it'd be great.

I had a quick look at meta-qt5 in Yocto, and here is what they do:

find . -name "Makefile*" | xargs -r sed -i "s,(INSTALL_ROOT)${STAGING_DIR_TARGET},(INSTALL_ROOT),g"

so in essence, they fixup the generated Makefile after the fact so that
they don't contain the hardcoded sysroot path. If we can't find a clean
solution with qmake, maybe that's a possible solution to simplify the
target installation of all those qt5 packages.

One thing I wonder is how packages like qwt or quazip get properly
installed to the target/staging, since they do use INSTALL_ROOT. I had
a quick look at quazip, and its Makefiles are correct, they contain:

-$(INSTALL_FILE) /home/test/buildroot/output/build/quazip-0.7.2/quazip/crypt.h $(INSTALL_ROOT)/usr/include/quazip/

I'm puzzled. Some Qt5 person to chime in and look into this problem?

Best regards,

Thomas
Julien Corjon April 19, 2016, 10:53 a.m. UTC | #6
Thomas, all,

Le 19/04/2016 00:10, Thomas Petazzoni a écrit :
> Hello,
>
> On Mon, 4 Apr 2016 22:26:12 +0200, Arnout Vandecappelle wrote:
>
>>    That said, I wonder why we are doing all this manual copying for qt5, instead
>> of just running 'make install'. AFAICS the only thing that isn't already cleaned
>> up in the finalize step are the QML files, and these can easily be cleaned up as
>> a finalize hook. Thomas, do you remember why you did it this way?
>
> I had a look at this, and I know why. If you look at the staging
> installation, we do just:
>
> 	$(MAKE) -C $(@D) install
>
> without passing any DESTDIR=$(STAGING_DIR) or anything like that.
>
> The makefiles generated by qmake support a $(INSTALL_ROOT) variable
> that prefixes all installation paths. However, due to how we configure
> qmake, the fixed path (after $(INSTALL_ROOT)) already contains the full
> path to our staging directory. From some random Qt5-generated Makefile:
>
> -$(INSTALL_PROGRAM) ../../lib/$(TARGET) $(INSTALL_ROOT)/home/test/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/$(TARGET)

Just made a bit of digging into qt5base source. This behaviour is from 
qtbase/qmake/generators/unix/unixmake.cpp : 
UnixMakefileGenerator::defaultInstall . Even if I understand how it 
append the full path after the $(INSTALL_ROOT) I cannot understand the 
why...

>
> That's why we don't pass any DESTDIR/INSTALL_ROOT during staging
> installation, and why we do the target installation manually.
>
> So one could say that our initial qmake configuration in qt5base.mk is
> broken. That's possible. But I believe that if we try to fix this (so
> that the generated Makefile don't contain this hardcoded path to the
> staging directory), then qmake would no longer work "automagically" as
> it currently. However, it would be really interesting to have a look at
> that and see if a good solution can be found. If our Qt5 folks (Julien
> and Peter Seiderer) want to have a look, it'd be great.

We can (and probably should) fix this misfunction but we will have to 
force DESTDIR to staging and target in all qmake-based packages. Fixing 
only defaultInstall should keep qmake "automagically". Also It will be 
difficult to push such modification in Qt mainline.

>
> I had a quick look at meta-qt5 in Yocto, and here is what they do:
>
> find . -name "Makefile*" | xargs -r sed -i "s,(INSTALL_ROOT)${STAGING_DIR_TARGET},(INSTALL_ROOT),g"
>
> so in essence, they fixup the generated Makefile after the fact so that
> they don't contain the hardcoded sysroot path. If we can't find a clean
> solution with qmake, maybe that's a possible solution to simplify the
> target installation of all those qt5 packages.

How can we handle this kind of fixup with make *-install-staging / * 
-install-target?

>
> One thing I wonder is how packages like qwt or quazip get properly
> installed to the target/staging, since they do use INSTALL_ROOT. I had
> a quick look at quazip, and its Makefiles are correct, they contain:
>
> -$(INSTALL_FILE) /home/test/buildroot/output/build/quazip-0.7.2/quazip/crypt.h $(INSTALL_ROOT)/usr/include/quazip/
>
> I'm puzzled. Some Qt5 person to chime in and look into this problem?

I'm puzzled too on that one...

Regards,

Julien

>
> Best regards,
>
> Thomas
>
Thomas Petazzoni April 19, 2016, 11:26 a.m. UTC | #7
Hello Julien,

Thanks for looking into this!

On Tue, 19 Apr 2016 10:53:50 +0000, Julien CORJON wrote:

> > -$(INSTALL_PROGRAM) ../../lib/$(TARGET) $(INSTALL_ROOT)/home/test/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/$(TARGET)
> 
> Just made a bit of digging into qt5base source. This behaviour is from 
> qtbase/qmake/generators/unix/unixmake.cpp : 
> UnixMakefileGenerator::defaultInstall . Even if I understand how it 
> append the full path after the $(INSTALL_ROOT) I cannot understand the 
> why...

My guess is that since were passing -sysroot $(STAGING_DIR) to qt5's
configure script, this sysroot pass get prefixed everywhere.

> We can (and probably should) fix this misfunction but we will have to 
> force DESTDIR to staging and target in all qmake-based packages.

That's not a big deal, we're doing this for autotools packages already,
and it should be the normal thing to do.

Ideally, the installation for staging should be:

	$(MAKE) -C $(@D) INSTALL_ROOT=$(STAGING_DIR) install

and for the target:

	$(MAKE) -C $(@D) INSTALL_ROOT=$(TARGET_DIR) install

> Fixing only defaultInstall should keep qmake "automagically". Also It
> will be difficult to push such modification in Qt mainline.

Well, we need to understand why Qt behaves this way, and fix it
properly.

> > so in essence, they fixup the generated Makefile after the fact so
> > that they don't contain the hardcoded sysroot path. If we can't
> > find a clean solution with qmake, maybe that's a possible solution
> > to simplify the target installation of all those qt5 packages.
> 
> How can we handle this kind of fixup with make *-install-staging / * 
> -install-target?

We could have a generic "fixup" macro, which we register in all qt5
packages as a post-configure hook or something like that.

> > One thing I wonder is how packages like qwt or quazip get properly
> > installed to the target/staging, since they do use INSTALL_ROOT. I
> > had a quick look at quazip, and its Makefiles are correct, they
> > contain:
> >
> > -$(INSTALL_FILE) /home/test/buildroot/output/build/quazip-0.7.2/quazip/crypt.h
> > $(INSTALL_ROOT)/usr/include/quazip/
> >
> > I'm puzzled. Some Qt5 person to chime in and look into this problem?
> 
> I'm puzzled too on that one...

I think I might an idea for this one: we're passing
-headerdir /usr/include/qt5 to qt5's configure script, so the sysroot
path doesn't get prepended for header files installation.

Argh, no, not possible: this would mean that the other Qt5 packages
would install their headers in /usr/include, which is not the case.

Thomas
diff mbox

Patch

diff --git a/package/qt5/qt5connectivity/qt5connectivity.mk b/package/qt5/qt5connectivity/qt5connectivity.mk
index a68f5ec..936bc6f 100644
--- a/package/qt5/qt5connectivity/qt5connectivity.mk
+++ b/package/qt5/qt5connectivity/qt5connectivity.mk
@@ -43,6 +43,7 @@  endif
 
 define QT5CONNECTIVITY_INSTALL_TARGET_CMDS
 	cp -dpf $(STAGING_DIR)/usr/lib/libQt5Bluetooth.so.* $(TARGET_DIR)/usr/lib
+	cp -dpf $(STAGING_DIR)/usr/bin/sdpscanner $(TARGET_DIR)/usr/bin
 	$(QT5CONNECTIVITY_INSTALL_TARGET_QMLS)
 endef