Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesus89 committed Feb 28, 2017
2 parents 0fcf87e + 94f92be commit 4c2ab59
Show file tree
Hide file tree
Showing 28 changed files with 365 additions and 205 deletions.
41 changes: 41 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
sudo: required
dist: trusty

language: cpp

matrix:
include:
- os: linux
env: TARGET=linux_x86_64
- os: linux
env: TARGET=linux_i686
- os: linux
env: TARGET=linux_armv7l
- os: linux
env: TARGET=linux_aarch64
- os: linux
env: TARGET=windows_x86
- os: linux
env: TARGET=windows_amd64
- os: osx
env: TARGET=darwin

before_script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -y -qq; fi

script:
- bash build.sh $TARGET
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then md5 _packages/**/*.tar.gz; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then md5sum _packages/**/*.tar.gz; fi

deploy:
provider: releases
api_key:
secure: P3t3txMvsfFXymL/Z6AVsNTygLytSL2F/GNdLpvB3ULwz0qvVzwW0ep0DZIbUxgTbOR341zUpGlKYMaS0EvUAt3TrIATa4nI9CYKavRT8CKrAUyBg2OAN9+gVmBzOEgGvgGkTjzd1OUHn0YjYjYwV2qKXHwUi21q9rXjwc20qB+lVNWkdPe3sOZhI7yUmh3WcU1jGtehQFYlz40i6rS+ivAKC8FN4wfBW2OJVCZ67q9P+FUbpXccD5n3A/09DGhaatWqD7ULwBkl75Rmk4L51LeWKJvOGB3Af2uLqAQ18gkmBpydccqmErfldOKuuhnMgDzkLKfWg7jbvCBIqaFhPIOo4p6nBAnGrQFklwv7obwEtSbqnupP0REj8p+igMMANZYtVVweSrhw1fqHOFhNHC8abmVzOaos6rh1e9Nm2b4O0QCRIt1Wxc5iJy8Bfo4C8FBiSAHvgyKi1ZgPgnU1IfEw0Z94XYbxlOunXyh3YA5FcLUrCAfFAszGita0Bl9wOJn7bMB0nZhhpxLcms6iT0FH7na7tPl72MmjNEwLmns3/HyzUxTofUnsGuw669n73xvO/wQRqQgzUT8EW6m/25+kRWd8kWo5vUYOyVpci/QpVpJ5xytbWK99UYXfwMTBhh07Q3Wdpl7uDVzs25GHYezHXBxlAYbt5flYsI9tprk=
file:
- _packages/**/*.tar.gz
file_glob: true
skip_cleanup: true
on:
all_branches: true
39 changes: 28 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,41 @@

## Introduction

[Apio](https://github.com/FPGAwars/apio) package Tool for listing the usb devices and retrieving information from the ftdi chips
Static binaries of the **lsftdi** and **lsusb** tools. Packaged for [Apio](https://github.com/FPGAwars/apio).

* lsftdi: display information about connected FTDI devices
* lsusb: display information about USB buses in the system

## Usage

Edit the target architectures in the `build.sh` script:
Build:

```
bash build.sh linux_x86_64
```

Clean:

```
# -- Target architectures
ARCHS=( linux_x86_64 linux_armv7l )
# ARCHS=( linux_x86_64 linux_i686 linux_armv7l linux_aarch64 windows )
# ARCHS=( darwin )
bash clean.sh linux_x86_64
```

Run the script `./build.sh`
Target architectures:
* linux_x86_64
* linux_i686
* linux_armv7l
* linux_aarch64
* windows_x86
* windows_amd64
* darwin

Final packages will be generated in **\_packages/build_ARCH/** directory.
Final packages will be deployed in the **\_packages/build_ARCH/** directories.

NOTE: *libftdi* and *libusb* libraries are generated for each architecture. In order to obtain a static *libusb* library, *udev* has been disabled.

# Documentation

[The project documentation is located in the wiki](https://github.com/FPGAwars/tools-system/wiki).

## Authors

Expand All @@ -26,6 +45,4 @@ Final packages will be generated in **\_packages/build_ARCH/** directory.

## License

![](https://github.com/FPGAwars/tools-usb-ftdi/raw/master/doc/bq-logo-cc-sa-small-150px.png)

Licensed under [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/)
Licensed under [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/).
3 changes: 3 additions & 0 deletions build-data/cmake/toolchain-aarch64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
3 changes: 3 additions & 0 deletions build-data/cmake/toolchain-armhf.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
3 changes: 3 additions & 0 deletions build-data/cmake/toolchain-m32.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER gcc -m32)
set(CMAKE_CXX_COMPILER g++ -m32)
3 changes: 3 additions & 0 deletions build-data/cmake/toolchain-win32.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
3 changes: 3 additions & 0 deletions build-data/cmake/toolchain-win64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
Binary file removed build-data/linux_aarch64/lib/libftdi1.a
Binary file not shown.
Binary file removed build-data/linux_aarch64/lib/libusb-1.0.a
Binary file not shown.
Binary file removed build-data/linux_armv7l/lib/libftdi1.a
Binary file not shown.
Binary file removed build-data/linux_armv7l/lib/libpthread.so.0
Binary file not shown.
Binary file removed build-data/linux_armv7l/lib/libusb-1.0.a
Binary file not shown.
Binary file removed build-data/linux_i686/lib/libusb-1.0.a
Binary file not shown.
Binary file removed build-data/linux_x86_64/lib/libusb-1.0.a
Binary file not shown.
Binary file removed build-data/windows/lib/libftdi1.a
Binary file not shown.
Binary file removed build-data/windows/lib/libftdi1.dll.a
Binary file not shown.
Binary file removed build-data/windows/lib/libusb-1.0.a
Binary file not shown.
Binary file removed build-data/windows/lib/libusb-1.0.dll.a
Binary file not shown.
41 changes: 0 additions & 41 deletions build-data/windows/lib/libusb-1.0.la

This file was deleted.

103 changes: 50 additions & 53 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
# Generate tools-system-arch-ver.tar.gz from source code
# sources: https://github.com/FPGAwars/tools-system

VERSION=1.0.0
VERSION=1.1.0

# -- Target architectures
ARCHS=( )
# ARCHS=( linux_x86_64 linux_i686 linux_armv7l linux_aarch64 windows )
# ARCHS=( darwin )
ARCH=$1
TARGET_ARCHS="linux_x86_64 linux_i686 linux_armv7l linux_aarch64 windows_x86 windows_amd64 darwin"

# -- Tools name
NAME=tools-system
Expand Down Expand Up @@ -45,80 +44,78 @@ function test_bin {
exit 1
fi
}

# -- Print function
function print {
echo ""
echo $1
echo ""
}

# -- Check ARCHS
if [ ${#ARCHS[@]} -eq 0 ]; then
print "NOTE: add your architectures to the ARCHS variable in the build.sh script"
# -- Check ARCH
if [[ $# > 1 ]]; then
echo ""
echo "Error: too many arguments"
exit 1
fi

# -- Loop
for ARCH in ${ARCHS[@]}
do

if [[ $# < 1 ]]; then
echo ""
echo ">>> ARCHITECTURE $ARCH"

# -- Directory for compiling the tools
BUILD_DIR=$BUILDS_DIR/build_$ARCH

# -- Directory for installating the target files
PACKAGE_DIR=$PACKAGES_DIR/build_$ARCH
echo "Usage: bash build.sh TARGET"
echo ""
echo "Targets: $TARGET_ARCHS"
exit 1
fi

# -- Remove the build dir and the generated packages then exit
if [ "$1" == "clean" ]; then
if [[ $ARCH =~ [[:space:]] || ! $TARGET_ARCHS =~ (^|[[:space:]])$ARCH([[:space:]]|$) ]]; then
echo ""
echo ">>> WRONG ARCHITECTURE \"$ARCH\""
exit 1
fi

# -- Remove the package dir
rm -r -f $PACKAGE_DIR
echo ""
echo ">>> ARCHITECTURE \"$ARCH\""

# -- Remove the build dir
rm -r -f $BUILD_DIR
# -- Directory for compiling the tools
BUILD_DIR=$BUILDS_DIR/build_$ARCH

print ">> CLEAN"
continue
fi
# -- Directory for installating the target files
PACKAGE_DIR=$PACKAGES_DIR/build_$ARCH

# --------- Instal dependencies ------------------------------------
if [ $INSTALL_DEPS == "1" ]; then
# --------- Instal dependencies ------------------------------------
if [ $INSTALL_DEPS == "1" ]; then

print ">> Install dependencies"
. $WORK_DIR/scripts/install_dependencies.sh
print ">> Install dependencies"
. $WORK_DIR/scripts/install_dependencies.sh

fi
fi

# --------- Compile lsusb ------------------------------------------
if [ $COMPILE_LSUSB == "1" ]; then
# -- Create the build dir
mkdir -p $BUILD_DIR

# -- Create the build dir
mkdir -p $BUILD_DIR
# -- Create the package folders
mkdir -p $PACKAGE_DIR/$NAME/bin

print ">> Compile lsusb"
. $WORK_DIR/scripts/compile_lsusb.sh
# --------- Compile lsusb ------------------------------------------
if [ $COMPILE_LSUSB == "1" ]; then

fi
print ">> Compile lsusb"
. $WORK_DIR/scripts/compile_lsusb.sh

# --------- Compile lsftdi -----------------------------------------
if [ $COMPILE_LSFTDI == "1" ]; then
fi

# -- Create the build dir
mkdir -p $BUILD_DIR
# --------- Compile lsftdi -----------------------------------------
if [ $COMPILE_LSFTDI == "1" ]; then

print ">> Compile lsftdi"
. $WORK_DIR/scripts/compile_lsftdi.sh
print ">> Compile lsftdi"
. $WORK_DIR/scripts/compile_lsftdi.sh

fi

# --------- Create the package -------------------------------------
if [ $CREATE_PACKAGE == "1" ]; then
fi

print ">> Create package"
. $WORK_DIR/scripts/create_package.sh
# --------- Create the package -------------------------------------
if [ $CREATE_PACKAGE == "1" ]; then

fi
print ">> Create package"
. $WORK_DIR/scripts/create_package.sh

done
fi
72 changes: 72 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash
##################################
# System tools cleaner #
##################################

# -- Target architectures
ARCH=$1
TARGET_ARCHS="linux_x86_64 linux_i686 linux_armv7l linux_aarch64 windows_x86 windows_amd64 darwin"

# -- Store current dir
WORK_DIR=$PWD
# -- Folder for building the source code
BUILDS_DIR=$WORK_DIR/_builds
# -- Folder for storing the generated packages
PACKAGES_DIR=$WORK_DIR/_packages

# -- Test script function
function test_bin {
$WORK_DIR/test/test_bin.sh $1
if [ $? != "0" ]; then
exit 1
fi
}

# -- Check ARCH
if [[ $# > 1 ]]; then
echo ""
echo "Error: too many arguments"
exit 1
fi

if [[ $# < 1 ]]; then
echo ""
echo "Usage: bash clean.sh TARGET"
echo ""
echo "Targets: $TARGET_ARCHS"
exit 1
fi

if [[ $ARCH =~ [[:space:]] || ! $TARGET_ARCHS =~ (^|[[:space:]])$ARCH([[:space:]]|$) ]]; then
echo ""
echo ">>> WRONG ARCHITECTURE \"$ARCH\""
exit 1
fi

echo ""
echo ">>> ARCHITECTURE \"$ARCH\""

printf "Are you sure? [y/N]:${NC} "
read RESP
case "$RESP" in
[yY][eE][sS]|[yY])
# -- Directory for compiling the tools
BUILD_DIR=$BUILDS_DIR/build_$ARCH

# -- Directory for installation the target files
PACKAGE_DIR=$PACKAGES_DIR/build_$ARCH

# -- Remove the package dir
rm -r -f $PACKAGE_DIR

# -- Remove the build dir
rm -r -f $BUILD_DIR

echo ""
echo ">> CLEAN"
;;
*)
echo ""
echo ">> ABORT"
;;
esac
Loading

0 comments on commit 4c2ab59

Please sign in to comment.