Skip to content

Commit

Permalink
travis deps
Browse files Browse the repository at this point in the history
  • Loading branch information
lunixbochs committed Jun 11, 2016
1 parent 3047838 commit c252943
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
18 changes: 3 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
language: go
language: c
sudo: true
dist: trusty
cache: ccache

before_install:
- date
- mkdir /tmp/build && pushd /tmp/build
- git clone https://github.com/aquynh/capstone.git
- cd capstone && git pull && make -j2 && sudo make install && cd ..
- git clone https://github.com/unicorn-engine/unicorn.git
- cd unicorn && git pull
- sed -e 's/@cd samples && $(MAKE)$//g' -i. Makefile
- make -j2 && sudo make install && cd ..
- git clone https://github.com/keystone-engine/keystone.git
- cd keystone && mkdir build && cd build && ../make-share.sh
- cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DLLVM_TARGETS_TO_BUILD="all" -G "Unix Makefiles" ..
- sudo make install && cd ../..
- sudo ldconfig
- popd
- git checkout -b tmp && (git branch -d master || true) && git branch master
- make deps
- make get

script: 'make test'
Expand Down
27 changes: 13 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ deps/lib/libunicorn.1.$(LIBEXT):
cd deps/build && \
git clone https://github.com/unicorn-engine/unicorn.git && git --git-dir unicorn fetch; \
cd unicorn && git clean -fdx && git reset --hard origin/master && \
sed -e '/samples/d' -i. Makefile && \
sed -e "/samples/d" -i. Makefile && \
make -j2 PREFIX=$(DEST) install

deps/lib/libcapstone.3.$(LIBEXT):
cd deps/build && \
git clone https://github.com/aquynh/capstone.git && git --git-dir capstone pull; \
cd capstone && git clean -fdx && git reset --hard origin/master && \
sed -e '/cd tests/d' -i. Makefile && \
sed -e "/cd tests/d" -i. Makefile && \
make -j2 PREFIX=$(DEST) install

deps/lib/libkeystone.0.$(LIBEXT):
Expand All @@ -81,12 +81,11 @@ deps: deps/lib/libunicorn.1.$(LIBEXT) deps/lib/libcapstone.3.$(LIBEXT) deps/lib/
mkdir -p .gopath/src/github.com/lunixbochs
ln -s ../../../.. .gopath/src/github.com/lunixbochs/usercorn

GO_LDF := -ldflags '-extldflags "-Wl,-rpath=$$ORIGIN/deps/lib:$$ORIGIN/lib"'
GO_LDF := -ldflags '-extldflags -Wl,-rpath=$$ORIGIN/deps/lib:$$ORIGIN/lib'
GOBUILD := go build -i $(GO_LDF)
export CGO_CFLAGS = -I$(DEST)/include
export CGO_LDFLAGS = -L$(DEST)/lib
PATH := "$(DEST)/$(GODIR)/bin:$(PATH)"
SHELL := env PATH=$(PATH) /bin/bash
PATHX := "$(DEST)/$(GODIR)/bin:$(PATH)"

ifneq ($(wildcard $(DEST)/$(GODIR)/.),)
export GOROOT := $(DEST)/$(GODIR)
Expand All @@ -96,28 +95,28 @@ ifneq ($(GOPATH),)
else
export GOPATH := $(DEST)/gopath:$(shell pwd)/.gopath
endif
DEPS=$(shell env GOROOT=$(GOROOT) GOPATH=$(GOPATH) go list -f '{{join .Deps "\n"}}' ./go/... | grep -v usercorn | grep '\.' | sort -u)
DEPS=$(shell env PATH=$(PATHX) GOROOT=$(GOROOT) GOPATH=$(GOPATH) go list -f '{{join .Deps "\n"}}' ./go/... | grep -v usercorn | grep '\.' | sort -u)

usercorn: .gopath
$(GOBUILD) -o usercorn ./go/cmd/usercorn
sh -c "PATH=$(PATHX) $(GOBUILD) -o usercorn ./go/cmd/usercorn"
$(FIXRPATH) usercorn

imgtrace: .gopath
$(GOBUILD) -o imgtrace ./go/cmd/imgtrace
sh -c "PATH=$(PATHX) $(GOBUILD) -o imgtrace ./go/cmd/imgtrace"
$(FIXRPATH) imgtrace

shellcode: .gopath
$(GOBUILD) -o shellcode ./go/cmd/shellcode
sh -c "PATH=$(PATHX) $(GOBUILD) -o shellcode ./go/cmd/shellcode"
$(FIXRPATH) shellcode

repl: .gopath
$(GOBUILD) -o repl ./go/cmd/repl
sh -c "PATH=$(PATHX) $(GOBUILD) -o repl ./go/cmd/repl"
$(FIXRPATH) repl

get:
go get $(GO_LDF) -u ${DEPS}
get: .gopath
sh -c "PATH=$(PATHX) go get $(GO_LDF) -u ${DEPS}"

test:
go test -ldflags '-extldflags -Wl,-rpath=$(DEST)/lib' -v ./go/...
test: .gopath
sh -c "PATH=$(PATHX) go test -ldflags '-extldflags -Wl,-rpath=$(DEST)/lib' -v ./go/..."

all: usercorn imgtrace shellcode repl

0 comments on commit c252943

Please sign in to comment.