* [Buildroot] [PATCH] open2300: fix build failure
@ 2014-02-05 21:09 Samuel Martin
2014-02-06 9:05 ` Thomas Petazzoni
0 siblings, 1 reply; 5+ messages in thread
From: Samuel Martin @ 2014-02-05 21:09 UTC (permalink / raw)
To: buildroot
This patch fixes the open2300's build-system, which is a handwritten
Makefile, by removing the hard-coded include and library locations and
making them pointing to the systroot.
Fixes:
http://autobuild.buildroot.org/results/072/0724ffa1355f5564b1fcd9d6e3c9ff2162d20f44/build-end.log
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
package/open2300/open2300-0001-fix-makefile.patch | 52 +++++++++++++++++++++++
package/open2300/open2300.mk | 7 ++-
2 files changed, 58 insertions(+), 1 deletion(-)
create mode 100644 package/open2300/open2300-0001-fix-makefile.patch
diff --git a/package/open2300/open2300-0001-fix-makefile.patch b/package/open2300/open2300-0001-fix-makefile.patch
new file mode 100644
index 0000000..5398d08
--- /dev/null
+++ b/package/open2300/open2300-0001-fix-makefile.patch
@@ -0,0 +1,52 @@
+From faca6c375cbb528f3f34333b3858492f4564da81 Mon Sep 17 00:00:00 2001
+From: Samuel Martin <s.martin49@gmail.com>
+Date: Wed, 5 Feb 2014 21:52:20 +0100
+Subject: [PATCH] fix makefile
+
+- allow to extend CFLAGS and CC_LDFLAGS
+- remove hard-coded include dirs. and lib. dirs. (which pointed to some
+ location in the host system)
+
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+---
+ Makefile | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 92a2cc0..6b461ef 100755
+--- a/Makefile
++++ b/Makefile
+@@ -37,9 +37,9 @@ MYSQLHISTLOGOBJ = mysqlhistlog2300.o rw2300.o linux2300.o win2300.o
+
+ VERSION = 1.11
+
+-CFLAGS = -Wall -O3 -DVERSION=\"$(VERSION)\"
+-CC_LDFLAGS = -lm
+-CC_WINFLAG =
++CFLAGS += -Wall -O3 -DVERSION=\"$(VERSION)\"
++CC_LDFLAGS += -lm
++CC_WINFLAG =
+ # For Windows - comment the two line above and un-comment the two lines below.
+ #CC_LDFLAGS = -lm -lwsock32
+ #CC_WINFLAG = -mwindows
+@@ -80,7 +80,7 @@ xml2300 : $(XMLOBJ)
+ $(CC) $(CFLAGS) -o $@ $(XMLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
+
+ mysql2300:
+- $(CC) $(CFLAGS) -o mysql2300 mysql2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
++ $(CC) $(CFLAGS) -o mysql2300 mysql2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG)
+
+ pgsql2300: $(PGSQLOBJ)
+ $(CC) $(CFLAGS) -o $@ $(PGSQLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/pgsql -L/usr/lib/pgsql -lpq
+@@ -95,7 +95,7 @@ minmax2300: $(MINMAXOBJ)
+ $(CC) $(CFLAGS) -o $@ $(MINMAXOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
+
+ mysqlhistlog2300 :
+- $(CC) $(CFLAGS) -o mysqlhistlog2300 mysqlhistlog2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
++ $(CC) $(CFLAGS) -o mysqlhistlog2300 mysqlhistlog2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG)
+
+
+ install:
+--
+1.8.5.3
+
diff --git a/package/open2300/open2300.mk b/package/open2300/open2300.mk
index e9f1cf5..3e718d9 100644
--- a/package/open2300/open2300.mk
+++ b/package/open2300/open2300.mk
@@ -10,14 +10,19 @@ OPEN2300_VERSION = 12
OPEN2300_BINS = open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 \
histlog2300 bin2300 xml2300 light2300 interval2300 minmax2300
+OPEN2300_CFLAGS = $(TARGET_CFLAGS)
+OPEN2300_LDFLAGS = $(TARGET_LDFLAGS)
ifeq ($(BR2_PACKAGE_MYSQL),y)
OPEN2300_DEPENDENCIES += mysql
OPEN2300_BINS += mysql2300 mysqlhistlog2300
+ OPEN2300_CFLAGS += -I$(STAGING_DIR)/usr/include/mysql
+ OPEN2300_LDFLAGS += -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient
endif
define OPEN2300_BUILD_CMDS
- $(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) $(OPEN2300_BINS)
+ CFLAGS="$(OPEN2300_CFLAGS)" CC_LDFLAGS="$(OPEN2300_LDFLAGS)" \
+ $(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) $(OPEN2300_BINS)
endef
define OPEN2300_INSTALL_TARGET_CMDS
--
1.8.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH] open2300: fix build failure
2014-02-05 21:09 [Buildroot] [PATCH] open2300: fix build failure Samuel Martin
@ 2014-02-06 9:05 ` Thomas Petazzoni
2014-02-06 20:40 ` Samuel Martin
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2014-02-06 9:05 UTC (permalink / raw)
To: buildroot
Dear Samuel Martin,
On Wed, 5 Feb 2014 22:09:22 +0100, Samuel Martin wrote:
> +- allow to extend CFLAGS and CC_LDFLAGS
[...]
> +-CFLAGS = -Wall -O3 -DVERSION=\"$(VERSION)\"
> +-CC_LDFLAGS = -lm
> +-CC_WINFLAG =
> ++CFLAGS += -Wall -O3 -DVERSION=\"$(VERSION)\"
> ++CC_LDFLAGS += -lm
> ++CC_WINFLAG =
This doesn't allow to extend CFLAGS if the CFLAGS is passed on the
right hand side of the "make" call.
I.e, with your patch, if you do:
make CFLAGS=-something
Then the CFLAGS will only contain "-something", not "-something -Wall
-O3 -DVERSION...". However, with your patch, it works if you do:
CFLAGS=-something make
In Buildroot, we indeed often do $(TARGET_CONFIGURE_OPTS) $(MAKE),
which means CFLAGS is passed on the left side of make. But this
specific package does not do this:
$(MAKE) CC=... LD=... -C $(@D)
So it doesn't pass CFLAGS, so there is no problem for now, but if it
started to pass CFLAGS on the right side of make, then your patch
wouldn't work.
Instead, if you want it to work in all cases, it should be:
override CFLAGS += -Wall -O3 ...
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH] open2300: fix build failure
2014-02-06 9:05 ` Thomas Petazzoni
@ 2014-02-06 20:40 ` Samuel Martin
0 siblings, 0 replies; 5+ messages in thread
From: Samuel Martin @ 2014-02-06 20:40 UTC (permalink / raw)
To: buildroot
Hi Thomas,
On Thu, Feb 6, 2014 at 10:05 AM, Thomas Petazzoni <
thomas.petazzoni@free-electrons.com> wrote:
> Dear Samuel Martin,
>
> On Wed, 5 Feb 2014 22:09:22 +0100, Samuel Martin wrote:
>
> > +- allow to extend CFLAGS and CC_LDFLAGS
>
> [...]
>
> > +-CFLAGS = -Wall -O3 -DVERSION=\"$(VERSION)\"
> > +-CC_LDFLAGS = -lm
> > +-CC_WINFLAG =
> > ++CFLAGS += -Wall -O3 -DVERSION=\"$(VERSION)\"
> > ++CC_LDFLAGS += -lm
> > ++CC_WINFLAG =
>
> This doesn't allow to extend CFLAGS if the CFLAGS is passed on the
> right hand side of the "make" call.
>
> I.e, with your patch, if you do:
>
> make CFLAGS=-something
>
> Then the CFLAGS will only contain "-something", not "-something -Wall
> -O3 -DVERSION...". However, with your patch, it works if you do:
>
> CFLAGS=-something make
>
> In Buildroot, we indeed often do $(TARGET_CONFIGURE_OPTS) $(MAKE),
> which means CFLAGS is passed on the left side of make. But this
> specific package does not do this:
>
> $(MAKE) CC=... LD=... -C $(@D)
>
> So it doesn't pass CFLAGS, so there is no problem for now, but if it
> started to pass CFLAGS on the right side of make, then your patch
> wouldn't work.
>
> Instead, if you want it to work in all cases, it should be:
>
> override CFLAGS += -Wall -O3 ...
>
I did know all these fine details. Thanks a lot for the explanation.
I'll fix it and repost shortly.
Regards,
--
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140206/b5009e3b/attachment.html>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH] open2300: fix build failure
@ 2014-02-06 20:49 Samuel Martin
2014-02-06 22:13 ` Peter Korsgaard
0 siblings, 1 reply; 5+ messages in thread
From: Samuel Martin @ 2014-02-06 20:49 UTC (permalink / raw)
To: buildroot
This patch fixes the open2300's build-system, which is a handwritten
Makefile, by removing the hard-coded include and library locations and
making them pointing to the systroot.
Fixes:
http://autobuild.buildroot.org/results/072/0724ffa1355f5564b1fcd9d6e3c9ff2162d20f44/build-end.log
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
package/open2300/open2300-0001-fix-makefile.patch | 52 +++++++++++++++++++++++
package/open2300/open2300.mk | 8 +++-
2 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 package/open2300/open2300-0001-fix-makefile.patch
diff --git a/package/open2300/open2300-0001-fix-makefile.patch b/package/open2300/open2300-0001-fix-makefile.patch
new file mode 100644
index 0000000..c3bb252
--- /dev/null
+++ b/package/open2300/open2300-0001-fix-makefile.patch
@@ -0,0 +1,52 @@
+From b0a1f12349bee43040a889c7e74873cfb253b9d8 Mon Sep 17 00:00:00 2001
+From: Samuel Martin <s.martin49@gmail.com>
+Date: Thu, 6 Feb 2014 21:42:50 +0100
+Subject: [PATCH] fix makefile
+
+- allow to extend CFLAGS and CC_LDFLAGS
+- remove hard-coded include dirs. and lib. dirs. (which pointed to some
+ location in the host system)
+
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+---
+ Makefile | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 92a2cc0..1b54175 100755
+--- a/Makefile
++++ b/Makefile
+@@ -37,9 +37,9 @@ MYSQLHISTLOGOBJ = mysqlhistlog2300.o rw2300.o linux2300.o win2300.o
+
+ VERSION = 1.11
+
+-CFLAGS = -Wall -O3 -DVERSION=\"$(VERSION)\"
+-CC_LDFLAGS = -lm
+-CC_WINFLAG =
++override CFLAGS += -Wall -O3 -DVERSION=\"$(VERSION)\"
++override CC_LDFLAGS += -lm
++CC_WINFLAG =
+ # For Windows - comment the two line above and un-comment the two lines below.
+ #CC_LDFLAGS = -lm -lwsock32
+ #CC_WINFLAG = -mwindows
+@@ -80,7 +80,7 @@ xml2300 : $(XMLOBJ)
+ $(CC) $(CFLAGS) -o $@ $(XMLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
+
+ mysql2300:
+- $(CC) $(CFLAGS) -o mysql2300 mysql2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
++ $(CC) $(CFLAGS) -o mysql2300 mysql2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG)
+
+ pgsql2300: $(PGSQLOBJ)
+ $(CC) $(CFLAGS) -o $@ $(PGSQLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/pgsql -L/usr/lib/pgsql -lpq
+@@ -95,7 +95,7 @@ minmax2300: $(MINMAXOBJ)
+ $(CC) $(CFLAGS) -o $@ $(MINMAXOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
+
+ mysqlhistlog2300 :
+- $(CC) $(CFLAGS) -o mysqlhistlog2300 mysqlhistlog2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
++ $(CC) $(CFLAGS) -o mysqlhistlog2300 mysqlhistlog2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG)
+
+
+ install:
+--
+1.8.5.3
+
diff --git a/package/open2300/open2300.mk b/package/open2300/open2300.mk
index e9f1cf5..a89c9a2 100644
--- a/package/open2300/open2300.mk
+++ b/package/open2300/open2300.mk
@@ -10,14 +10,20 @@ OPEN2300_VERSION = 12
OPEN2300_BINS = open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 \
histlog2300 bin2300 xml2300 light2300 interval2300 minmax2300
+OPEN2300_CFLAGS = $(TARGET_CFLAGS)
+OPEN2300_LDFLAGS = $(TARGET_LDFLAGS)
ifeq ($(BR2_PACKAGE_MYSQL),y)
OPEN2300_DEPENDENCIES += mysql
OPEN2300_BINS += mysql2300 mysqlhistlog2300
+ OPEN2300_CFLAGS += -I$(STAGING_DIR)/usr/include/mysql
+ OPEN2300_LDFLAGS += -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient
endif
define OPEN2300_BUILD_CMDS
- $(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) $(OPEN2300_BINS)
+ $(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" \
+ CFLAGS="$(OPEN2300_CFLAGS)" CC_LDFLAGS="$(OPEN2300_LDFLAGS)" \
+ -C $(@D) $(OPEN2300_BINS)
endef
define OPEN2300_INSTALL_TARGET_CMDS
--
1.8.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH] open2300: fix build failure
2014-02-06 20:49 Samuel Martin
@ 2014-02-06 22:13 ` Peter Korsgaard
0 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2014-02-06 22:13 UTC (permalink / raw)
To: buildroot
>>>>> "Samuel" == Samuel Martin <s.martin49@gmail.com> writes:
> This patch fixes the open2300's build-system, which is a handwritten
> Makefile, by removing the hard-coded include and library locations and
> making them pointing to the systroot.
> Fixes:
> http://autobuild.buildroot.org/results/072/0724ffa1355f5564b1fcd9d6e3c9ff2162d20f44/build-end.log
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Committed, thanks.
Please don't forget to mark updated patches as such (E.G. PATCHv2).
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-06 22:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-05 21:09 [Buildroot] [PATCH] open2300: fix build failure Samuel Martin
2014-02-06 9:05 ` Thomas Petazzoni
2014-02-06 20:40 ` Samuel Martin
-- strict thread matches above, loose matches on Subject: below --
2014-02-06 20:49 Samuel Martin
2014-02-06 22:13 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox