Merge in Brian's massive build system cleanup effort.
Conflicts:
.gitignore
aos/build/build.sh
diff --git a/.gitignore b/.gitignore
index 4b185e4..0d20b64 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1 @@
-/out_atom/
-/out_bot3_atom
-/out_crio/
-/output/
*.pyc
diff --git a/aos/atom_code/ipc_lib/aos_sync.c b/aos/atom_code/ipc_lib/aos_sync.c
index 1980a4d..18e65a7 100644
--- a/aos/atom_code/ipc_lib/aos_sync.c
+++ b/aos/atom_code/ipc_lib/aos_sync.c
@@ -10,7 +10,13 @@
#include <string.h>
#include <inttypes.h>
-#include "cmpxchg.h"
+// TODO(brians): Inline these in the new PI version.
+#define cmpxchg(ptr, o, n) __sync_val_compare_and_swap(ptr, o, n)
+static inline uint32_t xchg(mutex *pointer, uint32_t value) {
+ uint32_t result;
+ __atomic_exchange(pointer, &value, &result, __ATOMIC_SEQ_CST);
+ return result;
+}
// this code is based on something that appears to be based on <http://www.akkadia.org/drepper/futex.pdf>, which also has a lot of useful information
// should probably use <http://lxr.linux.no/linux+v2.6.34/Documentation/robust-futexes.txt> once it becomes available
diff --git a/aos/atom_code/ipc_lib/cmpxchg.h b/aos/atom_code/ipc_lib/cmpxchg.h
deleted file mode 100644
index 715c57d..0000000
--- a/aos/atom_code/ipc_lib/cmpxchg.h
+++ /dev/null
@@ -1,153 +0,0 @@
-#ifndef __ASM_CMPXCHG_H
-#define __ASM_CMPXCHG_H
-
-#include <stdint.h>
-
-//TODO implement xchg using gcc's atomic builtins (http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html)
-//or maybe http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
-//__atomic_fetch_sub looks promising
-
-#define cmpxchg(ptr, o, n) __sync_val_compare_and_swap(ptr, o, n)
-/*#define xchg(ptr, n) ({typeof(*ptr) r; \
- do{ \
- r = *ptr; \
- }while(!__sync_bool_compare_and_swap(ptr, r, n)); \
- r; \
-})*/
-
-# define LOCK "lock;"
-# define LOCK_PREFIX "lock;"
-
-#define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr))))
-
-#define __xg(x) ((volatile long long *)(x))
-
-/*static inline void set_64bit(volatile unsigned long *ptr, unsigned long val)
-{
- *ptr = val;
-}
-
-#define _set_64bit set_64bit*/
-
-/*
- * Note: no "lock" prefix even on SMP: xchg always implies lock anyway
- * Note 2: xchg has side effect, so that attribute volatile is necessary,
- * but generally the primitive is invalid, *ptr is output argument. --ANK
- */
-static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
-{
- switch (size) {
- case 1:
- __asm__ __volatile__("xchgb %b0,%1"
- :"=q" (x)
- :"m" (*__xg(ptr)), "0" (x)
- :"memory");
- break;
- case 2:
- __asm__ __volatile__("xchgw %w0,%1"
- :"=r" (x)
- :"m" (*__xg(ptr)), "0" (x)
- :"memory");
- break;
- case 4:
- __asm__ __volatile__("xchgl %k0,%1"
- :"=r" (x)
- :"m" (*__xg(ptr)), "0" (x)
- :"memory");
- break;
- case 8:
- __asm__ __volatile__("xchg %0,%1"
- :"=r" (x)
- :"m" (*__xg(ptr)), "0" (x)
- :"memory");
- break;
- }
- return x;
-}
-
-/*
- * Atomic compare and exchange. Compare OLD with MEM, if identical,
- * store NEW in MEM. Return the initial value in MEM. Success is
- * indicated by comparing RETURN with OLD.
- */
-
-#if 0
-
-#define __HAVE_ARCH_CMPXCHG 1
-
-static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
- unsigned long new, int size)
-{
- int32_t prev;
- switch (size) {
- case 1:
- __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2"
- : "=a"(prev)
- : "q"(new), "m"(*__xg(ptr)), "0"(old)
- : "memory");
- return prev;
- case 2:
- __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2"
- : "=a"(prev)
- : "r"(new), "m"(*__xg(ptr)), "0"(old)
- : "memory");
- return prev;
- case 4:
- __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %k1,%2"
- : "=a"(prev)
- : "r"(new), "m"(*__xg(ptr)), "0"(old)
- : "memory");
- return prev;
- case 8:
- __asm__ __volatile__("lock; cmpxchg %1,%2"
- : "=a"(prev)
- : "q"(new), "m"(*__xg(ptr)), "0"(old)
- : "memory");
- return prev;
- }
- return old;
-}
-
-/*
-static inline unsigned long __cmpxchg_local(volatile void *ptr,
- unsigned long old, unsigned long new, int size)
-{
- unsigned long prev;
- switch (size) {
- case 1:
- __asm__ __volatile__("cmpxchgb %b1,%2"
- : "=a"(prev)
- : "q"(new), "m"(*__xg(ptr)), "0"(old)
- : "memory");
- return prev;
- case 2:
- __asm__ __volatile__("cmpxchgw %w1,%2"
- : "=a"(prev)
- : "r"(new), "m"(*__xg(ptr)), "0"(old)
- : "memory");
- return prev;
- case 4:
- __asm__ __volatile__("cmpxchgl %k1,%2"
- : "=a"(prev)
- : "r"(new), "m"(*__xg(ptr)), "0"(old)
- : "memory");
- return prev;
- case 8:
- __asm__ __volatile__("cmpxchgq %1,%2"
- : "=a"(prev)
- : "r"(new), "m"(*__xg(ptr)), "0"(old)
- : "memory");
- return prev;
- }
- return old;
-}*/
-
-#define cmpxchg(ptr,o,n)\
- ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\
- (unsigned long)(n),sizeof(*(ptr))))
-/*#define cmpxchg_local(ptr,o,n)\
- ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\
- (unsigned long)(n),sizeof(*(ptr))))*/
-#endif
-
-#endif
diff --git a/aos/build/aos.gypi b/aos/build/aos.gypi
index 9c74438..d8a4016 100644
--- a/aos/build/aos.gypi
+++ b/aos/build/aos.gypi
@@ -121,10 +121,10 @@
'-mcpu=603e',
'-mstrict-align',
'-mlongcall',
- '-isystem', '<(aos_abs)/externals/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/lib/gcc/powerpc-wrs-vxworks/3.4.4/include/',
- '-isystem', '<(aos_abs)/externals/gccdist/WindRiver/vxworks-6.3/target/h/',
- '-isystem', '<(aos_abs)/externals/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
- '-isystem', '<(aos_abs)/externals/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/powerpc-wrs-vxworks/',
+ '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/lib/gcc/powerpc-wrs-vxworks/3.4.4/include/',
+ '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/',
+ '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
+ '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/powerpc-wrs-vxworks/',
'-isystem', '<(WIND_BASE)/target/h',
'-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
],
diff --git a/aos/build/build.sh b/aos/build/build.sh
index e0ff434..c7a4bc4 100755
--- a/aos/build/build.sh
+++ b/aos/build/build.sh
@@ -21,37 +21,37 @@
[ "${DEBUG}" == "yes" -o "${DEBUG}" == "no" ] || ( echo Debug "(${DEBUG})" must be '"yes" or "no"'. ; exit 1 )
AOS=`dirname $0`/..
-NINJA_RELEASE=v1.4.0
-NINJA_DIR=${AOS}/externals/ninja-${NINJA_RELEASE}
-NINJA=${NINJA_DIR}/ninja
-# From chromium@154360:trunk/src/DEPS.
-GYP_REVISION=1738
-GYP_DIR=${AOS}/externals/gyp-${GYP_REVISION}
-GYP=${GYP_DIR}/gyp
-OUTDIR=${AOS}/../out_${OUT_NAME}
-BUILD_NINJA=${OUTDIR}/Default/build.ninja
+OUTDIR=${AOS}/../output/${OUT_NAME}
+BUILD_NINJA=${OUTDIR}/build.ninja
-[ -d ${NINJA_DIR} ] || git clone --branch ${NINJA_RELEASE} https://github.com/martine/ninja.git ${NINJA_DIR}
-[ -x ${NINJA} ] || ${NINJA_DIR}/bootstrap.py
-[ -d ${GYP_DIR} ] || ( svn co http://gyp.googlecode.com/svn/trunk -r ${GYP_REVISION} ${GYP_DIR} && patch -p1 -d ${GYP_DIR} < ${AOS}/externals/gyp.patch )
${AOS}/build/download_externals.sh
+. $(dirname $0)/tools_config
# The exciting quoting is so that it ends up with -DWHATEVER='"'`a command`'"'.
# The '"' at either end is so that it creates a string constant when expanded
# in the C/C++ code.
COMMONFLAGS='-DLOG_SOURCENAME='"'\"'"'`basename $in`'"'\"' "
-if [ ${PLATFORM} == crio ]; then
- COMMONFLAGS+='-DAOS_INITNAME=aos_init_function_`readlink -f $out | sed \"s/[\/.]/_/g\"` '
-fi
if [[ "${ACTION}" != "clean" && ( ! -d ${OUTDIR} || -n \
"`find ${AOS}/.. -newer ${BUILD_NINJA} \( -name '*.gyp' -or -name '*.gypi' \)`" ) ]]; then
- ${GYP} \
- --check --depth=${AOS}/.. --no-circular-check -f ninja \
- -I${AOS}/build/aos.gypi -Goutput_dir=out_${OUT_NAME} \
- -DOS=${PLATFORM} -DWIND_BASE=${WIND_BASE} -DDEBUG=${DEBUG} \
- ${GYP_MAIN}
+ # This is a gyp "file" that we pipe into gyp so that it will put the output
+ # in a directory named what we want where we want it.
+ GYP_INCLUDE=$(cat <<END
+{
+ 'target_defaults': {
+ 'configurations': {
+ '${PLATFORM}': {}
+ }
+ }
+}
+END
+)
+ echo "${GYP_INCLUDE}" | ${GYP} \
+ --check --depth=${AOS}/.. --no-circular-check -f ninja \
+ -I${AOS}/build/aos.gypi -I/dev/stdin -Goutput_dir=output \
+ -DOS=${PLATFORM} -DWIND_BASE=${WIND_BASE} -DDEBUG=${DEBUG} \
+ ${GYP_MAIN}
# Have to substitute "command = $compiler" so that it doesn't try to
# substitute them in the linker commands, where it doesn't work.
sed -i "s:command = \$cc:\\0 ${COMMONFLAGS}:g ; \
@@ -70,28 +70,28 @@
else
NINJA_ACTION=
fi
- ${NINJA} -C ${OUTDIR}/Default ${NINJA_ACTION} "$@"
+ ${NINJA} -C ${OUTDIR} ${NINJA_ACTION} "$@"
if [[ ${ACTION} == deploy || ${ACTION} == redeploy ]]; then
[[ ${PLATFORM} =~ .*atom ]] && \
rsync --progress -c -r \
- ${OUTDIR}/Default/outputs/* \
+ ${OUTDIR}/outputs/* \
driver@`${AOS}/build/get_ip fitpc`:/home/driver/robot_code/bin
ssh driver@`${AOS}/build/get_ip fitpc` "sync; sync; sync"
[ ${PLATFORM} == crio ] && \
ncftpput `${AOS}/build/get_ip robot` / \
- ${OUTDIR}/Default/lib/FRC_UserProgram.out
+ ${OUTDIR}/lib/FRC_UserProgram.out
fi
if [[ ${ACTION} == redeploy ]]; then
if [[ ${PLATFORM} != crio ]]; then
echo "Platform ${PLATFORM} does not support redeploy." 1>&2
exit 1
fi
- ${OUTDIR}/../out_atom/Default/outputs/netconsole <<"END"
+ ${OUTDIR}/../out_atom/outputs/netconsole <<"END"
unld "FRC_UserProgram.out"
ld < FRC_UserProgram.out
END
fi
if [[ ${ACTION} == tests ]]; then
- find ${OUTDIR}/Default/tests -executable -exec {} \;
+ find ${OUTDIR}/tests -executable -exec {} \;
fi
fi
diff --git a/aos/build/download_externals.sh b/aos/build/download_externals.sh
index 13c8eff..be77aa5 100755
--- a/aos/build/download_externals.sh
+++ b/aos/build/download_externals.sh
@@ -2,8 +2,19 @@
set -e
-AOS=`dirname $0`/..
-EXTERNALS=${AOS}/externals
+AOS=$(readlink -f $(dirname $0)/..)
+. $(dirname $0)/tools_config
+
+TMPDIR=/tmp/$$-aos-tmpdir
+mkdir -p ${EXTERNALS}
+mkdir -p ${COMPILED}
+
+# get and build ninja
+[ -d ${NINJA_DIR} ] || git clone --branch ${NINJA_RELEASE} https://github.com/martine/ninja.git ${NINJA_DIR}
+[ -x ${NINJA} ] || ${NINJA_DIR}/bootstrap.py
+
+# get gyp
+[ -d ${GYP_DIR} ] || ( svn co http://gyp.googlecode.com/svn/trunk -r ${GYP_REVISION} ${GYP_DIR} && patch -p1 -d ${GYP_DIR} < ${AOS}/externals/gyp.patch )
# get gccdist
GCCDIST=${EXTERNALS}/gccdist
@@ -32,7 +43,7 @@
LIBJPEG_VERSION=8d
LIBJPEG_DIR=${EXTERNALS}/jpeg-${LIBJPEG_VERSION}
# NOTE: this directory ends up in #include names
-LIBJPEG_PREFIX=${EXTERNALS}/libjpeg
+LIBJPEG_PREFIX=${COMPILED}/libjpeg
LIBJPEG_LIB=${LIBJPEG_PREFIX}/lib/libjpeg.a
LIBJPEG_TAR=${EXTERNALS}/jpegsrc.v${LIBJPEG_VERSION}.tar.gz
[ -f ${LIBJPEG_TAR} ] || wget http://www.ijg.org/files/jpegsrc.v${LIBJPEG_VERSION}.tar.gz -O ${LIBJPEG_TAR}
@@ -41,26 +52,26 @@
# get gtest
GTEST_VERSION=1.6.0
-GTEST_DIR=${EXTERNALS}/gtest-${GTEST_VERSION}-p1
+GTEST_DIR=${EXTERNALS}/gtest-${GTEST_VERSION}
GTEST_ZIP=${EXTERNALS}/gtest-${GTEST_VERSION}.zip
-TMPDIR=/tmp/$$-aos-tmpdir
[ -f ${GTEST_ZIP} ] || wget http://googletest.googlecode.com/files/gtest-${GTEST_VERSION}.zip -O ${GTEST_ZIP}
-[ -d ${GTEST_DIR} ] || ( unzip ${GTEST_ZIP} -d ${TMPDIR} && mv ${TMPDIR}/gtest-${GTEST_VERSION} ${GTEST_DIR} && cd ${GTEST_DIR} && patch -p1 < ../gtest.patch )
+[ -d ${GTEST_DIR} ] || ( unzip ${GTEST_ZIP} -d ${TMPDIR} && mv ${TMPDIR}/gtest-${GTEST_VERSION} ${GTEST_DIR} && cd ${GTEST_DIR} && patch -p1 < ${AOS}/externals/gtest.patch )
# get and build ctemplate
# This is the next revision after the 2.2 release and it only adds spaces to
# make gcc 4.7 with --std=c++11 happy (user-defined string literals...).
CTEMPLATE_VERSION=129
-CTEMPLATE_DIR=${EXTERNALS}/ctemplate-${CTEMPLATE_VERSION}
+CTEMPLATE_TAR=${EXTERNALS}/ctemplate-${CTEMPLATE_VERSION}.tar.gz
+CTEMPLATE_DIR=${COMPILED}/ctemplate-${CTEMPLATE_VERSION}
CTEMPLATE_PREFIX=${CTEMPLATE_DIR}-prefix
CTEMPLATE_LIB=${CTEMPLATE_PREFIX}/lib/libctemplate.a
CTEMPLATE_URL=http://ctemplate.googlecode.com
if [[ "${CTEMPLATE_VERSION}" =~ /\./ ]]; then
CTEMPLATE_URL=${CTEMPLATE_URL}/files/ctemplate-${CTEMPLATE_VERSION}.tar.gz
- [ -f ${CTEMPLATE_DIR}.tar.gz ] || \
- wget ${CTEMPLATE_URL} -O ${CTEMPLATE_DIR}.tar.gz
+ [ -f ${CTEMPLATE_TAR} ] || \
+ wget ${CTEMPLATE_URL} -O ${CTEMPLATE_TAR}
[ -d ${CTEMPLATE_DIR} ] || ( mkdir ${CTEMPLATE_DIR} && tar \
- --strip-components=1 -C ${CTEMPLATE_DIR} -xf ${CTEMPLATE_DIR}.tar.gz )
+ --strip-components=1 -C ${CTEMPLATE_DIR} -xf ${CTEMPLATE_TAR} )
else
CTEMPLATE_URL=${CTEMPLATE_URL}/svn/trunk
[ -d ${CTEMPLATE_DIR} ] || \
@@ -73,13 +84,14 @@
# get and build gflags
GFLAGS_VERSION=2.0
-GFLAGS_DIR=${EXTERNALS}/gflags-${GFLAGS_VERSION}
+GFLAGS_TAR=${EXTERNALS}/gflags-${GFLAGS_VERSION}.tar.gz
+GFLAGS_DIR=${COMPILED}/gflags-${GFLAGS_VERSION}
GFLAGS_PREFIX=${GFLAGS_DIR}-prefix
GFLAGS_LIB=${GFLAGS_PREFIX}/lib/libgflags.a
GFLAGS_URL=https://gflags.googlecode.com/files/gflags-${GFLAGS_VERSION}.tar.gz
-[ -f ${GFLAGS_DIR}.tar.gz ] || wget ${GFLAGS_URL} -O ${GFLAGS_DIR}.tar.gz
+[ -f ${GFLAGS_TAR} ] || wget ${GFLAGS_URL} -O ${GFLAGS_TAR}
[ -d ${GFLAGS_DIR} ] || ( mkdir ${GFLAGS_DIR} && tar \
- --strip-components=1 -C ${GFLAGS_DIR} -xf ${GFLAGS_DIR}.tar.gz )
+ --strip-components=1 -C ${GFLAGS_DIR} -xf ${GFLAGS_TAR} )
[ -f ${GFLAGS_LIB} ] || env -i PATH="${PATH}" \
CFLAGS='-m32' CXXFLAGS='-m32' LDFLAGS='-m32' \
bash -c "cd ${GFLAGS_DIR} && ./configure \
@@ -88,13 +100,14 @@
# get and build libusb
LIBUSB_VERSION=1.0.9
LIBUSB_APIVERSION=1.0
-LIBUSB_DIR=${EXTERNALS}/libusb-${LIBUSB_VERSION}
+LIBUSB_TAR=${EXTERNALS}/libusb-${LIBUSB_VERSION}.tar.bz2
+LIBUSB_DIR=${COMPILED}/libusb-${LIBUSB_VERSION}
LIBUSB_PREFIX=${LIBUSB_DIR}-prefix
LIBUSB_LIB=${LIBUSB_PREFIX}/lib/libusb-${LIBUSB_APIVERSION}.a
LIBUSB_URL=http://sourceforge.net/projects/libusb/files/libusb-${LIBUSB_APIVERSION}/libusb-${LIBUSB_VERSION}/libusb-${LIBUSB_VERSION}.tar.bz2
-[ -f ${LIBUSB_DIR}.tar.bz2 ] || wget ${LIBUSB_URL} -O ${LIBUSB_DIR}.tar.bz2
+[ -f ${LIBUSB_TAR} ] || wget ${LIBUSB_URL} -O ${LIBUSB_TAR}
[ -d ${LIBUSB_DIR} ] || ( mkdir ${LIBUSB_DIR} && tar \
- --strip-components=1 -C ${LIBUSB_DIR} -xf ${LIBUSB_DIR}.tar.bz2 )
+ --strip-components=1 -C ${LIBUSB_DIR} -xf ${LIBUSB_TAR} )
[ -f ${LIBUSB_LIB} ] || env -i PATH="${PATH}" \
CFLAGS='-m32' CXXFLAGS='-m32' LDFLAGS='-m32' \
bash -c "cd ${LIBUSB_DIR} && ./configure \
@@ -109,14 +122,15 @@
# get and build libevent
LIBEVENT_VERSION=2.0.21
-LIBEVENT_DIR=${EXTERNALS}/libevent-${LIBEVENT_VERSION}
+LIBEVENT_TAR=${EXTERNALS}/libevent-${LIBEVENT_VERSION}.tar.gz
+LIBEVENT_DIR=${COMPILED}/libevent-${LIBEVENT_VERSION}
LIBEVENT_PREFIX=${LIBEVENT_DIR}-prefix
LIBEVENT_LIB=${LIBEVENT_PREFIX}/lib/libevent.a
LIBEVENT_URL=https://github.com/downloads/libevent/libevent
LIBEVENT_URL=${LIBEVENT_URL}/libevent-${LIBEVENT_VERSION}-stable.tar.gz
-[ -f ${LIBEVENT_DIR}.tar.gz ] || wget ${LIBEVENT_URL} -O ${LIBEVENT_DIR}.tar.gz
+[ -f ${LIBEVENT_TAR} ] || wget ${LIBEVENT_URL} -O ${LIBEVENT_TAR}
[ -d ${LIBEVENT_DIR} ] || ( mkdir ${LIBEVENT_DIR} && tar \
- --strip-components=1 -C ${LIBEVENT_DIR} -xf ${LIBEVENT_DIR}.tar.gz )
+ --strip-components=1 -C ${LIBEVENT_DIR} -xf ${LIBEVENT_TAR} )
[ -f ${LIBEVENT_LIB} ] || env -i PATH="${PATH}" \
CFLAGS='-m32' CXXFLAGS='-m32' LDFLAGS='-m32' \
bash -c "cd ${LIBEVENT_DIR} && ./configure \
@@ -124,15 +138,18 @@
# get and build libcdd
LIBCDD_VERSION=094g
-LIBCDD_DIR=${EXTERNALS}/libcdd-${LIBCDD_VERSION}
+LIBCDD_TAR=${EXTERNALS}/libcdd-${LIBCDD_VERSION}.tar.gz
+LIBCDD_DIR=${COMPILED}/libcdd-${LIBCDD_VERSION}
LIBCDD_PREFIX=${LIBCDD_DIR}-prefix
LIBCDD_LIB=${LIBCDD_PREFIX}/lib/libcdd.a
LIBCDD_URL=ftp://ftp.ifor.math.ethz.ch/pub/fukuda/cdd/cddlib-${LIBCDD_VERSION}.tar.gz
-[ -f ${LIBCDD_DIR}.tar.gz ] || \
- wget ${LIBCDD_URL} -O ${LIBCDD_DIR}.tar.gz
+[ -f ${LIBCDD_TAR} ] || \
+ wget ${LIBCDD_URL} -O ${LIBCDD_TAR}
[ -d ${LIBCDD_DIR} ] || ( mkdir ${LIBCDD_DIR} && tar \
- --strip-components=1 -C ${LIBCDD_DIR} -xf ${LIBCDD_DIR}.tar.gz )
+ --strip-components=1 -C ${LIBCDD_DIR} -xf ${LIBCDD_TAR} )
[ -f ${LIBCDD_LIB} ] || env -i PATH="${PATH}" \
CFLAGS='-m32' CXXFLAGS='-m32' LDFLAGS='-m32' \
bash -c "cd ${LIBCDD_DIR} && ./configure --disable-shared \
--prefix=`readlink -f ${LIBCDD_PREFIX}` && make && make install"
+
+rm -rf ${TMPDIR}
diff --git a/aos/build/externals.gyp b/aos/build/externals.gyp
index 99b26cf..283e7ce 100644
--- a/aos/build/externals.gyp
+++ b/aos/build/externals.gyp
@@ -2,12 +2,14 @@
# download_externals.sh makes sure that all of them have been downloaded.
{
'variables': {
- 'externals': '<(AOS)/externals',
- 'externals_abs': '<!(readlink -f ../externals)',
+ 'externals': '<(AOS)/../output/downloaded',
+ 'externals_abs': '<!(readlink -f ../../output/downloaded)',
+ 'compiled': '<(externals)/../compiled-i386',
+ 'compiled_abs': '<(externals_abs)/../compiled-i386',
# These versions have to be kept in sync with the ones in download_externals.sh.
'eigen_version': '3.1.3',
- 'gtest_version': '1.6.0-p1',
+ 'gtest_version': '1.6.0',
'onejar_version': '0.97',
'ctemplate_version': '129',
'gflags_version': '2.0',
@@ -22,7 +24,7 @@
'target_name': 'WPILib',
'type': 'static_library',
'sources': [
- '<!@(find <(externals)/WPILib/WPILib/ -name *.cpp)',
+ '<!@(find <(AOS)/externals/WPILib/WPILib/ -name *.cpp)',
],
'cflags!': [
'-Werror',
@@ -34,13 +36,13 @@
'-O3'
],
'include_dirs': [
- '<(externals)/WPILib',
- '<(externals)/WPILib/WPILib',
+ '<(AOS)/externals/WPILib',
+ '<(AOS)/externals/WPILib/WPILib',
],
'direct_dependent_settings': {
'cflags': [
- '-isystem', '<(externals_abs)/WPILib',
- '-isystem', '<(externals_abs)/WPILib/WPILib',
+ '-isystem', '<(AOS)/externals/WPILib',
+ '-isystem', '<(AOS)/externals/WPILib/WPILib',
],
},
},
@@ -48,14 +50,14 @@
'target_name': 'WPILib-NetworkRobotValues',
'type': 'static_library',
'sources': [
- '<(externals)/WPILib/WPILib/NetworkRobot/NetworkRobotValues.cpp'
+ '<(AOS)/externals/WPILib/WPILib/NetworkRobot/NetworkRobotValues.cpp'
],
'include_dirs': [
- '<(externals)/WPILib',
+ '<(AOS)/externals/WPILib',
],
'direct_dependent_settings': {
'include_dirs': [
- '<(externals)/WPILib',
+ '<(AOS)/externals/WPILib',
],
},
},
@@ -102,10 +104,10 @@
'target_name': 'libevent',
'type': 'none',
'link_settings': {
- 'libraries': ['<(externals_abs)/libevent-<(libevent_version)-prefix/lib/libevent.a'],
+ 'libraries': ['<(compiled_abs)/libevent-<(libevent_version)-prefix/lib/libevent.a'],
},
'direct_dependent_settings': {
- 'include_dirs': ['<(externals)/libevent-<(libevent_version)-prefix/include'],
+ 'include_dirs': ['<(compiled)/libevent-<(libevent_version)-prefix/include'],
},
},
{
@@ -121,7 +123,10 @@
'target_name': 'libjpeg',
'type': 'none',
'direct_dependent_settings': {
- 'libraries': ['<(externals_abs)/libjpeg/lib/libjpeg.a'],
+ 'libraries': ['<(compiled_abs)/libjpeg/lib/libjpeg.a'],
+ 'cflags': [
+ '-isystem', '<(compiled)',
+ ],
},
},
{
@@ -182,40 +187,40 @@
'target_name': 'ctemplate',
'type': 'none',
'link_settings': {
- 'libraries': ['<(externals_abs)/ctemplate-<(ctemplate_version)-prefix/lib/libctemplate.a'],
+ 'libraries': ['<(compiled_abs)/ctemplate-<(ctemplate_version)-prefix/lib/libctemplate.a'],
},
'direct_dependent_settings': {
- 'include_dirs': ['<(externals)/ctemplate-<(ctemplate_version)-prefix/include'],
+ 'include_dirs': ['<(compiled)/ctemplate-<(ctemplate_version)-prefix/include'],
},
},
{
'target_name': 'gflags',
'type': 'none',
'link_settings': {
- 'libraries': ['<(externals_abs)/gflags-<(gflags_version)-prefix/lib/libgflags.a'],
+ 'libraries': ['<(compiled_abs)/gflags-<(gflags_version)-prefix/lib/libgflags.a'],
},
'direct_dependent_settings': {
- 'include_dirs': ['<(externals)/gflags-<(gflags_version)-prefix/include'],
+ 'include_dirs': ['<(compiled)/gflags-<(gflags_version)-prefix/include'],
},
},
{
'target_name': 'libusb',
'type': 'none',
'link_settings': {
- 'libraries': ['<(externals_abs)/libusb-<(libusb_version)-prefix/lib/libusb-<(libusb_apiversion).a'],
+ 'libraries': ['<(compiled_abs)/libusb-<(libusb_version)-prefix/lib/libusb-<(libusb_apiversion).a'],
},
'direct_dependent_settings': {
- 'include_dirs': ['<(externals)/libusb-<(libusb_version)-prefix/include'],
+ 'include_dirs': ['<(compiled)/libusb-<(libusb_version)-prefix/include'],
},
},
{
'target_name': 'libcdd',
'type': 'none',
'link_settings': {
- 'libraries': ['<(externals_abs)/libcdd-<(libcdd_version)-prefix/lib/libcdd.a'],
+ 'libraries': ['<(compiled_abs)/libcdd-<(libcdd_version)-prefix/lib/libcdd.a'],
},
'direct_dependent_settings': {
- 'include_dirs': ['<(externals_abs)/libcdd-<(libcdd_version)-prefix/include'],
+ 'include_dirs': ['<(compiled_abs)/'],
},
},
],
diff --git a/aos/build/tools_config b/aos/build/tools_config
new file mode 100644
index 0000000..653c1ef
--- /dev/null
+++ b/aos/build/tools_config
@@ -0,0 +1,14 @@
+# This is a shell fragment that sets up variables related to where the tools
+# that download_externals.sh downloads so build.sh can use.
+
+EXTERNALS=${AOS}/../output/downloaded
+COMPILED=${EXTERNALS}/../compiled-i386
+
+NINJA_RELEASE=v1.4.0
+NINJA_DIR=${EXTERNALS}/ninja-${NINJA_RELEASE}
+NINJA=${NINJA_DIR}/ninja
+
+# From chromium@154360:trunk/src/DEPS.
+GYP_REVISION=1738
+GYP_DIR=${EXTERNALS}/gyp-${GYP_REVISION}
+GYP=${GYP_DIR}/gyp
diff --git a/aos/controls/polytope.h b/aos/controls/polytope.h
index ed4b36d..a873722 100644
--- a/aos/controls/polytope.h
+++ b/aos/controls/polytope.h
@@ -2,8 +2,8 @@
#define _AOS_CONTROLS_POLYTOPE_H_
#include "Eigen/Dense"
-#include "aos/externals/libcdd-094g-prefix/include/setoper.h"
-#include "aos/externals/libcdd-094g-prefix/include/cdd.h"
+#include "libcdd-094g-prefix/include/setoper.h"
+#include "libcdd-094g-prefix/include/cdd.h"
namespace aos {
namespace controls {
diff --git a/output/.gitignore b/output/.gitignore
new file mode 100644
index 0000000..04d5097
--- /dev/null
+++ b/output/.gitignore
@@ -0,0 +1,3 @@
+/atom/
+/crio/
+/compiled-*/
diff --git a/aos/externals/.gitignore b/output/downloaded/.gitignore
similarity index 75%
rename from aos/externals/.gitignore
rename to output/downloaded/.gitignore
index 694129e..c45531d 100644
--- a/aos/externals/.gitignore
+++ b/output/downloaded/.gitignore
@@ -1,11 +1,10 @@
-/ctemplate-129-prefix/
/ctemplate-129.tar.gz
/ctemplate-129/
/eigen-3.1.3.tar.bz2
/eigen-3.1.3/
/gccdist.zip
/gccdist/
-/gtest-1.6.0-p1/
+/gtest-1.6.0/
/gtest-1.6.0.zip
/gyp-1738/
/javacv-0.2-bin.zip
@@ -15,17 +14,12 @@
/libjpeg/
/ninja-v1.4.0/
/one-jar-boot-0.97.jar
-/gflags-2.0-prefix/
/gflags-2.0.tar.gz
/gflags-2.0/
-/libusb-1.0.9-prefix/
/libusb-1.0.9.tar.bz2
/libusb-1.0.9/
/compiler-rt-RELEASE_32_final/
-/libevent-2.0.21-prefix/
/libevent-2.0.21.tar.gz
/libevent-2.0.21/
-/libcdd-094g-prefix/
/libcdd-094g.tar.gz
/libcdd-094g/
-
diff --git a/vision/JPEGRoutines.h b/vision/JPEGRoutines.h
index 17f1a68..c3b8e13 100644
--- a/vision/JPEGRoutines.h
+++ b/vision/JPEGRoutines.h
@@ -1,7 +1,7 @@
// for jpeglib.h
#include <stdio.h>
-#include "aos/externals/libjpeg/include/jpeglib.h"
+#include "libjpeg/include/jpeglib.h"
namespace frc971 {
namespace vision {
diff --git a/vision/OpenCVWorkTask.cpp b/vision/OpenCVWorkTask.cpp
index f17803e..8fc11eb 100644
--- a/vision/OpenCVWorkTask.cpp
+++ b/vision/OpenCVWorkTask.cpp
@@ -11,9 +11,10 @@
#include <vector>
#include <iostream>
+#include "libjpeg/include/jpeglib.h"
+
#include "aos/common/time.h"
#include "aos/atom_code/camera/Buffers.h"
-#include "aos/externals/libjpeg/include/jpeglib.h"
#include "aos/atom_code/init.h"
#include "aos/common/logging/logging.h"