diff --git a/.circleci/config.yml b/.circleci/config.yml index 44db59e69..31c3c7dab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: orangepi-plus2: docker: - - image: docker:18.06.0-ce-git + - image: circleci/golang:1.12 working_directory: $GOPATH/src/github.com/skycoin/libskycoin environment: QEMU_PLATFORM: orangepi-plus2 @@ -12,11 +12,12 @@ jobs: - checkout - setup_remote_docker: version: 18.06.0-ce + docker_layer_caching: true - run: docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS=debian --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/test-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-test raspberrypi3: docker: - - image: docker:18.06.0-ce-git + - image: circleci/golang:1.12 working_directory: $GOPATH/src/github.com/skycoin/libskycoin environment: QEMU_PLATFORM: raspberrypi3 @@ -26,11 +27,12 @@ jobs: - checkout - setup_remote_docker: version: 18.06.0-ce + docker_layer_caching: true - run: docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS=debian --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/test-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-test raspberrypi2: docker: - - image: docker:18.06.0-ce-git + - image: circleci/golang:1.12 working_directory: $GOPATH/src/github.com/skycoin/libskycoin environment: QEMU_PLATFORM: raspberry-pi2 @@ -40,11 +42,12 @@ jobs: - checkout - setup_remote_docker: version: 18.06.0-ce + docker_layer_caching: true - run: docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS=debian --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/test-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-test bananapi_m1_plus: docker: - - image: docker:18.06.0-ce-git + - image: circleci/golang:1.12 working_directory: $GOPATH/src/github.com/skycoin/libskycoin environment: QEMU_PLATFORM: bananapi-m1-plus @@ -54,18 +57,20 @@ jobs: - checkout - setup_remote_docker: version: 18.06.0-ce + docker_layer_caching: true - run: docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS=debian --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/test-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-test publish-github-release_32: docker: - - image: docker:18.06.0-ce-git + - image: circleci/golang:1.12 + working_directory: $GOPATH/src/github.com/skycoin/libskycoin steps: - run: mkdir -p $GOPATH/src/github.com/ $GOPATH/src/github.com/skycoin - checkout - setup_remote_docker: version: 18.06.0-ce - - run: if [[ $CIRCLE_TAG ]]; then docker build --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg QEMU_PLATFORM=raspberrypi3 --build-arg VERSION --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/deploy-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-deploy ; fi - + docker_layer_caching: true + - run: cd $GOPATH/src/github.com/skycoin/libskycoin/ci-scripts && bash deploy-arm.sh workflows: version: 2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 177ae866d..5f2a662d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added +- Be able to set a build type for lib curl. - Export functions in Skycoin 0.25.1 core API's - `skyapi` C client for Skycoin node REST at `lib/curl`. - Support for building `libskycoin` on ARM and 32 / 64 bits. diff --git a/Makefile b/Makefile index f0b29c2fe..9b27a45a7 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ BUILDLIB_DIR = $(BUILD_DIR)/libskycoin BUILDLIBSKYAPI_DIR = $(BUILD_DIR)/libskyapi LIBNAME_Linux = libskyapi.so LIBNAME_Darwin = libskyapi.dylib +LIBNAME_Static = libskyapiStatic.a LIB_DIR = lib BIN_DIR = bin DOC_DIR = docs @@ -103,6 +104,7 @@ build-skyapi: ## Build skyapi(libcurl based) library (cd lib/curl && bash ./install_lib_curl.sh) mkdir -p ./build/libskyapi cp lib/curl/build/$(LIBNAME_$(UNAME_S)) ./build/libskyapi + cp lib/curl/build/$(LIBNAME_Static) ./build/libskyapi build: build-libc build-skyapi ## Build libraries diff --git a/README.md b/README.md index cbef32f16..d60d95103 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ $ make test-libc 0. Make a PR merging the release branch into `master` 0. Review the PR and merge it 0. Tag the `master` branch with the version number. Version tags start with `v`, e.g. `v0.20.0`. Sign the tag. If you have your GPG key in github, creating a release on the Github website will automatically tag the release. It can be tagged from the command line with `git tag -as v0.20.0 $COMMIT_ID`, but Github will not recognize it as a "release". -0. Release builds are created and uploaded by travis. To do it manually, checkout the master branch and follow the [create release builds instructions](#creating-release-builds). +0. Release builds are created and uploaded by travis. To do it manually, checkout the master branch and make release. 0. Merge changes in `master` back into `develop` branch to start working towards next stable version. #### Pre-release testing @@ -98,6 +98,43 @@ Perform these actions before releasing: ```sh make check ``` +#### Release signing + +Releases are signed with this PGP key: + +`0x5801631BD27C7874` + +The fingerprint for this key is: + +``` +pub ed25519 2017-09-01 [SC] [expires: 2023-03-18] + 10A7 22B7 6F2F FE7B D238 0222 5801 631B D27C 7874 +uid GZ-C SKYCOIN +sub cv25519 2017-09-01 [E] [expires: 2023-03-18] +``` + +Keybase.io account: https://keybase.io/gzc + +##### Alternative signing keys: + +Keybase.io account: https://keybase.io/olemis + +The fingerprint for this key is: + +``` +pub rsa4096 2019-01-17 [SC] [expires: 2024-01-16] +uid Olemis Lang +sub rsa4096 2019-01-17 [E] [expires: 2024-01-16] +``` + +Follow the [Tor Project's instructions for verifying signatures](https://www.torproject.org/docs/verifying-signatures.html.en). + +If you can't or don't want to import the keys from a keyserver, the signing key is available in the repo: [gz-c.asc](gz-c.asc). + +Releases and their signatures can be found on the [releases page](https://github.com/skycoin/skycoin/releases). + +Instructions for generating a PGP key, publishing it, signing the tags and binaries: +https://gist.github.com/gz-c/de3f9c43343b2f1a27c640fe529b067c ## Development diff --git a/ci-scripts/deploy-arm.sh b/ci-scripts/deploy-arm.sh new file mode 100644 index 000000000..40d9e74a3 --- /dev/null +++ b/ci-scripts/deploy-arm.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -x + +git --version + +export VERSION="$(git describe --tags --exact-match HEAD)" + +if [[ "$VERSION" ]]; then + docker build --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg QEMU_PLATFORM=armv7hf --build-arg VERSION --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/deploy-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-deploy + docker build --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg QEMU_PLATFORM=aarch64 --build-arg VERSION --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/deploy-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-deploy +fi \ No newline at end of file diff --git a/ci-scripts/docker_install_debian.sh b/ci-scripts/docker_install_debian.sh index 5d0a3d8d1..36ac99972 100644 --- a/ci-scripts/docker_install_debian.sh +++ b/ci-scripts/docker_install_debian.sh @@ -1,8 +1,12 @@ #!/usr/bin/env bash apt-get update -apt-get install gcc-6 g++-6 curl wget -y +apt-get install gcc-6 g++-6 wget cmake libcurl3-gnutls -y wget -c https://github.com/libcheck/check/releases/download/0.12.0/check-0.12.0.tar.gz tar -xzf check-0.12.0.tar.gz -cd check-0.12.0 && ./configure --prefix=/usr --disable-static && make && sudo make install \ No newline at end of file +cd check-0.12.0 && ./configure --prefix=/usr --disable-static && make && sudo make install + +wget -c http://curl.haxx.se/download/curl-7.58.0.tar.gz +tar -xvf curl-7.58.0.tar.gz +cd curl-7.58.0/ && make && sudo make install \ No newline at end of file diff --git a/ci-scripts/docker_install_ubuntu.sh b/ci-scripts/docker_install_ubuntu.sh index 5d0a3d8d1..7cb7dcc59 100644 --- a/ci-scripts/docker_install_ubuntu.sh +++ b/ci-scripts/docker_install_ubuntu.sh @@ -1,7 +1,11 @@ #!/usr/bin/env bash apt-get update -apt-get install gcc-6 g++-6 curl wget -y +apt-get install gcc-6 g++-6 curl wget cmake libcurl3-gnutls -y + +sudo apt-get remove curl -y +(cd deps && wget http://curl.haxx.se/download/curl-7.58.0.tar.gz && tar -xvf curl-7.58.0.tar.gz && cd curl-7.58.0/ && ./configure && make && sudo make install) +(cd deps && git clone https://github.com/uncrustify/uncrustify.git && cd uncrustify && mkdir build && cd build && cmake .. && make && sudo make install) wget -c https://github.com/libcheck/check/releases/download/0.12.0/check-0.12.0.tar.gz tar -xzf check-0.12.0.tar.gz diff --git a/docker/images/deploy-arm/Dockerfile b/docker/images/deploy-arm/Dockerfile index 3c446de9c..6efa7580e 100644 --- a/docker/images/deploy-arm/Dockerfile +++ b/docker/images/deploy-arm/Dockerfile @@ -1,10 +1,11 @@ ARG QEMU_PLATFORM FROM balenalib/${QEMU_PLATFORM}-debian-golang - +ARG QEMU_PLATFORM ARG GITHUB_OAUTH_TOKEN ARG PROJECT_USERNAME ARG PROJECT_REPONAME ARG SHA1 +ARG VERSION ADD . $GOPATH/src/github.com/skycoin/libskycoin/ RUN [ "cross-build-start" ] @@ -15,12 +16,11 @@ RUN make -C $GOPATH/src/github.com/skycoin/libskycoin dep RUN go get github.com/gz-c/gox RUN go get -t ./... ENV CGO_ENABLED=1 -RUN export VERSION="$(git describe --tags --exact-match HEAD 2> /dev/null)" -RUN export ARCH="$(uname -m)" -RUN export OS="$(uname -s)" +ENV ARCH=${QEMU_PLATFORM} +ENV OS="Linux" RUN make -C $GOPATH/src/github.com/skycoin/libskycoin build -RUN tar -c -z -f libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz -C $GOPATH/src/github.com/skycoin/libskycoin/build $GOPATH/src/github.com/skycoin/libskycoin/build/* +RUN tar -czf libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz -C $GOPATH/src/github.com/skycoin/libskycoin/build $GOPATH/src/github.com/skycoin/libskycoin/build/* RUN go get github.com/tcnksm/ghr RUN ghr -t ${GITHUB_OAUTH_TOKEN} -u ${PROJECT_USERNAME} -r ${PROJECT_REPONAME} -c ${SHA1} -delete ${VERSION} libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz -RUN [ "cross-build-end" ] +RUN [ "cross-build-end" ] \ No newline at end of file diff --git a/docker/images/test-arm/Dockerfile b/docker/images/test-arm/Dockerfile index d9bfa0690..804a63730 100644 --- a/docker/images/test-arm/Dockerfile +++ b/docker/images/test-arm/Dockerfile @@ -21,4 +21,4 @@ RUN make -C $GOPATH/src/github.com/skycoin/libskycoin test-libc RUN [ "cross-build-end" ] WORKDIR $GOPATH/src/github.com/skycoin -VOLUME $GOPATH/src/ +VOLUME $GOPATH/src/ \ No newline at end of file diff --git a/lib/cgo/tests/testutils/libsky_assert.c b/lib/cgo/tests/testutils/libsky_assert.c index ca1e146aa..d36e20283 100644 --- a/lib/cgo/tests/testutils/libsky_assert.c +++ b/lib/cgo/tests/testutils/libsky_assert.c @@ -63,13 +63,14 @@ GoInt_ isSigEq(cipher__Sig *sig1, cipher__Sig *sig2) { return memcmp((void *)sig1, (void *)sig2, sizeof(cipher__Sig)) == 0; } -GoInt_ isU8Eq(unsigned char p1[], unsigned char p2[], size_t len) { - - if (strncmp(p1, p2, len) == 0) { - +GoInt_ isU8Eq(unsigned char p1[], unsigned char p2[], size_t len) +{ + for (GoInt i = 0; i < len; i++) { + if (p1[i] != p2[i]) { + return 0; + } + } return 1; - } - return 0; } GoInt_ isSHA256Eq(cipher__SHA256 *sh1, cipher__SHA256 *sh2) { diff --git a/lib/curl/CMakeLists.txt b/lib/curl/CMakeLists.txt index ad3766d19..6f4dfd59f 100644 --- a/lib/curl/CMakeLists.txt +++ b/lib/curl/CMakeLists.txt @@ -6,7 +6,7 @@ project(CGenerator) #set(CMAKE_C_VISIBILITY_PRESET default) #set(CMAKE_CXX_VISIBILITY_PRESET default) #set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF) -set(CMAKE_BUILD_TYPE Debug) +set(CMAKE_BUILD_TYPE Release) set(pkgName "skyapi") @@ -116,11 +116,14 @@ set(HDRS include_directories(${CURL_INCLUDE_DIR}) # Add library with project file with projectname as library name add_library(${pkgName} SHARED ${SRCS} ${HDRS}) +add_library(${pkgName}Static STATIC ${SRCS} ${HDRS}) # Link dependent libraries target_link_libraries(${pkgName} ${CURL_LIBRARIES}) #install library to destination install(TARGETS ${pkgName} DESTINATION ${CMAKE_INSTALL_PREFIX}) +unset(CMAKE_BUILD_TYPE CACHE) + # Setting file variables to null #set(SRCS "") #set(HDRS "") diff --git a/lib/curl/install_lib_curl.sh b/lib/curl/install_lib_curl.sh index 6842eb5b7..fff2965f9 100755 --- a/lib/curl/install_lib_curl.sh +++ b/lib/curl/install_lib_curl.sh @@ -7,7 +7,7 @@ cd build #echo "brew ls --verbose curl" #brew ls --verbose curl # for normal install use following command -cmake -DCMAKE_VERBOSE_MAKEFILE=ON .. +cmake -DCMAKE_BUILD_TYPE=Release .. grep -R object_convertToJSON ../../ make sudo make install diff --git a/lib/swig/dynamic/mem.i b/lib/swig/dynamic/mem.i index 382cee1f8..03c68d100 100644 --- a/lib/swig/dynamic/mem.i +++ b/lib/swig/dynamic/mem.i @@ -11,12 +11,12 @@ /* Handle out typemap. */ %typemap(argout) Handle* { - %append_output( SWIG_From_long(*$1) ); + %append_output( SWIG_From_long_SS_long(*$1) ); } /* Handle not as pointer is input. */ %typemap(in) Handle { - SWIG_AsVal_long($input, (long*)&$1); + SWIG_AsVal_long_SS_long($input, (long*)&$1); } diff --git a/lib/swig/dynamic/typemaps.i b/lib/swig/dynamic/typemaps.i index 998c30226..3334228e9 100644 --- a/lib/swig/dynamic/typemaps.i +++ b/lib/swig/dynamic/typemaps.i @@ -1,6 +1,11 @@ /*GoInt64* as function return typemap*/ %typemap(argout) GoInt64* { - %append_output( SWIG_From_long( *$1 ) ); + %append_output( SWIG_From_long_SS_long( *$1 ) ); +} + +/*GoUint64* as function return typemap*/ +%typemap(argout) GoUint64* { + %append_output( SWIG_From_unsigned_SS_long_SS_long( *$1 ) ); } /*