Improve native build system
This commit is contained in:
parent
823896317c
commit
d84386f208
3
src/main/c/build/README.md
Normal file
3
src/main/c/build/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
To cross-compile on Linux:
|
||||
|
||||
arm: gcc-arm-linux-gnueabi
|
||||
64
src/main/c/build/common.sh
Normal file
64
src/main/c/build/common.sh
Normal file
@ -0,0 +1,64 @@
|
||||
cd "$(dirname $0)"
|
||||
SRCDIR="$(pwd)/.."
|
||||
TMPDIR="$SRCDIR/tmp"
|
||||
DOWNLOADS="$SRCDIR/downloads"
|
||||
LIBUSBX_VERSION="1.0.14"
|
||||
LIBUSBX_ARCHIVE="libusbx-$LIBUSBX_VERSION.tar.bz2"
|
||||
LIBUSBX_FILE="$DOWNLOADS/$LIBUSBX_ARCHIVE"
|
||||
LIBUSBX_URL="http://downloads.sf.net/project/libusbx/releases/$LIBUSBX_VERSION/source/$LIBUSBX_ARCHIVE"
|
||||
|
||||
build()
|
||||
{
|
||||
DISTDIR="$SRCDIR/../resources/de/ailis/usb4java/libusb/$OS-$ARCH"
|
||||
|
||||
# Clean up
|
||||
rm -rf "$TMPDIR"
|
||||
rm -rf "$DISTDIR"
|
||||
|
||||
# Download libusbx if necessary
|
||||
mkdir -p "$DOWNLOADS"
|
||||
if [ ! -e "$LIBUSBX_FILE" ]
|
||||
then
|
||||
wget -O "$LIBUSBX_FILE" "$LIBUSBX_URL"
|
||||
fi
|
||||
|
||||
# Unpack and compile libusbx
|
||||
mkdir -p "$TMPDIR"
|
||||
cd "$TMPDIR"
|
||||
tar xfj "$DOWNLOADS/$LIBUSBX_ARCHIVE"
|
||||
cd "libusbx-$LIBUSBX_VERSION"
|
||||
CFLAGS="$CFLAGS $LIBUSBX_CFLAGS" \
|
||||
./configure --prefix="$TMPDIR" --host="$HOST" --with-pic $LIBUSBX_CONFIG
|
||||
make
|
||||
make install-strip
|
||||
|
||||
# Build autoconf stuff of usb4java if needed
|
||||
cd "$SRCDIR"
|
||||
if [ ! -e configure ]
|
||||
then
|
||||
make -f Makefile.scm
|
||||
fi
|
||||
|
||||
# Build libusb4java
|
||||
PKG_CONFIG_PATH="$TMPDIR/lib/pkgconfig" \
|
||||
LIBS="$USB4JAVA_LIBS" \
|
||||
CFLAGS="$CFLAGS $USB4JAVA_CFLAGS" \
|
||||
./configure --prefix=/ --host="$HOST" $USB4JAVA_CONFIG
|
||||
make clean install-strip DESTDIR="$TMPDIR"
|
||||
|
||||
# Copy dist files to java resources directory
|
||||
mkdir -p "$DISTDIR"
|
||||
cp -faL 2>/dev/null \
|
||||
"$TMPDIR/lib/libusb4java.so" \
|
||||
"$TMPDIR/bin/libusb-1.0.dll" \
|
||||
"$DISTDIR" || true
|
||||
cp -faL 2>/dev/null \
|
||||
"$TMPDIR/bin/libusb4java-1.dll" \
|
||||
"$DISTDIR/libusb4java.dll" || true
|
||||
|
||||
# Remove executable flag from dist files
|
||||
chmod -x "$DISTDIR/"*
|
||||
|
||||
# Cleanup
|
||||
rm -rf "$TMPDIR"
|
||||
}
|
||||
@ -1,31 +1,15 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Builds libusb4java for 32 bit arm. libusb-dev must be installed.
|
||||
# This script is meant to be run directly on a linux-arm machine
|
||||
# (Like the Raspberry)
|
||||
# Builds libusb4java for 32 bit ARM linux (Raspberry Pi)
|
||||
|
||||
set -e
|
||||
cd $(dirname $0)/..
|
||||
|
||||
OS=linux
|
||||
ARCH=arm
|
||||
TMPDIR=$(pwd)/tmp
|
||||
DISTDIR=$(pwd)/../resources/de/ailis/usb4java/jni/${OS}-${ARCH}
|
||||
. $(dirname $0)/common.sh
|
||||
|
||||
# Clean up
|
||||
rm -rf $TMPDIR
|
||||
rm -rf $DISTDIR
|
||||
OS="linux"
|
||||
ARCH="arm"
|
||||
HOST="$ARCH-$OS-gnueabi"
|
||||
LIBUSBX_CONFIG="--disable-shared"
|
||||
USB4JAVA_LIBS="-lrt"
|
||||
|
||||
# Build autoconf stuff if needed
|
||||
if [ ! -e configure ]
|
||||
then
|
||||
make -f Makefile.scm
|
||||
fi
|
||||
|
||||
# Build libusb4java
|
||||
./configure --prefix=/
|
||||
make clean install-strip DESTDIR=$TMPDIR
|
||||
mkdir -p $DISTDIR
|
||||
cp -faL $TMPDIR/lib/libusb4java.so $DISTDIR/
|
||||
chmod -x $DISTDIR/libusb4java.so
|
||||
rm -rf $TMPDIR
|
||||
build
|
||||
|
||||
@ -1,51 +1,16 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Builds libusb4java for 32 bit linux on a linux host.
|
||||
# Builds libusb4java for 32 bit x86 linux
|
||||
|
||||
set -e
|
||||
cd "$(dirname $0)/.."
|
||||
|
||||
. $(dirname $0)/common.sh
|
||||
|
||||
OS="linux"
|
||||
ARCH="x86"
|
||||
LIBUSBX_VERSION="1.0.14"
|
||||
LIBUSBX_ARCHIVE="libusbx-$LIBUSBX_VERSION.tar.bz2"
|
||||
TMPDIR="$(pwd)/tmp"
|
||||
DOWNLOADS="$(pwd)/downloads"
|
||||
DISTDIR="$(pwd)/../resources/de/ailis/usb4java/libusb/${OS}-${ARCH}"
|
||||
HOST="$ARCH-$OS-gnu"
|
||||
CFLAGS="-m32"
|
||||
LIBUSBX_CONFIG="--disable-shared"
|
||||
USB4JAVA_LIBS="-lrt"
|
||||
|
||||
# Clean up
|
||||
rm -rf "$TMPDIR"
|
||||
rm -rf "$DISTDIR"
|
||||
|
||||
# Download libusbx if necessary
|
||||
mkdir -p "$DOWNLOADS"
|
||||
if [ ! -e "$DOWNLOADS/$LIBUSBX_ARCHIVE" ]
|
||||
then
|
||||
wget -O "$DOWNLOADS/$LIBUSBX_ARCHIVE" "http://downloads.sourceforge.net/project/libusbx/releases/$LIBUSBX_VERSION/source/$LIBUSBX_ARCHIVE"
|
||||
fi
|
||||
|
||||
# Unpack and compile libusbx
|
||||
mkdir -p "$TMPDIR"
|
||||
cd "$TMPDIR"
|
||||
tar xfj "$DOWNLOADS/$LIBUSBX_ARCHIVE"
|
||||
cd "libusbx-$LIBUSBX_VERSION"
|
||||
CFLAGS="-m32" ./configure "--prefix=$TMPDIR" --disable-shared --with-pic
|
||||
make
|
||||
make install
|
||||
|
||||
# Build autoconf stuff of usb4java if needed
|
||||
cd "$TMPDIR/.."
|
||||
if [ ! -e configure ]
|
||||
then
|
||||
make -f Makefile.scm
|
||||
fi
|
||||
|
||||
# Build libusb4java
|
||||
PKG_CONFIG_PATH="$TMPDIR/lib/pkgconfig" CFLAGS="-m32" ./configure --prefix=/
|
||||
make clean install-strip DESTDIR="$TMPDIR"
|
||||
mkdir -p "$DISTDIR"
|
||||
cp -faL "$TMPDIR/lib/libusb4java.so" "$DISTDIR/"
|
||||
chmod -x "$DISTDIR/libusb4java.so"
|
||||
|
||||
# Cleanup
|
||||
rm -rf "$TMPDIR"
|
||||
build
|
||||
|
||||
@ -1,51 +1,16 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Builds libusb4java for 64 bit linux on a 64 bit linux host.
|
||||
# Builds libusb4java for 64 bit x86 linux
|
||||
|
||||
set -e
|
||||
cd "$(dirname $0)/.."
|
||||
|
||||
. $(dirname $0)/common.sh
|
||||
|
||||
OS="linux"
|
||||
ARCH="x86_64"
|
||||
LIBUSBX_VERSION="1.0.14"
|
||||
LIBUSBX_ARCHIVE="libusbx-$LIBUSBX_VERSION.tar.bz2"
|
||||
TMPDIR="$(pwd)/tmp"
|
||||
DOWNLOADS="$(pwd)/downloads"
|
||||
DISTDIR="$(pwd)/../resources/de/ailis/usb4java/libusb/${OS}-${ARCH}"
|
||||
HOST="$ARCH-$OS-gnu"
|
||||
CFLAGS="-m64"
|
||||
LIBUSBX_CONFIG="--disable-shared"
|
||||
USB4JAVA_LIBS="-lrt"
|
||||
|
||||
# Clean up
|
||||
rm -rf "$TMPDIR"
|
||||
rm -rf "$DISTDIR"
|
||||
|
||||
# Download libusbx if necessary
|
||||
mkdir -p "$DOWNLOADS"
|
||||
if [ ! -e "$DOWNLOADS/$LIBUSBX_ARCHIVE" ]
|
||||
then
|
||||
wget -O "$DOWNLOADS/$LIBUSBX_ARCHIVE" "http://downloads.sourceforge.net/project/libusbx/releases/$LIBUSBX_VERSION/source/$LIBUSBX_ARCHIVE"
|
||||
fi
|
||||
|
||||
# Unpack and compile libusbx
|
||||
mkdir -p "$TMPDIR"
|
||||
cd "$TMPDIR"
|
||||
tar xfj "$DOWNLOADS/$LIBUSBX_ARCHIVE"
|
||||
cd "libusbx-$LIBUSBX_VERSION"
|
||||
./configure "--prefix=$TMPDIR" --disable-shared --with-pic
|
||||
make
|
||||
make install
|
||||
|
||||
# Build autoconf stuff of usb4java if needed
|
||||
cd "$TMPDIR/.."
|
||||
if [ ! -e configure ]
|
||||
then
|
||||
make -f Makefile.scm
|
||||
fi
|
||||
|
||||
# Build libusb4java
|
||||
PKG_CONFIG_PATH="$TMPDIR/lib/pkgconfig" ./configure --prefix=/
|
||||
make clean install-strip DESTDIR="$TMPDIR"
|
||||
mkdir -p "$DISTDIR"
|
||||
cp -faL "$TMPDIR/lib/libusb4java.so" "$DISTDIR/"
|
||||
chmod -x "$DISTDIR/libusb4java.so"
|
||||
|
||||
# Cleanup
|
||||
rm -rf "$TMPDIR"
|
||||
build
|
||||
|
||||
@ -1,60 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Compile libusb4java for 32 bit windows with mingw on Windows
|
||||
# or cross-compile it with mingw on Linux.
|
||||
#
|
||||
# For cross-compiling on Linux mingw-w64-dev must be installed.
|
||||
|
||||
set -e
|
||||
cd $(dirname $0)/..
|
||||
|
||||
OS="windows"
|
||||
ARCH="x86"
|
||||
LIBUSBX_VERSION="1.0.14"
|
||||
LIBUSBX_ARCHIVE="libusbx-$LIBUSBX_VERSION.tar.bz2"
|
||||
TMPDIR="$(pwd)/tmp"
|
||||
DOWNLOADS="$(pwd)/downloads"
|
||||
DISTDIR="$(pwd)/../resources/de/ailis/usb4java/libusb/${OS}-${ARCH}"
|
||||
|
||||
# Clean up
|
||||
rm -rf "$TMPDIR"
|
||||
rm -rf "$DISTDIR"
|
||||
|
||||
# Download libusbx if necessary
|
||||
mkdir -p "$DOWNLOADS"
|
||||
if [ ! -e "$DOWNLOADS/$LIBUSBX_ARCHIVE" ]
|
||||
then
|
||||
wget -O "$DOWNLOADS/$LIBUSBX_ARCHIVE" "http://downloads.sourceforge.net/project/libusbx/releases/$LIBUSBX_VERSION/source/$LIBUSBX_ARCHIVE"
|
||||
fi
|
||||
|
||||
# Unpack and compile libusbx
|
||||
mkdir -p "$TMPDIR"
|
||||
cd "$TMPDIR"
|
||||
tar xfj "$DOWNLOADS/$LIBUSBX_ARCHIVE"
|
||||
cd "libusbx-$LIBUSBX_VERSION"
|
||||
CFLAGS=-m32 ./configure \
|
||||
--prefix="$TMPDIR" \
|
||||
--with-pic \
|
||||
--host=i686-w64-mingw32
|
||||
make
|
||||
make install-strip
|
||||
|
||||
# Build autoconf stuff of usb4java if needed
|
||||
cd "$TMPDIR/.."
|
||||
if [ ! -e configure ]
|
||||
then
|
||||
make -f Makefile.scm
|
||||
fi
|
||||
|
||||
# Build libusb4java
|
||||
CFLAGS=-m32 PKG_CONFIG_PATH="$TMPDIR/lib/pkgconfig" ./configure \
|
||||
--prefix="$TMPDIR" \
|
||||
--host=i686-w64-mingw32
|
||||
make clean install-strip
|
||||
mkdir -p "$DISTDIR"
|
||||
cp -faL "$TMPDIR/bin/libusb4java-1.dll" "$DISTDIR/libusb4java.dll"
|
||||
cp -faL "$TMPDIR/bin/libusb-1.0.dll" "$DISTDIR"
|
||||
chmod -x "$DISTDIR/"*.dll
|
||||
|
||||
# Cleanup
|
||||
rm -rf "$TMPDIR"
|
||||
@ -1,60 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Compile libusb4java for 32 bit windows with mingw on Windows
|
||||
# or cross-compile it with mingw on Linux.
|
||||
#
|
||||
# For cross-compiling on Linux mingw-w64-dev must be installed.
|
||||
|
||||
set -e
|
||||
cd $(dirname $0)/..
|
||||
|
||||
OS="windows"
|
||||
ARCH="x86_64"
|
||||
LIBUSBX_VERSION="1.0.14"
|
||||
LIBUSBX_ARCHIVE="libusbx-$LIBUSBX_VERSION.tar.bz2"
|
||||
TMPDIR="$(pwd)/tmp"
|
||||
DOWNLOADS="$(pwd)/downloads"
|
||||
DISTDIR="$(pwd)/../resources/de/ailis/usb4java/libusb/${OS}-${ARCH}"
|
||||
|
||||
# Clean up
|
||||
rm -rf "$TMPDIR"
|
||||
rm -rf "$DISTDIR"
|
||||
|
||||
# Download libusbx if necessary
|
||||
mkdir -p "$DOWNLOADS"
|
||||
if [ ! -e "$DOWNLOADS/$LIBUSBX_ARCHIVE" ]
|
||||
then
|
||||
wget -O "$DOWNLOADS/$LIBUSBX_ARCHIVE" "http://downloads.sourceforge.net/project/libusbx/releases/$LIBUSBX_VERSION/source/$LIBUSBX_ARCHIVE"
|
||||
fi
|
||||
|
||||
# Unpack and compile libusbx
|
||||
mkdir -p "$TMPDIR"
|
||||
cd "$TMPDIR"
|
||||
tar xfj "$DOWNLOADS/$LIBUSBX_ARCHIVE"
|
||||
cd "libusbx-$LIBUSBX_VERSION"
|
||||
./configure \
|
||||
--prefix="$TMPDIR" \
|
||||
--with-pic \
|
||||
--host=x86_64-w64-mingw32
|
||||
make
|
||||
make install-strip
|
||||
|
||||
# Build autoconf stuff of usb4java if needed
|
||||
cd "$TMPDIR/.."
|
||||
if [ ! -e configure ]
|
||||
then
|
||||
make -f Makefile.scm
|
||||
fi
|
||||
|
||||
# Build libusb4java
|
||||
PKG_CONFIG_PATH="$TMPDIR/lib/pkgconfig" ./configure \
|
||||
--prefix="$TMPDIR" \
|
||||
--host=x86_64-w64-mingw32
|
||||
make clean install-strip
|
||||
mkdir -p "$DISTDIR"
|
||||
cp -faL "$TMPDIR/bin/libusb4java-1.dll" "$DISTDIR/libusb4java.dll"
|
||||
cp -faL "$TMPDIR/bin/libusb-1.0.dll" "$DISTDIR"
|
||||
chmod -x "$DISTDIR/"*.dll
|
||||
|
||||
# Cleanup
|
||||
rm -rf "$TMPDIR"
|
||||
14
src/main/c/build/windows-x86.sh
Executable file
14
src/main/c/build/windows-x86.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Builds libusb4java for 32 bit windows
|
||||
|
||||
set -e
|
||||
|
||||
. $(dirname $0)/common.sh
|
||||
|
||||
OS="windows"
|
||||
ARCH="x86"
|
||||
HOST="i686-w64-mingw32"
|
||||
CFLAGS="-m32"
|
||||
|
||||
build
|
||||
14
src/main/c/build/windows-x86_64.sh
Executable file
14
src/main/c/build/windows-x86_64.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Builds libusb4java for 64 bit windows
|
||||
|
||||
set -e
|
||||
|
||||
. $(dirname $0)/common.sh
|
||||
|
||||
OS="windows"
|
||||
ARCH="x86_64"
|
||||
HOST="$ARCH-w64-mingw32"
|
||||
CFLAGS="-m64"
|
||||
|
||||
build
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user