Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grand master split #6

Open
wants to merge 20 commits into
base: proto-x86
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 0 additions & 144 deletions proto-x86/Dockerfile

This file was deleted.

2 changes: 0 additions & 2 deletions proto-x86/build_qtumx86

This file was deleted.

35 changes: 35 additions & 0 deletions proto-x86/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM qtum-alpine-bin as build
LABEL maintainers "earlz, VoR0220"

FROM alpine

#
# Copy the binaries from the build to our new container
#
COPY --from=build /usr/local/bin/qtumd /usr/local/bin
COPY --from=build /usr/local/bin/qtum-cli /usr/local/bin
#
# Install all dependencies
#
RUN apk update && apk add boost boost-filesystem \
boost-program_options \
boost-system boost-thread \
boost-random busybox db-c++ \
libevent libgcc libressl2.7-libcrypto \
libstdc++ musl

#
# Copy the qtum.conf file from
# the build context into the container
#
COPY qtum.conf /qtum.conf

# create data directory
ENV QTUM_DATA /data
RUN mkdir $QTUM_DATA \
&& ln -sfn $QTUM_DATA /.qtum
VOLUME /data

EXPOSE 3888 3889 13888 13889
ENV PATH=${PATH}:/usr/local/bin:
CMD ["qtumd", "-regtest", "-logevents", "-printtoconsole"]
2 changes: 2 additions & 0 deletions proto-x86/client/Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM alpine-dev
RUN set -ex && git clone https://github.com/qtumproject/qtum-x86.git --recursive && cd qtum-x86 && git checkout qtum-x86
19 changes: 19 additions & 0 deletions proto-x86/client/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM alpine:3.9.4
LABEL maintainers "earlz, VoR0220"

RUN apk update && apk add git \
make \
cmake \
file \
autoconf \
automake \
build-base \
libtool \
db-c++ \
db-dev \
boost-system \
boost-program_options \
boost-filesystem \
boost-dev \
libressl-dev \
libevent-dev
12 changes: 12 additions & 0 deletions proto-x86/client/Dockerfile.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM qtum-alpine-build
RUN (cd qtum-x86 && ./autogen.sh && \
./configure \
--disable-bench --disable-static \
--without-gui --disable-zmq \
--with-incompatible-bdb \
CFLAGS='-w' CXXFLAGS='-w' && \
make -j 4 && \
strip src/qtumd && \
strip src/qtum-cli && \
strip src/qtum-tx && \
make install && make check && make clean && make distclean)
4 changes: 4 additions & 0 deletions proto-x86/client/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
docker build -f Dockerfile.dev -t alpine-dev .
docker build -f Dockerfile.build -t qtum-alpine-build .
docker build --no-cache -f Dockerfile.install -t qtum-alpine-bin .
docker build -f Dockerfile -t qtum-alpine .
7 changes: 7 additions & 0 deletions proto-x86/client/qtum.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
regtest=1
server=1
rpcbind=127.0.0.1:3888
rpcuser=user
rpcpassword=password
rpcallowip=0.0.0.0/0
rpcport=3888
18 changes: 9 additions & 9 deletions proto-x86/helpers.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
function qx86start() {
docker run --rm -v "${PWD}:/root/bind" --name qx86 -d qtumx86 qtum/src/qtumd -regtest -logevents
docker run --rm -v "${PWD}:/root/bind" --name qx86 -d qtum-alpine qtumd -regtest -logevents -printtoconsole
}
export -f qx86start

Expand All @@ -9,20 +9,20 @@ function qx86stop() {
}
export -f qx86stop

alias qx86cli='docker exec qx86 qcli'
alias qx86cli='docker exec qx86 qtum-cli -regtest'

function qx86deploy() {
docker exec -t qx86 deploy_contract `cat $1`
docker exec -t qx86 qtum-cli -regtest createcontract `cat $1`
}
export -f qx86deploy

function qx86tb() {
docker run --rm -v "${PWD}:/root/bind" qtumx86 x86tb
}
export -f qx86tb

function qx86make() {
docker run --rm -v "${PWD}:/root/bind" qtumx86 qmake "$@"
docker run --rm -v "${PWD}:/root/bind" -w "/root/bind" qtumtoolchain-alpine make
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ""$@"" is needed so that qx86make clean for example works

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VoR0220 Hi, once this is resolved, I am able to merge the PR.

}
export -f qx86make

function qx86simpleabi() {
docker run --rm -it -v "${PWD}:/root/bind" -w /root/bind qtum-simpleabi -a "$1" -d -e
}

export -f qx86simpleabi
7 changes: 7 additions & 0 deletions proto-x86/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
cd client
./build.sh
cd ../toolchain
./build.sh
cd ../simpleabi
docker build -t qtum-simpleabi .
11 changes: 11 additions & 0 deletions proto-x86/simpleabi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.7.3

RUN go get -u -v -d github.com/qtumproject/simple-abi && \
cd /go/src/github.com/qtumproject/simple-abi && \
CGO_ENABLED=0 GOOS=linux go build -o simple-abi .

FROM alpine:3.9.4
LABEL maintainers "earlz, VoR0220"

COPY --from=0 /go/src/github.com/qtumproject/simple-abi/simple-abi /usr/local/bin
ENTRYPOINT [ "simple-abi" ]
28 changes: 28 additions & 0 deletions proto-x86/test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# files to be built
# fill this in as a template
HDRS =
C_SRC = helloworld.c
OUTPUT = helloworld.elf
LIBS =
BYTECODE = helloworld.qbit

C_OBJS = $(subst .c,.o,$(C_SRC))

#these default flags will just remove dead code and give warnings
CFLAGS += -Wall -ffunction-sections -fdata-sections
LDFLAGS += -Wl,--gc-section


default: $(BYTECODE)

$(BYTECODE): $(OUTPUT)
qx86-codeify -elf $(OUTPUT) -hex -o $(BYTECODE)

$(OUTPUT): $(C_OBJS)
$(CC) $(LDFLAGS) -o $(OUTPUT) $(C_OBJS) $(LIBS)

$(C_OBJS): $(HDRS) $(C_SRC)
$(CC) $(CFLAGS) -c $*.c -o $@

clean:
rm -f $(C_OBJS) $(OUTPUT) $(BYTECODE)
13 changes: 13 additions & 0 deletions proto-x86/test/helloworld.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <qtum.h>

int onCreate()
{
qtumEventStringString("Hello World", "Contract creation");
return 0;
}

int main()
{
qtumEventStringString("Hello World", "Execution Success!");
return 0;
}
Loading