diff --git a/backend/dynarmic/src/main/native/dynarmic/Dockerfile b/backend/dynarmic/src/main/native/dynarmic/Dockerfile new file mode 100644 index 000000000..2720fdb90 --- /dev/null +++ b/backend/dynarmic/src/main/native/dynarmic/Dockerfile @@ -0,0 +1,25 @@ +FROM openjdk:8 + +RUN apt-get update + +RUN apt-get install -y cmake g++ gcc clang + +RUN apt-get install -y libboost-all-dev + +RUN apt-get clean + +RUN mkdir -p /git + +# You should mount a volumn +# docker build -t cmake . +# docker run -it -v ~/github/:/git cmake /bin/sh + +# Or copy the source code to the container +# COPY ../unidbg /git +# COPY ../dynarmic /git + +# Then you can copy so file to outside of container +# docker cp :/git/unidbg/backend/dynarmic/src/main/resources/natives/linux_64 ~/Downloads/ + +WORKDIR /git/unidbg/backend/dynarmic/src/main/native/ +ENTRYPOINT [ "/git/unidbg/backend/dynarmic/src/main/native/linux_build.sh" ] diff --git a/backend/dynarmic/src/main/native/dynarmic/linux_build.sh b/backend/dynarmic/src/main/native/dynarmic/linux_build.sh index 25a475ed8..0a3bf2a87 100755 --- a/backend/dynarmic/src/main/native/dynarmic/linux_build.sh +++ b/backend/dynarmic/src/main/native/dynarmic/linux_build.sh @@ -1,9 +1,24 @@ JAVA_INC="$JAVA_HOME"/include JAVA_PLATFORM_INC="$(dirname "$(find "$JAVA_INC" -name jni_md.h)")" -c++ -m64 -o libdynarmic.so -shared -fPIC -std=c++17 -O2 \ - -I ~/git/dynarmic/include -I ~/git/dynarmic/externals/fmt/include dynarmic.cpp arm_dynarmic_cp15.cpp \ - -I "$JAVA_INC" -I "$JAVA_PLATFORM_INC" \ - ~/git/dynarmic/build/src/libdynarmic.a \ - ~/git/dynarmic/build/externals/fmt/libfmt.a && \ - mv libdynarmic.so ../../resources/natives/linux_64/ +# Docker path +DYNARMIC_HOME=/git/dynarmic +UNIDBG_HOME=/git/unidbg + +# compile dynarmic +cd $DYNARMIC_HOME && mkdir -p build +cd build +cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON .. +make + +cd $UNIDBG_HOME/backend/dynarmic/src/main/native + +c++ -m64 -o libdynarmic.so -shared -fPIC -std=c++17 -O2 \ + -I $DYNARMIC_HOME/src -I $DYNARMIC_HOME/externals/fmt/include dynarmic.cpp arm_dynarmic_cp15.cpp \ + -I "$JAVA_INC" -I "$JAVA_PLATFORM_INC" -DDYNARMIC_MASTER \ + $DYNARMIC_HOME/build/src/dynarmic/libdynarmic.a \ + $DYNARMIC_HOME/build/externals/zydis/libZydis.a \ + $DYNARMIC_HOME/build/externals/mcl/src/libmcl.a \ + $DYNARMIC_HOME/build/externals/fmt/libfmt.a && \ + +mv libdynarmic.so ../../resources/natives/linux_64/ diff --git a/backend/dynarmic/src/main/native/dynarmic/osx_build_master.sh b/backend/dynarmic/src/main/native/dynarmic/osx_build_master.sh index ff44a9e6c..2cb9d8015 100755 --- a/backend/dynarmic/src/main/native/dynarmic/osx_build_master.sh +++ b/backend/dynarmic/src/main/native/dynarmic/osx_build_master.sh @@ -10,4 +10,4 @@ DYNARMIC_HOME=~/Downloads/dynarmic $DYNARMIC_HOME/build/src/dynarmic/libdynarmic.a \ $DYNARMIC_HOME/build/externals/zydis/libZydis.a \ $DYNARMIC_HOME/build/externals/fmt/libfmt.a && \ - mv libdynarmic.dylib ../../resources/natives/osx_64/ + mv libdynarmic.dylib ../../resources/natives/osx_64/ \ No newline at end of file diff --git a/backend/dynarmic/src/main/resources/natives/linux_64/libdynarmic.so b/backend/dynarmic/src/main/resources/natives/linux_64/libdynarmic.so index 56ff6204c..3f9b843c2 100755 Binary files a/backend/dynarmic/src/main/resources/natives/linux_64/libdynarmic.so and b/backend/dynarmic/src/main/resources/natives/linux_64/libdynarmic.so differ