Sorry, with the patches this time.

Willy
>From 806aebcba5b7c5e3b780c63ff37a54b38a510e19 Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w...@1wt.eu>
Date: Fri, 19 Apr 2019 16:12:08 +0200
Subject: [PATCH 07/13] WIP: wurfl: pass -fPIC when compiling

---
 contrib/wurfl/makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/contrib/wurfl/makefile b/contrib/wurfl/makefile
index 56ee0f8cc..6822c94df 100644
--- a/contrib/wurfl/makefile
+++ b/contrib/wurfl/makefile
@@ -10,6 +10,9 @@ build: dummy-wurfl.o
        rm -rf libwurfl.so ; ln -s libwurfl.so.0.1.10 libwurfl.so
        rm -rf libwurfl.so.0 ; ln -s libwurfl.so.0.1.10 libwurfl.so.0
 
+dummy-wurfl.o: dummy-wurfl.c
+       $(CC) -fPIC -fvisibility=hidden -c dummy-wurfl.c
+
 install:
        make build
        mkdir -p /usr/include/wurfl; cp wurfl.h /usr/include/wurfl
-- 
2.20.1

>From 66d858a7ff657f4244e55d834628c5410b87c525 Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w...@1wt.eu>
Date: Fri, 19 Apr 2019 16:12:40 +0200
Subject: [PATCH 08/13] WIP: wurfl: fix broken symlinks

.so.10 -> .so.100
---
 contrib/wurfl/makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/wurfl/makefile b/contrib/wurfl/makefile
index 6822c94df..0feb85e9f 100644
--- a/contrib/wurfl/makefile
+++ b/contrib/wurfl/makefile
@@ -7,8 +7,8 @@
 build: dummy-wurfl.o
        $(CC) -fPIC -fvisibility=hidden -Wl,-Bsymbolic -Wl,--exclude-libs 
-Wl,ALL -shared -Wl,-soname \
        -Wl,libwurfl.so.0 -o libwurfl.so.0.1.100 dummy-wurfl.o
-       rm -rf libwurfl.so ; ln -s libwurfl.so.0.1.10 libwurfl.so
-       rm -rf libwurfl.so.0 ; ln -s libwurfl.so.0.1.10 libwurfl.so.0
+       rm -rf libwurfl.so ; ln -s libwurfl.so.0.1.100 libwurfl.so
+       rm -rf libwurfl.so.0 ; ln -s libwurfl.so.0.1.100 libwurfl.so.0
 
 dummy-wurfl.o: dummy-wurfl.c
        $(CC) -fPIC -fvisibility=hidden -c dummy-wurfl.c
-- 
2.20.1

>From 5aeb30470222877d7c705b731c6d8b46d3a171b9 Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w...@1wt.eu>
Date: Fri, 19 Apr 2019 16:17:54 +0200
Subject: [PATCH 09/13] WIP: wurfl: address build issues by doing a static lib
 instead of a shared one

Here the symbols were not resolved, plus it's really not going to work to
have to install the dummy library on a developers' machine nor in an automatic
build environment. Instead let's just create libwurfl.a made from the single
.o file. The resulting binary will not depend on anything fancy this way.
---
 contrib/wurfl/makefile | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/contrib/wurfl/makefile b/contrib/wurfl/makefile
index 0feb85e9f..df08288ba 100644
--- a/contrib/wurfl/makefile
+++ b/contrib/wurfl/makefile
@@ -4,21 +4,10 @@
 #
 # install needs to be run as root
 
-build: dummy-wurfl.o
-       $(CC) -fPIC -fvisibility=hidden -Wl,-Bsymbolic -Wl,--exclude-libs 
-Wl,ALL -shared -Wl,-soname \
-       -Wl,libwurfl.so.0 -o libwurfl.so.0.1.100 dummy-wurfl.o
-       rm -rf libwurfl.so ; ln -s libwurfl.so.0.1.100 libwurfl.so
-       rm -rf libwurfl.so.0 ; ln -s libwurfl.so.0.1.100 libwurfl.so.0
+build: libwurfl.a
 
-dummy-wurfl.o: dummy-wurfl.c
-       $(CC) -fPIC -fvisibility=hidden -c dummy-wurfl.c
-
-install:
-       make build
-       mkdir -p /usr/include/wurfl; cp wurfl.h /usr/include/wurfl
-       cp libwurfl.so.0.1.100 /usr/lib
-       rm -rf /usr/lib/libwurfl.so ; ln -s /usr/lib/libwurfl.so.0.1.100 
/usr/lib/libwurfl.so
-       rm -rf /usr/lib/libwurfl.so.0 ; ln -s /usr/lib/libwurfl.so.0.1.100 
/usr/lib/libwurfl.so.0
+libwurfl.a: dummy-wurfl.o
+       ar rv $@ $<
 
 clean:
-       rm -rf *.so* *.o
+       rm -rf *.a *.o
-- 
2.20.1

>From f93f60bc04c847599bd57637f09df10bc9de54ff Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w...@1wt.eu>
Date: Fri, 19 Apr 2019 16:28:53 +0200
Subject: [PATCH 10/13] WIP: wurfl: indicate in haproxy -vv the wurfl version
 in use and whether it's dummy or not

We have this output now :

$ ./haproxy  -vv |grep -i wurfl
Built with WURFL support (dummy library version 1.11.2.100)
---
 src/wurfl.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/wurfl.c b/src/wurfl.c
index 118e58448..325cba649 100644
--- a/src/wurfl.c
+++ b/src/wurfl.c
@@ -702,6 +702,17 @@ static const char *ha_wurfl_retrieve_header(const char 
*header_name, const void
        return ((ha_wurfl_header_t *)wh)->header_value;
 }
 
+static void ha_wurfl_register_build_options()
+{
+       const char *ver = wurfl_get_api_version();
+       char *ptr = NULL;
+
+       memprintf(&ptr, "Built with WURFL support (%sversion %s)",
+                 strcmp(ver, "1.11.2.100") ? "" : "dummy library ",
+                 ver);
+       hap_register_build_opts(ptr, 1);
+}
+
 REGISTER_POST_CHECK(ha_wurfl_init);
 REGISTER_POST_DEINIT(ha_wurfl_deinit);
-REGISTER_BUILD_OPTS("Built with WURFL support.");
+INITCALL0(STG_REGISTER, ha_wurfl_register_build_options);
-- 
2.20.1

>From 340ffa7d0b166ddde75dd864c28cc7513f0ab6ac Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w...@1wt.eu>
Date: Fri, 19 Apr 2019 16:30:29 +0200
Subject: [PATCH 11/13] WIP: wurfl: move wurfl.h into wurfl/ to maintain
 directory hierarchy

This way wurfl/wurfl.h is always found there.
---
 contrib/wurfl/dummy-wurfl.c       | 2 +-
 contrib/wurfl/{ => wurfl}/wurfl.h | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename contrib/wurfl/{ => wurfl}/wurfl.h (100%)

diff --git a/contrib/wurfl/dummy-wurfl.c b/contrib/wurfl/dummy-wurfl.c
index 8c14569e7..c87d9b95b 100644
--- a/contrib/wurfl/dummy-wurfl.c
+++ b/contrib/wurfl/dummy-wurfl.c
@@ -11,7 +11,7 @@
  *
  */
 
-#include "wurfl.h"
+#include "wurfl/wurfl.h"
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-parameter"
diff --git a/contrib/wurfl/wurfl.h b/contrib/wurfl/wurfl/wurfl.h
similarity index 100%
rename from contrib/wurfl/wurfl.h
rename to contrib/wurfl/wurfl/wurfl.h
-- 
2.20.1

>From ed01733aa81f522b07a6b4aa59ca3ef11c8b5fc9 Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w...@1wt.eu>
Date: Fri, 19 Apr 2019 16:37:34 +0200
Subject: [PATCH 12/13] WIP: wurfl: mention how to build the dummy lib in the
 wurfl doc

This way developers will be able to build it by default.
---
 doc/WURFL-device-detection.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/doc/WURFL-device-detection.txt b/doc/WURFL-device-detection.txt
index 0d61db0a0..41afb17ff 100644
--- a/doc/WURFL-device-detection.txt
+++ b/doc/WURFL-device-detection.txt
@@ -17,6 +17,16 @@ Compile haproxy as shown :
 
 Optionally WURFL_DEBUG=1 may be set to increase logs verbosity
 
+For HAProxy developers who need to verify that their changes didn't accidently
+break the WURFL code, it is possible to build a dummy library provided in the
+contrib/wurfl directory and to use it as an alternative for the full library.
+This will not provide the full functionalities, it will just allow haproxy to
+start with a wurfl configuration, which generally is enough to validate API
+changes :
+
+    $ make -C contrib/wurfl
+    $ make TARGET=<target> USE_WURFL=1 WURFL_INC=$PWD/contrib/wurfl 
WURFL_LIB=$PWD/contrib/wurfl
+
 These are the supported WURFL directives (see doc/configuration.txt) :
 - wurfl-data-file <path to WURFL data file>
 - wurfl-information-list [<string>] (list of WURFL capabilities,
-- 
2.20.1

>From d0058a8479bde1e58d7255b9f5be8f7e969a6cca Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w...@1wt.eu>
Date: Fri, 19 Apr 2019 16:41:52 +0200
Subject: [PATCH 13/13] WIP: wurfl: rename makefile to Makefile

I already got fed up with completion not working when looking for it.
---
 contrib/wurfl/{makefile => Makefile} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename contrib/wurfl/{makefile => Makefile} (100%)

diff --git a/contrib/wurfl/makefile b/contrib/wurfl/Makefile
similarity index 100%
rename from contrib/wurfl/makefile
rename to contrib/wurfl/Makefile
-- 
2.20.1

Reply via email to