2024-03-01 19:02:00 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -ex
|
|
|
|
DEPS_DIR=$(dirname ${BASH_SOURCE[0]})
|
|
|
|
cd "$DEPS_DIR"
|
|
|
|
. common
|
2024-11-22 21:14:05 +00:00
|
|
|
process_args "$@"
|
2024-03-01 19:02:00 +00:00
|
|
|
|
|
|
|
VERSION=1.0.27
|
2024-03-30 10:23:41 +00:00
|
|
|
FILENAME=libusb-$VERSION.tar.gz
|
2024-03-01 19:02:00 +00:00
|
|
|
PROJECT_DIR=libusb-$VERSION
|
2024-03-30 10:23:41 +00:00
|
|
|
SHA256SUM=e8f18a7a36ecbb11fb820bd71540350d8f61bcd9db0d2e8c18a6fb80b214a3de
|
2024-03-01 19:02:00 +00:00
|
|
|
|
|
|
|
cd "$SOURCES_DIR"
|
|
|
|
|
|
|
|
if [[ -d "$PROJECT_DIR" ]]
|
|
|
|
then
|
|
|
|
echo "$PWD/$PROJECT_DIR" found
|
|
|
|
else
|
2024-03-30 10:23:41 +00:00
|
|
|
get_file "https://github.com/libusb/libusb/archive/refs/tags/v$VERSION.tar.gz" "$FILENAME" "$SHA256SUM"
|
2024-03-01 19:02:00 +00:00
|
|
|
tar xf "$FILENAME" # First level directory is "$PROJECT_DIR"
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "$BUILD_DIR/$PROJECT_DIR"
|
|
|
|
cd "$BUILD_DIR/$PROJECT_DIR"
|
|
|
|
|
|
|
|
export CFLAGS='-O2'
|
|
|
|
export CXXFLAGS="$CFLAGS"
|
|
|
|
|
2024-11-21 22:16:18 +00:00
|
|
|
if [[ -d "$DIRNAME" ]]
|
2024-03-01 19:02:00 +00:00
|
|
|
then
|
2024-11-21 22:16:18 +00:00
|
|
|
echo "'$PWD/$DIRNAME' already exists, not reconfigured"
|
|
|
|
cd "$DIRNAME"
|
2024-03-01 19:02:00 +00:00
|
|
|
else
|
2024-11-21 22:16:18 +00:00
|
|
|
mkdir "$DIRNAME"
|
|
|
|
cd "$DIRNAME"
|
2024-03-01 19:02:00 +00:00
|
|
|
|
2024-11-21 21:44:12 +00:00
|
|
|
conf=(
|
2024-11-21 22:16:18 +00:00
|
|
|
--prefix="$INSTALL_DIR/$DIRNAME"
|
2024-11-21 21:44:12 +00:00
|
|
|
)
|
|
|
|
|
2024-11-21 22:16:18 +00:00
|
|
|
if [[ "$LINK_TYPE" == static ]]
|
|
|
|
then
|
|
|
|
conf+=(
|
|
|
|
--enable-static
|
|
|
|
--disable-shared
|
|
|
|
)
|
|
|
|
else
|
|
|
|
conf+=(
|
|
|
|
--disable-static
|
|
|
|
--enable-shared
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$BUILD_TYPE" == cross ]]
|
|
|
|
then
|
|
|
|
conf+=(
|
|
|
|
--host="$HOST_TRIPLET"
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
2024-11-21 21:44:12 +00:00
|
|
|
"$SOURCES_DIR/$PROJECT_DIR"/bootstrap.sh
|
|
|
|
"$SOURCES_DIR/$PROJECT_DIR"/configure "${conf[@]}"
|
2024-03-01 19:02:00 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
make -j
|
|
|
|
make install-strip
|