Skip to content

Commit

Permalink
Merge pull request #96 from simelo/stdevHan_t95_correct_openapi
Browse files Browse the repository at this point in the history
Fixes #95 Fixes #75 Repairing libcurl compilation for 0.26.0 ARM
  • Loading branch information
olemis authored Jul 10, 2019
2 parents 429be79 + 11d9589 commit e65e197
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 29 deletions.
19 changes: 12 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <[email protected]>
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 <[email protected]>
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

Expand Down
12 changes: 12 additions & 0 deletions ci-scripts/deploy-arm.sh
Original file line number Diff line number Diff line change
@@ -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
8 changes: 6 additions & 2 deletions ci-scripts/docker_install_debian.sh
Original file line number Diff line number Diff line change
@@ -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
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
6 changes: 5 additions & 1 deletion ci-scripts/docker_install_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 6 additions & 6 deletions docker/images/deploy-arm/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
Expand All @@ -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" ]
2 changes: 1 addition & 1 deletion docker/images/test-arm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
13 changes: 7 additions & 6 deletions lib/cgo/tests/testutils/libsky_assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion lib/curl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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 "")
Expand Down
2 changes: 1 addition & 1 deletion lib/curl/install_lib_curl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/swig/dynamic/mem.i
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down
7 changes: 6 additions & 1 deletion lib/swig/dynamic/typemaps.i
Original file line number Diff line number Diff line change
@@ -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 ) );
}

/*
Expand Down

0 comments on commit e65e197

Please sign in to comment.