Move CI-related files into .private directory and add unified build script The files needed for Continuous Integration (AppVeyor, Travis) are not meant for public consumption, so clean up the root directory by moving these files underneath .private. Create a single build script that is leveraged by both AppVeyor and Travis. This script replaces the previous 'travis-autogen.sh' file and enables additional compiler warnings that should provide additional coverage for all build environments. Update the Travis configuration file to absorb the Brewfile and update the Xcode images. Per warnings from Travis, Xcode6.4 is obsolete, thus replace it with Xcode7.3. Additionally remove the "gcc" variants for the macOS builds. The builds never used gcc to begin with and actually using gcc causes build errors due to Clang-specific pragmas in the IOKit header files. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
diff --git a/appveyor_build.sh b/.private/appveyor_build.sh old mode 100644 new mode 100755 similarity index 72% rename from appveyor_build.sh rename to .private/appveyor_build.sh index 7e6bed7..44ca46b --- a/appveyor_build.sh +++ b/.private/appveyor_build.sh
@@ -10,15 +10,13 @@ export PATH="/c/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin:${PATH}" fi -set -x - builddir="build-${buildsys}" installdir="${PWD}/libusb-${buildsys}" cd libusb + +echo "Bootstrapping ..." ./bootstrap.sh -mkdir "${builddir}" -cd "${builddir}" -../configure --prefix="${installdir}" --enable-examples-build --enable-tests-build -make -j4 -make install +echo "" + +exec .private/ci-build.sh --build-dir "${builddir}" --install -- "--prefix=${installdir}"
diff --git a/.private/bm.sh b/.private/bm.sh old mode 100644 new mode 100755
diff --git a/.private/ci-build.sh b/.private/ci-build.sh new file mode 100755 index 0000000..8a0da6b --- /dev/null +++ b/.private/ci-build.sh
@@ -0,0 +1,67 @@ +#!/bin/bash + +set -e + +builddir= +install=no + +while [ $# -gt 0 ]; do + case "$1" in + --build-dir) + if [ $# -lt 2 ]; then + echo "ERROR: missing argument for --build-dir option" >&2 + exit 1 + fi + builddir=$2 + shift 2 + ;; + --install) + install=yes + shift + ;; + --) + shift + break; + ;; + *) + echo "ERROR: Unexpected argument: $1" >&2 + exit 1 + esac +done + +if [ -z "${builddir}" ]; then + echo "ERROR: --build-dir option not specified" >&2 + exit 1 +fi + +if [ -e "${builddir}" ]; then + echo "ERROR: directory entry named '${builddir}' already exists" >&2 + exit 1 +fi + +mkdir "${builddir}" +cd "${builddir}" + +cflags="-O2" + +# enable extra warnings +cflags+=" -Winline" +cflags+=" -Wmissing-include-dirs" +cflags+=" -Wnested-externs" +cflags+=" -Wpointer-arith" +cflags+=" -Wredundant-decls" +cflags+=" -Wswitch-enum" + +echo "" +echo "Configuring ..." +CFLAGS="${cflags}" ../configure --enable-examples-build --enable-tests-build "$@" + +echo "" +echo "Building ..." +make -j4 -k + +if [ "${install}" = "yes" ]; then + echo "" + echo "Installing ..." + make install +fi
diff --git a/.travis.yml b/.travis.yml index 0111925..47ce5aa 100644 --- a/.travis.yml +++ b/.travis.yml
@@ -1,53 +1,53 @@ language: c +git: + depth: 1 + matrix: include: - os: linux dist: bionic - compiler: gcc + compiler: clang - os: linux dist: bionic - compiler: clang - - os: linux - dist: xenial compiler: gcc - os: linux dist: xenial compiler: clang - - os: osx - osx_image: xcode11.3 + - os: linux + dist: xenial compiler: gcc - os: osx osx_image: xcode11.3 compiler: clang - os: osx osx_image: xcode9.4 - compiler: gcc - - os: osx - osx_image: xcode9.4 compiler: clang - os: osx - osx_image: xcode6.4 - compiler: gcc - - os: osx - osx_image: xcode6.4 + osx_image: xcode7.3 compiler: clang addons: - homebrew: - update: true - brewfile: true apt: packages: - autoconf - automake - libtool - - m4 - libudev-dev - sources: - - ubuntu-toolchain-r-test + - m4 + homebrew: + packages: + - autoconf + - automake + - libtool + - m4 + update: true + +before_script: + - ./bootstrap.sh script: - - ./travis-autogen.sh && make -j4 - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make clean && ./travis-autogen.sh --disable-udev && make -j4 ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cd Xcode && xcodebuild -project libusb.xcodeproj ; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then .private/ci-build.sh --build-dir build-netlink -- --disable-udev; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then .private/ci-build.sh --build-dir build-udev -- --enable-udev; fi + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then .private/ci-build.sh --build-dir build; fi + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then cd Xcode && xcodebuild -project libusb.xcodeproj; fi
diff --git a/Brewfile b/Brewfile deleted file mode 100644 index c028148..0000000 --- a/Brewfile +++ /dev/null
@@ -1,4 +0,0 @@ -brew 'automake' -brew 'libtool' -brew 'autoconf' -brew 'm4'
diff --git a/appveyor.yml b/appveyor.yml index 42279ba..36cfa96 100644 --- a/appveyor.yml +++ b/appveyor.yml
@@ -40,8 +40,8 @@ - cmd: xcopy /S /I "%APPVEYOR_BUILD_FOLDER%" C:\cygwin\home\appveyor\libusb build_script: - cmd: msbuild "%APPVEYOR_BUILD_FOLDER%\msvc\libusb_2015.sln" /m /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" - - cmd: C:\msys64\usr\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\appveyor_build.sh" MinGW - - cmd: C:\cygwin\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\appveyor_build.sh" cygwin + - cmd: C:\msys64\usr\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\.private\appveyor_build.sh" MinGW + - cmd: C:\cygwin\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\.private\appveyor_build.sh" cygwin - matrix: @@ -54,8 +54,8 @@ - cmd: xcopy /S /I "%APPVEYOR_BUILD_FOLDER%" C:\cygwin64\home\appveyor\libusb build_script: - cmd: msbuild "%APPVEYOR_BUILD_FOLDER%\msvc\libusb_2015.sln" /m /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" - - cmd: C:\msys64\usr\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\appveyor_build.sh" MinGW - - cmd: C:\cygwin64\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\appveyor_build.sh" cygwin + - cmd: C:\msys64\usr\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\.private\appveyor_build.sh" MinGW + - cmd: C:\cygwin64\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\.private\appveyor_build.sh" cygwin - matrix:
diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 4205298..5028718 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h
@@ -1 +1 @@ -#define LIBUSB_NANO 11482 +#define LIBUSB_NANO 11483
diff --git a/travis-autogen.sh b/travis-autogen.sh deleted file mode 100755 index 7acf941..0000000 --- a/travis-autogen.sh +++ /dev/null
@@ -1,22 +0,0 @@ -#!/bin/bash - -CFLAGS="-O2" - -CFLAGS+=" -Wbad-function-cast" -#CFLAGS+=" -Wcast-align" -CFLAGS+=" -Wformat-security" -CFLAGS+=" -Winit-self" -CFLAGS+=" -Winline" -CFLAGS+=" -Wmissing-include-dirs" -CFLAGS+=" -Wnested-externs" -CFLAGS+=" -Wold-style-definition" -CFLAGS+=" -Wpointer-arith" -CFLAGS+=" -Wredundant-decls" -CFLAGS+=" -Wswitch-enum" - -# warnings disabled on purpose -CFLAGS+=" -Wno-deprecated-declarations" - -export CFLAGS - -exec ./autogen.sh "$@"