Skip to content

Commit

Permalink
fix dynamic library build
Browse files Browse the repository at this point in the history
  • Loading branch information
BadCoder1337 committed Oct 1, 2023
1 parent 5e45ad8 commit 5ed34c8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
examples
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin/*
!bin/.gitkeep

# Dissect replay files
/*.rec
Expand Down
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM golang:1.20-bullseye as builder

RUN apt-get update && apt-get install -y build-essential gcc-aarch64-linux-gnu mingw-w64
ADD . /app
WORKDIR /app

RUN chmod +x build.sh
Empty file added bin/.gitkeep
Empty file.
17 changes: 17 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
targets=(
'linux amd64 so'
'windows amd64 dll x86_64-w64-mingw32-gcc'
'linux arm64 so aarch64-linux-gnu-gcc'
)

for item in "${targets[@]}"; do
set -- $item
export GOOS=$1 GOARCH=$2 \
SUFFIX=$3 CC=$4 CGO_ENABLED=1

echo Building .$SUFFIX OS $GOOS ARCH $GOARCH CGO $CGO_ENABLED
go build \
-v -buildmode=c-shared \
-o bin/libr6dissect-$GOOS-$GOARCH.$SUFFIX \
exports/exports.go
done

0 comments on commit 5ed34c8

Please sign in to comment.