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

Cross-Compile-Friendly Build System for Native Binaries and Cross-Compiled MIPS Native Binary #59

Open
wants to merge 3 commits into
base: 2.8.0
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
11 changes: 11 additions & 0 deletions src/cpp/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
VER = 2.8
MAKEARCH = $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE)

all:
$(MAKEARCH) VER=$(VER) -C _nix_based/
mkdir -p target
cp -f _nix_based/*.so target/

clean:
rm -rf target
$(MAKE) -C _nix_based/ clean
32 changes: 32 additions & 0 deletions src/cpp/README.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# An Explanation of the Make Process for jSSC Native Binaries

The Make system is only configured to work for Linux builds at this time.

If you just need to build a native binary for the environment on which you are
building, simply run "make". The resulting .so file will be in the "target"
directory. You will need to rename the file to match the following format (arch
will be ommitted on a default build):

libjSSC-[JSSC_VERSION_NUMBER]_[ARCHITECTURE].so

Below is a list of recognized strings for the [ARCHITECTURE] field:

* "x86" or "x86_64" for i386, i686, and AMD architectures (32-bit and
64-bit, respectively).
* "armsf" or "armhf" for ARM architectures (soft-float and hard-float,
respectively).
* "mips" for MIPS architectures.

If you need to cross-compile the native binary, that can be done by specifying
an architecture and a toolchain prefix on the command line when executing make.
These can be specified with the following syntax:

make ARCH=[ARCHITECTURE] CROSS_COMPILE=[TOOLCHAIN_PREFIX]

This follows the example of Linux kernel modules. The architecture should be
one of the ones specified above. The toolchain prefix is whatever prefix your
toolchain puts before the gnu compiler commands. For example, if I want to
compile for the MIPS processor using the uclibc toolchain (for which the usual
command to launch g++ would be "mips-linux-g++"), I would specify my toolchain
prefix as "mips-linux-". This can also be specified as an absolute path, such
as "/opt/toolchains/uclibc-crosstools-gcc/usr/bin/mips-linux-".
9 changes: 9 additions & 0 deletions src/cpp/_nix_based/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CC = $(CROSS_COMPILE)g++
CFLAGS = -Wall -c -fpic

all:
$(CC) $(CFLAGS) jssc.cpp
$(CC) -shared -o libjSSC-$(VER)_$(ARCH).so jssc.o

clean:
rm -rf *.o *.so
Binary file added src/java/libs/linux/libjSSC-2.8_mips.so
Binary file not shown.