From bbf366b61e78c72c7b01c0cf0e003501cc1d323d Mon Sep 17 00:00:00 2001
From: Andrea Manzi <amanzi@cern.ch>
Date: Wed, 3 Jul 2019 14:18:01 +0200
Subject: [PATCH 01/10] use libcurl-openssl

---
 packaging/rpm/fts.spec | 2 +-
 src/cli/CMakeLists.txt | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/packaging/rpm/fts.spec b/packaging/rpm/fts.spec
index 2420f0274..05409b171 100644
--- a/packaging/rpm/fts.spec
+++ b/packaging/rpm/fts.spec
@@ -50,7 +50,7 @@ BuildRequires:  gfal2-devel >= 2.14.2
 BuildRequires:  glib2-devel
 BuildRequires:  globus-gsi-credential-devel
 BuildRequires:  gridsite-devel
-BuildRequires:  libcurl-devel
+BuildRequires:  libcurl-openssl-devel
 BuildRequires:  openldap-devel
 BuildRequires:  protobuf-devel
 BuildRequires:  pugixml-devel
diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt
index 852af3b14..7d6bea047 100644
--- a/src/cli/CMakeLists.txt
+++ b/src/cli/CMakeLists.txt
@@ -33,6 +33,8 @@ find_package(Boost COMPONENTS program_options unit_test_framework REQUIRED)
 # Require soap headers
 include_directories ("${CMAKE_BINARY_DIR}/src/ws-ifce/gsoap")
 
+set(CURL_LIBRARY /opt/shibboleth/lib64/libcurl.so.4 CACHE filepath "path to libcurl.so.4")
+
 # add a target to generate API documentation with Doxygen
 find_package(Doxygen)
 if(DOXYGEN_FOUND)
@@ -53,7 +55,7 @@ set (fts_cli_internal_libs
 set(fts_cli_libs
     ${fts_cli_internal_libs}
     gridsite
-    curl
+    ${CURL_LIBRARY}
 	globus_gsi_sysconfig
     ${Boost_PROGRAM_OPTIONS_LIBRARY}
 )
-- 
GitLab


From 8043932c3f1784df3b28c60add166b7c0ded7198 Mon Sep 17 00:00:00 2001
From: Andrea Manzi <amanzi@cern.ch>
Date: Wed, 3 Jul 2019 15:14:46 +0200
Subject: [PATCH 02/10] add include path

---
 src/cli/CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt
index 7d6bea047..d9142caaf 100644
--- a/src/cli/CMakeLists.txt
+++ b/src/cli/CMakeLists.txt
@@ -33,6 +33,9 @@ find_package(Boost COMPONENTS program_options unit_test_framework REQUIRED)
 # Require soap headers
 include_directories ("${CMAKE_BINARY_DIR}/src/ws-ifce/gsoap")
 
+
+#trying curl with openssl
+include_directories("/opt/shibboleth/include")
 set(CURL_LIBRARY /opt/shibboleth/lib64/libcurl.so.4 CACHE filepath "path to libcurl.so.4")
 
 # add a target to generate API documentation with Doxygen
-- 
GitLab


From 4694020be6b86c6d637f28b0a6dbcc78cfb55c0e Mon Sep 17 00:00:00 2001
From: Andrea Manzi <amanzi@cern.ch>
Date: Wed, 3 Jul 2019 15:27:32 +0200
Subject: [PATCH 03/10] fix include path

---
 src/cli/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt
index d9142caaf..a2794031b 100644
--- a/src/cli/CMakeLists.txt
+++ b/src/cli/CMakeLists.txt
@@ -35,7 +35,7 @@ include_directories ("${CMAKE_BINARY_DIR}/src/ws-ifce/gsoap")
 
 
 #trying curl with openssl
-include_directories("/opt/shibboleth/include")
+include_directories("/opt/shibboleth/include/curl")
 set(CURL_LIBRARY /opt/shibboleth/lib64/libcurl.so.4 CACHE filepath "path to libcurl.so.4")
 
 # add a target to generate API documentation with Doxygen
-- 
GitLab


From f8bb67bbdf1cf2a245c6a4bbed808c13627cb1a3 Mon Sep 17 00:00:00 2001
From: Andrea Manzi <amanzi@cern.ch>
Date: Wed, 3 Jul 2019 16:01:51 +0200
Subject: [PATCH 04/10] full path to alternative curl include

---
 src/cli/rest/HttpRequest.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cli/rest/HttpRequest.h b/src/cli/rest/HttpRequest.h
index 55876837e..d341ecb58 100644
--- a/src/cli/rest/HttpRequest.h
+++ b/src/cli/rest/HttpRequest.h
@@ -22,7 +22,7 @@
 #define HTTPGET_H_
 
 #include <stdio.h>
-#include <curl/curl.h>
+#include "/opt/shibboleth/include/curl/curl.h"
 
 #include <string>
 #include <sstream>
-- 
GitLab


From bc956dd00eabe76a7005a26e20d5be4fda1a8966 Mon Sep 17 00:00:00 2001
From: Andrea <andrea.manzi@gmail.com>
Date: Wed, 3 Jul 2019 16:21:54 +0200
Subject: [PATCH 05/10] add requires

---
 packaging/rpm/fts.spec | 1 +
 1 file changed, 1 insertion(+)

diff --git a/packaging/rpm/fts.spec b/packaging/rpm/fts.spec
index 05409b171..eb5a18cc6 100644
--- a/packaging/rpm/fts.spec
+++ b/packaging/rpm/fts.spec
@@ -161,6 +161,7 @@ FTS messaging integration
 Summary:    File Transfer Service version 3 client
 Group:      Applications/Internet
 Requires:   fts-libs%{?_isa} = %{version}-%{release}
+Requires:   libcurl-openssl
 
 %description client
 A set of command line tools for submitting, querying
-- 
GitLab


From ef5282dff70cac7a75ecbd7431a73e3c93d5670e Mon Sep 17 00:00:00 2001
From: andrea-manzi <andrea.manzi@gmail.com>
Date: Thu, 18 Jul 2019 17:57:48 +0200
Subject: [PATCH 06/10] FTS-1453: statically link curl

---
 src/cli/CMakeLists.txt     | 18 ++++++++++++++----
 src/cli/rest/HttpRequest.h |  2 +-
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt
index a2794031b..9ea17ca29 100644
--- a/src/cli/CMakeLists.txt
+++ b/src/cli/CMakeLists.txt
@@ -34,9 +34,19 @@ find_package(Boost COMPONENTS program_options unit_test_framework REQUIRED)
 include_directories ("${CMAKE_BINARY_DIR}/src/ws-ifce/gsoap")
 
 
-#trying curl with openssl
-include_directories("/opt/shibboleth/include/curl")
-set(CURL_LIBRARY /opt/shibboleth/lib64/libcurl.so.4 CACHE filepath "path to libcurl.so.4")
+# Include directories for our newer version of curl
+set(CURL_DIR /tmp/curl/bogusinstall)
+set(CURL_LIBRARIES ${CURL_DIR}/lib${LIB_SUFFIX}/ws2_32 ${CURL_DIR}/lib${LIB_SUFFIX}/iphlpapi ${CURL_DIR}/lib${LIB_SUFFIX}/libcurl)
+set(CURL_INCLUDE_DIR ${CURL_DIR}/include/)
+set(CURL_LIBRARY ${CURL_DIR}/lib${LIB_SUFFIX}/libcurl.a CACHE filepath "path to libcurl.a")
+find_file(Curl_local libcurl.a PATHS ${CURL_DIR}/lib${LIB_SUFFIX}/ )
+if (NOT Curl_local)
+  message("-- LibCurl not found in '${CURL_LIBRARY}'")
+endif()
+
+add_definitions(-DCURL_STATICLIB)
+
+include_directories(${CURL_INCLUDE_DIR})
 
 # add a target to generate API documentation with Doxygen
 find_package(Doxygen)
@@ -59,7 +69,7 @@ set(fts_cli_libs
     ${fts_cli_internal_libs}
     gridsite
     ${CURL_LIBRARY}
-	globus_gsi_sysconfig
+    globus_gsi_sysconfig
     ${Boost_PROGRAM_OPTIONS_LIBRARY}
 )
 
diff --git a/src/cli/rest/HttpRequest.h b/src/cli/rest/HttpRequest.h
index d341ecb58..55876837e 100644
--- a/src/cli/rest/HttpRequest.h
+++ b/src/cli/rest/HttpRequest.h
@@ -22,7 +22,7 @@
 #define HTTPGET_H_
 
 #include <stdio.h>
-#include "/opt/shibboleth/include/curl/curl.h"
+#include <curl/curl.h>
 
 #include <string>
 #include <sstream>
-- 
GitLab


From 1afc427abc07afd521be71600aca8e04c0c30bb0 Mon Sep 17 00:00:00 2001
From: andrea-manzi <andrea.manzi@gmail.com>
Date: Thu, 18 Jul 2019 18:00:15 +0200
Subject: [PATCH 07/10] add buildcurl.sh script

---
 src/cli/buildcurl.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100755 src/cli/buildcurl.sh

diff --git a/src/cli/buildcurl.sh b/src/cli/buildcurl.sh
new file mode 100755
index 000000000..fe50cb75c
--- /dev/null
+++ b/src/cli/buildcurl.sh
@@ -0,0 +1,12 @@
+# This script assumes that:
+# - pwd is the top source directory
+
+
+mkdir -p  ./src/cli/external
+cd ./src/cli/external
+wget https://curl.haxx.se/download/curl-7.65.2.tar.gz
+tar zxvf curl-7.65.2.tar.gz
+mv curl-7.65.2 curl
+cd curl
+cmake3 . -DCMAKE_INSTALL_PREFIX=/tmp/curl/bogusinstall -DBUILD_CURL_EXE=false -DBUILD_TESTING=false -DBUILD_SHARED_LIBS=false  -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_C_FLAGS=-fPIC -DCURL_DISABLE_LDAP=ON
+make -j2 install
-- 
GitLab


From 6fa303a4ed2eba7eb6934f968d55b38c29ba0324 Mon Sep 17 00:00:00 2001
From: andrea-manzi <andrea.manzi@gmail.com>
Date: Fri, 19 Jul 2019 09:56:10 +0200
Subject: [PATCH 08/10] FTS-1453: build curl in rpm

---
 CMakeLists.txt         | 2 +-
 packaging/rpm/fts.spec | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d8baeec06..bb61b4dd9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,7 +29,7 @@ set(CMAKE_MODULE_PATH
 
 set(VERSION_MAJOR 3)
 set(VERSION_MINOR 9)
-set(VERSION_PATCH 1)
+set(VERSION_PATCH 2)
 set(VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
 
 # Generate include header with the version string
diff --git a/packaging/rpm/fts.spec b/packaging/rpm/fts.spec
index eb5a18cc6..3ac8c2132 100644
--- a/packaging/rpm/fts.spec
+++ b/packaging/rpm/fts.spec
@@ -9,8 +9,8 @@
 %endif
 
 Name:       fts
-Version:    3.9.1
-Release:    2%{?dist}
+Version:    3.9.2
+Release:    1%{?dist}
 Summary:    File Transfer Service V3
 Group:      System Environment/Daemons
 License:    ASL 2.0
@@ -39,6 +39,7 @@ BuildRequires:  CGSI-gSOAP-devel
 BuildRequires:  cajun-jsonapi-devel
 
 BuildRequires:  cmake
+BuildRequires:  cmake3
 BuildRequires:  libdirq-devel
 BuildRequires:  doxygen
 %if 0%{?el5}
@@ -50,7 +51,6 @@ BuildRequires:  gfal2-devel >= 2.14.2
 BuildRequires:  glib2-devel
 BuildRequires:  globus-gsi-credential-devel
 BuildRequires:  gridsite-devel
-BuildRequires:  libcurl-openssl-devel
 BuildRequires:  openldap-devel
 BuildRequires:  protobuf-devel
 BuildRequires:  pugixml-devel
@@ -161,7 +161,6 @@ FTS messaging integration
 Summary:    File Transfer Service version 3 client
 Group:      Applications/Internet
 Requires:   fts-libs%{?_isa} = %{version}-%{release}
-Requires:   libcurl-openssl
 
 %description client
 A set of command line tools for submitting, querying
@@ -199,6 +198,8 @@ The File Transfer Service V3 mysql plug-in
 %setup -q
 
 %build
+#build curl
+./src/cli/buildcurl.sh
 # Make sure the version in the spec file and the version used
 # for building matches
 fts_cmake_ver=`sed -n 's/^set(VERSION_\(MAJOR\|MINOR\|PATCH\) \([0-9]\+\).*/\2/p' CMakeLists.txt | paste -sd '.'`
-- 
GitLab


From ee81dd3904635213a21df1d5d1518bb9f68b7fc8 Mon Sep 17 00:00:00 2001
From: andrea-manzi <andrea.manzi@gmail.com>
Date: Fri, 19 Jul 2019 10:05:12 +0200
Subject: [PATCH 09/10] add wget as build dep

---
 packaging/rpm/fts.spec | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packaging/rpm/fts.spec b/packaging/rpm/fts.spec
index 3ac8c2132..0876ccff6 100644
--- a/packaging/rpm/fts.spec
+++ b/packaging/rpm/fts.spec
@@ -37,7 +37,7 @@ BuildRequires:  boost148-devel
 
 BuildRequires:  CGSI-gSOAP-devel
 BuildRequires:  cajun-jsonapi-devel
-
+BuildRequires:  wget
 BuildRequires:  cmake
 BuildRequires:  cmake3
 BuildRequires:  libdirq-devel
-- 
GitLab


From 25bae2363c71cf64f4bb3dcd1c613839eb09c253 Mon Sep 17 00:00:00 2001
From: andrea-manzi <andrea.manzi@gmail.com>
Date: Fri, 19 Jul 2019 11:00:55 +0200
Subject: [PATCH 10/10] fix build also for tests

---
 CMakeLists.txt         | 12 ++++++++++++
 src/cli/CMakeLists.txt | 11 -----------
 test/CMakeLists.txt    |  2 +-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bb61b4dd9..1492d63bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -95,6 +95,18 @@ endif ()
 find_package(Threads)
 find_package(OpenSSL)
 
+
+# Include directories for our newer version of curl
+set(CURL_DIR /tmp/curl/bogusinstall)
+set(CURL_LIBRARIES ${CURL_DIR}/lib${LIB_SUFFIX}/ws2_32 ${CURL_DIR}/lib${LIB_SUFFIX}/iphlpapi ${CURL_DIR}/lib${LIB_SUFFIX}/libcurl)
+set(CURL_INCLUDE_DIR ${CURL_DIR}/include/)
+set(CURL_LIBRARY ${CURL_DIR}/lib${LIB_SUFFIX}/libcurl.a CACHE filepath "path to libcurl.a")
+find_file(Curl_local libcurl.a PATHS ${CURL_DIR}/lib${LIB_SUFFIX}/ )
+if (NOT Curl_local)
+  message("-- LibCurl not found in '${CURL_LIBRARY}'")
+endif()
+
+
 # Find Boost
 set(Boost_ADDITIONAL_VERSIONS
     "1.41" "1.41.0" "1.42" "1.42.0" "1.43" "1.43.0" "1.44" "1.44.0" "1.45" "1.45.0"
diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt
index 9ea17ca29..1e8b7d212 100644
--- a/src/cli/CMakeLists.txt
+++ b/src/cli/CMakeLists.txt
@@ -33,17 +33,6 @@ find_package(Boost COMPONENTS program_options unit_test_framework REQUIRED)
 # Require soap headers
 include_directories ("${CMAKE_BINARY_DIR}/src/ws-ifce/gsoap")
 
-
-# Include directories for our newer version of curl
-set(CURL_DIR /tmp/curl/bogusinstall)
-set(CURL_LIBRARIES ${CURL_DIR}/lib${LIB_SUFFIX}/ws2_32 ${CURL_DIR}/lib${LIB_SUFFIX}/iphlpapi ${CURL_DIR}/lib${LIB_SUFFIX}/libcurl)
-set(CURL_INCLUDE_DIR ${CURL_DIR}/include/)
-set(CURL_LIBRARY ${CURL_DIR}/lib${LIB_SUFFIX}/libcurl.a CACHE filepath "path to libcurl.a")
-find_file(Curl_local libcurl.a PATHS ${CURL_DIR}/lib${LIB_SUFFIX}/ )
-if (NOT Curl_local)
-  message("-- LibCurl not found in '${CURL_LIBRARY}'")
-endif()
-
 add_definitions(-DCURL_STATICLIB)
 
 include_directories(${CURL_INCLUDE_DIR})
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 73f115c63..b95c027dc 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -23,6 +23,6 @@ include_directories (${Boost_INCLUDE_DIRS})
 include_directories (${GLIB2_INCLUDE_DIRS})
 include_directories (${CMAKE_SOURCE_DIR}/src)
 include_directories (${CMAKE_BINARY_DIR}/src)
-
+include_directories (${CURL_INCLUDE_DIR})
 # Tests
 add_subdirectory (unit)
-- 
GitLab