diff --git a/libs/ipfs-http-client/Makefile b/libs/ipfs-http-client/Makefile index 7cc9e8caf1..1bb0e68a84 100644 --- a/libs/ipfs-http-client/Makefile +++ b/libs/ipfs-http-client/Makefile @@ -1,11 +1,11 @@ -# +# # This is free software, licensed under the GNU General Public License v2. # include $(TOPDIR)/rules.mk PKG_NAME:=ipfs-http-client -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MAINTAINER:=Leonid Esman PKG_LICENSE:=MIT @@ -16,12 +16,15 @@ PKG_SOURCE_URL:=https://github.com/vasild/cpp-ipfs-http-client.git PKG_SOURCE_DATE:=2019-11-05 PKG_SOURCE_VERSION:=763e59ad698f3e3846f85df11e01c18ef3fbc401 PKG_MIRROR_HASH:=a2b5721faf0d43ddb4a892245ef382666149c83f3f97e558e1a6acf2402fb9fd + +PKG_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=nlohmannjson include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk define Package/ipfs-http-client/Default/description - IPFS (the InterPlanetary File System) is the Distributed Web. + IPFS (the InterPlanetary File System) is the Distributed Web. Specs, docs, sources, links: https://ipfs.io/ and https://github.com/ipfs. This is Vasil Dimov's C++ IPFS HTTP API client library. endef @@ -31,7 +34,7 @@ define Package/libipfs-http-client CATEGORY:=Libraries TITLE:=IPFS client library URL:=https://github.com/vasild/cpp-ipfs-http-client - DEPENDS:= +libcurl +libstdcpp + DEPENDS:= +libcurl +libstdcpp +libatomic endef define Package/libipfs-http-client/description @@ -52,21 +55,27 @@ define Package/ipfs-http-client-tests/description This package contains library tests. endef -define Build/InstallDev - $(INSTALL_DIR) $(1)/usr/include - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_BUILD_DIR)/include/* $(1)/usr/include - $(CP) $(PKG_BUILD_DIR)/libipfs-http-client.a $(1)/usr/lib -endef +CMAKE_OPTIONS += \ + -DBUILD_SHARED_LIBS=ON \ + -DENABLE_TESTING=ON define Package/libipfs-http-client/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_BUILD_DIR)/libipfs-http-client.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipfs-http-client.so* $(1)/usr/lib endef define Package/ipfs-http-client-tests/install $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/test/ipfs-* $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/test/block $(1)/usr/bin/ipfs-block + $(INSTALL_BIN) $(PKG_BUILD_DIR)/test/config $(1)/usr/bin/ipfs-config + $(INSTALL_BIN) $(PKG_BUILD_DIR)/test/dht $(1)/usr/bin/ipfs-dht + $(INSTALL_BIN) $(PKG_BUILD_DIR)/test/files $(1)/usr/bin/ipfs-files + $(INSTALL_BIN) $(PKG_BUILD_DIR)/test/generic $(1)/usr/bin/ipfs-generic + $(INSTALL_BIN) $(PKG_BUILD_DIR)/test/key $(1)/usr/bin/ipfs-key + $(INSTALL_BIN) $(PKG_BUILD_DIR)/test/name $(1)/usr/bin/ipfs-name + $(INSTALL_BIN) $(PKG_BUILD_DIR)/test/object $(1)/usr/bin/ipfs-object + $(INSTALL_BIN) $(PKG_BUILD_DIR)/test/pin $(1)/usr/bin/ipfs-pin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/test/swarm $(1)/usr/bin/ipfs-swarm endef $(eval $(call BuildPackage,libipfs-http-client)) diff --git a/libs/ipfs-http-client/src/Makefile b/libs/ipfs-http-client/src/Makefile deleted file mode 100644 index 03d081d006..0000000000 --- a/libs/ipfs-http-client/src/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# IPFS C++ HTTP API client library -# -VER_MAJOR:=0 -VER_MINOR:=4 -VER_PATCH:=0 -VERSION:=$(VER_MAJOR).$(VER_MINOR).$(VER_PATCH) - -HEADERS := include/ipfs/client.h include/ipfs/http/transport-curl.h include/ipfs/http/transport.h -TESTPROGS := ipfs-block ipfs-dht ipfs-files ipfs-key ipfs-object ipfs-swarm ipfs-config ipfs-generic ipfs-name ipfs-pin -CXXFLAGS := -Wall -Wpedantic -Wextra -Werror -Os -std=gnu++11 -I./include - -.PHONY: testprogs lib all clean - -all: lib testprogs test/ipfs-demo - -lib: libipfs-http-client.a libipfs-http-client.so.$(VERSION) - -libipfs-http-client.a: src/client.o src/http/transport-curl.o - $(AR) rc libipfs-http-client.a src/client.o src/http/transport-curl.o - -libipfs-http-client.so.$(VERSION): src/client.o src/http/transport-curl.o - $(CXX) $(CXXFLAGS) -shared -Wl,-soname,libipfs-http-client.so.$(VER_MAJOR) -o libipfs-http-client.so.$(VERSION) src/client.o src/http/transport-curl.o - ln -sf libipfs-http-client.so.$(VERSION) libipfs-http-client.so.$(VER_MAJOR) - ln -sf libipfs-http-client.so.$(VER_MAJOR) libipfs-http-client.so - -testprogs: $(addprefix test/,$(TESTPROGS)) - -$(addprefix test/,$(TESTPROGS)):test/ipfs-%:test/%.cc include/ipfs/client.h include/ipfs/test/utils.h libipfs-http-client.a - $(CXX) $(CXXFLAGS) $< -L. -lipfs-http-client -lcurl -o $@ - -src/client.o: src/client.cc $(HEADERS) - $(CXX) $(CXXFLAGS) -fPIC -o src/client.o -c src/client.cc - -src/http/transport-curl.o: src/http/transport-curl.cc $(HEADERS) include/ipfs/test/utils.h - $(CXX) $(CXXFLAGS) -fPIC -o src/http/transport-curl.o -c src/http/transport-curl.cc - -test/ipfs-demo: test/demo.cpp - $(CXX) -std=c++11 -I./include -L. test/demo.cpp -lipfs-http-client -lcurl -o test/ipfs-demo -# $(CXX) -std=c++11 -I./include -L. -Wl,-rpath,. test/demo.cpp -lipfs-http-client -lcurl -o test/ipfs-demo -# $(CXX) -std=c++11 -I./include test/demo.cpp ./libipfs-http-client.a -lcurl -o test/ipfs-demo - -clean: - $(RM) src/client.o src/http/transport-curl.o libipfs-http-client.a libipfs-http-client.so* $(addprefix test/,$(TESTPROGS)) test/ipfs-demo - - diff --git a/libs/ipfs-http-client/src/test/demo.cpp b/libs/ipfs-http-client/src/test/demo.cpp deleted file mode 100644 index 1733c57fc7..0000000000 --- a/libs/ipfs-http-client/src/test/demo.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// g++ -std=c++11 -I./include test1.cpp libipfs-http-client.a -lcurl -o ipfs-test -// g++ -std=c++11 -I./include test1.cpp -lipfs-http-client -lcurl -o ipfs-test -// g++ -std=c++11 -I./include -L. -Wl,-rpath,. test1.cpp -lipfs-http-client -lcurl -o ipfs-test - -#include -#include -#include - -int main(int argc, char** argv) -{ - std::stringstream contents; - char addr127001[]="127.0.0.1"; - char *addr; - if (argc<2) - addr=addr127001; - else - addr=argv[1]; - ipfs::Client client(addr, 5001); - client.FilesGet("/ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme", &contents); - std::cout << contents.str() << std::endl; - return 0; -} -