From fa5e35519eea700053ee1edb68b5b4fad6d7b83e Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Wed, 27 Mar 2019 20:04:27 +0100 Subject: [PATCH] Rewrite to avoid using cmake We can get away with a simple download script. --- .gitmodules | 3 --- CMakeLists.txt | 15 --------------- build.sh | 27 +++++++++++++++++++++++++++ cmake/Modules | 1 - 4 files changed, 27 insertions(+), 19 deletions(-) delete mode 100644 .gitmodules delete mode 100644 CMakeLists.txt create mode 100755 build.sh delete mode 160000 cmake/Modules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 05f6caf..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "cmake/Modules"] - path = cmake/Modules - url = https://github.com/measurement-kit/cmake-modules diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 8a4b615..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 3.1.0) -project(generic-assets LANGUAGES C) -list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") -include(MkUtils) -MkDownloadMMDBDatabases() -MkDownloadCABundle() -set(VERSION 20190205) -execute_process( - COMMAND ${CMAKE_COMMAND} -E tar cvzf "generic-assets-${VERSION}.tar.gz" - "README.md" "asn.mmdb" "ca-bundle.pem" "country.mmdb" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - RESULT_VARIABLE TAR_FAILURE) -if("${TAR_FAILURE}") - message(FATAL_ERROR "Cannot create generic assets archive") -endif() diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..f119b07 --- /dev/null +++ b/build.sh @@ -0,0 +1,27 @@ +#!/bin/sh +set -ex + +# autogen_get_geoip is copied from MK v0.10.0. It downloads the +# maxmind DB databases from MaxMind's site. +autogen_get_geoip() { + echo "* Fetching geoip databases" + base=https://geolite.maxmind.com/download/geoip/database + if [ ! -f "country.mmdb" ]; then + curl -fsSLO $base/GeoLite2-Country.tar.gz + tar -xf GeoLite2-Country.tar.gz + mv GeoLite2-Country_20??????/GeoLite2-Country.mmdb country.mmdb + rm -rf GeoLite2-Country_20?????? + fi + if [ ! -f "asn.mmdb" ]; then + curl -fsSLO $base/GeoLite2-ASN.tar.gz + tar -xf GeoLite2-ASN.tar.gz + mv GeoLite2-ASN_20??????/GeoLite2-ASN.mmdb asn.mmdb + rm -rf GeoLite2-ASN_20?????? + fi +} + +version=`date +%Y%m%d` +autogen_get_geoip +curl -fsSLo ca-bundle.pem https://curl.haxx.se/ca/cacert.pem +tar -cvzf "generic-assets-${version}.tar.gz" \ + "README.md" "asn.mmdb" "ca-bundle.pem" "country.mmdb" diff --git a/cmake/Modules b/cmake/Modules deleted file mode 160000 index 38755de..0000000 --- a/cmake/Modules +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 38755de8174463f72306f8f6108b4de32def0e5e