* [Xen-devel] [PATCH] libxenstat: fixed Makefile for building python-bindings
@ 2020-03-02 17:53 jonas.licht
2020-03-04 10:31 ` Wei Liu
0 siblings, 1 reply; 4+ messages in thread
From: jonas.licht @ 2020-03-02 17:53 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Wei Liu
Fixes the libxenstat Makefile to determine the correct paths
of python includes when building python-bindings.
Also replaces the -lxenstat linking to correct object files
and use the libdir variable for installing.
Signed-off-by: Jonas Licht <jonas.licht@fem.tu-ilmenau.de>
---
tools/xenstat/libxenstat/Makefile | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/tools/xenstat/libxenstat/Makefile
b/tools/xenstat/libxenstat/Makefile
index 03cb212e3b..4a02d2e563 100644
--- a/tools/xenstat/libxenstat/Makefile
+++ b/tools/xenstat/libxenstat/Makefile
@@ -114,18 +114,17 @@ $(BINDINGS): $(SHLIB) $(SHLIB_LINKS) src/xenstat.h
SWIG_FLAGS=-module xenstat -Isrc
# Python bindings
-PYTHON_VERSION=$(PYTHON:python%=%)
-PYTHON_FLAGS=-I/usr/include/python$(PYTHON_VERSION)
-lpython$(PYTHON_VERSION)
+PYTHON_FLAGS=`$(PYTHON) -c 'import distutils.sysconfig; print("-I" +
distutils.sysconfig.get_python_inc(True) + " " +
distutils.sysconfig.get_config_var("BLDLIBRARY"))'`
$(PYMOD): $(PYSRC)
$(PYSRC): bindings/swig/xenstat.i
swig -python $(SWIG_FLAGS) -outdir $(@D) -o $(PYSRC) $<
$(PYLIB): $(PYSRC)
- $(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_LDFLAGS)
-lxenstat -o $@ $< $(APPEND_LDFLAGS)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_LDFLAGS) -o
$@ $< $(SHLIB) $(LDLIBS-y) $(APPEND_LDFLAGS)
python-bindings: $(PYLIB) $(PYMOD)
-pythonlibdir=$(prefix)/lib/python$(PYTHON_VERSION)/site-packages
+pythonlibdir=`$(PYTHON) -c 'import distutils.sysconfig;
print(distutils.sysconfig.get_python_lib())'`
install-python-bindings: $(PYLIB) $(PYMOD)
$(INSTALL_PROG) $(PYLIB) $(DESTDIR)$(pythonlibdir)/_xenstat.so
$(INSTALL_PROG) $(PYMOD) $(DESTDIR)$(pythonlibdir)/xenstat.py
@@ -149,13 +148,13 @@ $(PERLSRC): bindings/swig/xenstat.i
swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $(PERLSRC) $<
$(PERLLIB): $(PERLSRC)
- $(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) $(SHLIB_LDFLAGS)
-lxenstat -o $@ $< $(APPEND_LDFLAGS)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) $(SHLIB_LDFLAGS) -o $@
$< $(SHLIB) $(LDLIBS-y) $(APPEND_LDFLAGS)
.PHONY: perl-bindings
perl-bindings: $(PERLLIB) $(PERLMOD)
.PHONY: install-perl-bindings
-perllibdir=$(prefix)/lib/perl5
+perllibdir=$(prefix)/$(libdir)/perl5
perlmoddir=$(prefix)/share/perl5
install-perl-bindings: $(PERLLIB) $(PERLMOD)
$(INSTALL_PROG) $(PERLLIB) $(DESTDIR)$(perllibdir)/xenstat.so
--
2.24.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Xen-devel] [PATCH] libxenstat: fixed Makefile for building python-bindings
2020-03-02 17:53 [Xen-devel] [PATCH] libxenstat: fixed Makefile for building python-bindings jonas.licht
@ 2020-03-04 10:31 ` Wei Liu
2020-03-04 17:29 ` Jonas Licht
0 siblings, 1 reply; 4+ messages in thread
From: Wei Liu @ 2020-03-04 10:31 UTC (permalink / raw)
To: jonas.licht; +Cc: xen-devel, Ian Jackson, Wei Liu
Hi Jonas
Thanks for this patch.
On Mon, Mar 02, 2020 at 06:53:38PM +0100, jonas.licht@fem.tu-ilmenau.de wrote:
> Fixes the libxenstat Makefile to determine the correct paths
> of python includes when building python-bindings.
> Also replaces the -lxenstat linking to correct object files
> and use the libdir variable for installing.
>
> Signed-off-by: Jonas Licht <jonas.licht@fem.tu-ilmenau.de>
> ---
> tools/xenstat/libxenstat/Makefile | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/tools/xenstat/libxenstat/Makefile
> b/tools/xenstat/libxenstat/Makefile
> index 03cb212e3b..4a02d2e563 100644
> --- a/tools/xenstat/libxenstat/Makefile
> +++ b/tools/xenstat/libxenstat/Makefile
> @@ -114,18 +114,17 @@ $(BINDINGS): $(SHLIB) $(SHLIB_LINKS) src/xenstat.h
> SWIG_FLAGS=-module xenstat -Isrc
>
> # Python bindings
> -PYTHON_VERSION=$(PYTHON:python%=%)
> -PYTHON_FLAGS=-I/usr/include/python$(PYTHON_VERSION)
> -lpython$(PYTHON_VERSION)
> +PYTHON_FLAGS=`$(PYTHON) -c 'import distutils.sysconfig; print("-I" +
A better approach would be to use python-config here.
> distutils.sysconfig.get_python_inc(True) + " " +
> distutils.sysconfig.get_config_var("BLDLIBRARY"))'`
> $(PYMOD): $(PYSRC)
> $(PYSRC): bindings/swig/xenstat.i
> swig -python $(SWIG_FLAGS) -outdir $(@D) -o $(PYSRC) $<
>
> $(PYLIB): $(PYSRC)
> - $(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_LDFLAGS)
> -lxenstat -o $@ $< $(APPEND_LDFLAGS)
> + $(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_LDFLAGS) -o $@ $<
> $(SHLIB) $(LDLIBS-y) $(APPEND_LDFLAGS)
>
> python-bindings: $(PYLIB) $(PYMOD)
>
> -pythonlibdir=$(prefix)/lib/python$(PYTHON_VERSION)/site-packages
> +pythonlibdir=`$(PYTHON) -c 'import distutils.sysconfig;
And here.
Wei.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xen-devel] [PATCH] libxenstat: fixed Makefile for building python-bindings
2020-03-04 10:31 ` Wei Liu
@ 2020-03-04 17:29 ` Jonas Licht
2020-03-06 17:21 ` Wei Liu
0 siblings, 1 reply; 4+ messages in thread
From: Jonas Licht @ 2020-03-04 17:29 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Wei Liu
Am 04.03.20 um 11:31 schrieb Wei Liu:
> Hi Jonas
Hi Wei
> Thanks for this patch.
>
> On Mon, Mar 02, 2020 at 06:53:38PM +0100, jonas.licht@fem.tu-ilmenau.de wrote:
>> Fixes the libxenstat Makefile to determine the correct paths
>> of python includes when building python-bindings.
>> Also replaces the -lxenstat linking to correct object files
>> and use the libdir variable for installing.
>>
>> Signed-off-by: Jonas Licht <jonas.licht@fem.tu-ilmenau.de>
>> ---
>> tools/xenstat/libxenstat/Makefile | 11 +++++------
>> 1 file changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/tools/xenstat/libxenstat/Makefile
>> b/tools/xenstat/libxenstat/Makefile
>> index 03cb212e3b..4a02d2e563 100644
>> --- a/tools/xenstat/libxenstat/Makefile
>> +++ b/tools/xenstat/libxenstat/Makefile
>> @@ -114,18 +114,17 @@ $(BINDINGS): $(SHLIB) $(SHLIB_LINKS) src/xenstat.h
>> SWIG_FLAGS=-module xenstat -Isrc
>>
>> # Python bindings
>> -PYTHON_VERSION=$(PYTHON:python%=%)
>> -PYTHON_FLAGS=-I/usr/include/python$(PYTHON_VERSION)
>> -lpython$(PYTHON_VERSION)
>> +PYTHON_FLAGS=`$(PYTHON) -c 'import distutils.sysconfig; print("-I" +
> A better approach would be to use python-config here.
I'm not quite sure if I can require the python-config tool is installed.
As I see it's not checked by the configure.
I've seen some configure scripts, which has an extra fallback when
python-config is missing.
I was inspired by the m4/python_devel.m4 script too.
Best regards,
Jonas
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xen-devel] [PATCH] libxenstat: fixed Makefile for building python-bindings
2020-03-04 17:29 ` Jonas Licht
@ 2020-03-06 17:21 ` Wei Liu
0 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2020-03-06 17:21 UTC (permalink / raw)
To: Jonas Licht; +Cc: xen-devel, Ian Jackson, Wei Liu
On Wed, Mar 04, 2020 at 06:29:39PM +0100, Jonas Licht wrote:
> Am 04.03.20 um 11:31 schrieb Wei Liu:
> > Hi Jonas
> Hi Wei
> > Thanks for this patch.
> >
> > On Mon, Mar 02, 2020 at 06:53:38PM +0100, jonas.licht@fem.tu-ilmenau.de wrote:
> >> Fixes the libxenstat Makefile to determine the correct paths
> >> of python includes when building python-bindings.
> >> Also replaces the -lxenstat linking to correct object files
> >> and use the libdir variable for installing.
> >>
> >> Signed-off-by: Jonas Licht <jonas.licht@fem.tu-ilmenau.de>
> >> ---
> >> tools/xenstat/libxenstat/Makefile | 11 +++++------
> >> 1 file changed, 5 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/tools/xenstat/libxenstat/Makefile
> >> b/tools/xenstat/libxenstat/Makefile
> >> index 03cb212e3b..4a02d2e563 100644
> >> --- a/tools/xenstat/libxenstat/Makefile
> >> +++ b/tools/xenstat/libxenstat/Makefile
> >> @@ -114,18 +114,17 @@ $(BINDINGS): $(SHLIB) $(SHLIB_LINKS) src/xenstat.h
> >> SWIG_FLAGS=-module xenstat -Isrc
> >>
> >> # Python bindings
> >> -PYTHON_VERSION=$(PYTHON:python%=%)
> >> -PYTHON_FLAGS=-I/usr/include/python$(PYTHON_VERSION)
> >> -lpython$(PYTHON_VERSION)
> >> +PYTHON_FLAGS=`$(PYTHON) -c 'import distutils.sysconfig; print("-I" +
> > A better approach would be to use python-config here.
> I'm not quite sure if I can require the python-config tool is installed.
> As I see it's not checked by the configure.
python-config is installed as part of python-dev on Debian, as well as
Redhat/CentOS.
The configure script does check if python development package is
installed.
> I've seen some configure scripts, which has an extra fallback when
> python-config is missing.
> I was inspired by the m4/python_devel.m4 script too.
In any case, I think this patch is already an improvement over what is
in tree.
Acked-by: Wei Liu <wl@xen.org>
Wei.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-06 17:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-02 17:53 [Xen-devel] [PATCH] libxenstat: fixed Makefile for building python-bindings jonas.licht
2020-03-04 10:31 ` Wei Liu
2020-03-04 17:29 ` Jonas Licht
2020-03-06 17:21 ` Wei Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).