summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorTyler Veness2016-08-14 15:44:23 -0700
committerTyler Veness2017-01-26 17:51:01 -0800
commitb21d4ed9c54674e856f2ffe8ed4013cc6a8670b3 (patch)
tree6bf3751328b995722d77a89e92b4403f9e7ad4c3
parentcd8cacf57a4dcf9b05546d1f386e63991524f41b (diff)
downloadaur-b21d4ed9c54674e856f2ffe8ed4013cc6a8670b3.tar.gz
Cleaned up PKGBUILD and updated CMake toolchain file
-rw-r--r--.SRCINFO5
-rw-r--r--PKGBUILD37
-rw-r--r--toolchain-cmake.patch150
3 files changed, 176 insertions, 16 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 54f8eb09f29b..752e4298ac90 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,20 +1,21 @@
pkgbase = frcmake-git
pkgdesc = Some CMake stuff for use with the VxWorks 6.3 GCC Toolchain
pkgver = 46.c66f929
- pkgrel = 3
+ pkgrel = 4
url = http://firstforge.wpi.edu/sf/projects/c--11_toochain
arch = any
license = GPL
depends = wput
depends = cmake
provides = frcmake
- conflicts = vxworks-gcc-toolchain-bin
conflicts = frcmake
options = !strip
options = libtool
options = !zipman
source = git+http://bitbucket.org/frc-cpp11/frcmake
+ source = toolchain-cmake.patch
sha512sums = SKIP
+ sha512sums = b8c1ed21eab5af8b04f17ae8699e6c5ccdb99eff943e42e2ff2a5f3baf4b157e2426e3677f5086ff1694b713fdb945fc3e21b88cb5e5b2ed65274726433f3972
pkgname = frcmake-git
diff --git a/PKGBUILD b/PKGBUILD
index 7442af311247..d0c2f7dabe69 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,36 +1,45 @@
# Maintainer: Tyler Veness <calcmogul at gmail dot com>
# Contributor: Alex Brinister <alex_brinister@yahoo.com>
-_main_name=frcmake
-pkgname=$_main_name-git
+
+pkgname=frcmake-git
pkgver=46.c66f929
-pkgrel=3
+pkgrel=4
pkgdesc="Some CMake stuff for use with the VxWorks 6.3 GCC Toolchain"
arch=(any)
provides=('frcmake')
+conflicts=('frcmake')
url="http://firstforge.wpi.edu/sf/projects/c--11_toochain"
license=('GPL')
depends=('wput' 'cmake')
options=('!strip' 'libtool' '!zipman')
-conflicts=('vxworks-gcc-toolchain-bin' 'frcmake')
-source=("git+http://bitbucket.org/frc-cpp11/$_main_name")
-sha512sums=('SKIP')
+source=("git+http://bitbucket.org/frc-cpp11/frcmake"
+ "toolchain-cmake.patch")
+sha512sums=('SKIP'
+ 'b8c1ed21eab5af8b04f17ae8699e6c5ccdb99eff943e42e2ff2a5f3baf4b157e2426e3677f5086ff1694b713fdb945fc3e21b88cb5e5b2ed65274726433f3972')
pkgver() {
- cd $_main_name
+ cd "${srcdir}/frcmake"
+
echo $(git rev-list --count master).$(git rev-parse --short master)
}
+prepare() {
+ cd "${srcdir}/frcmake"
+
+ git apply ../toolchain-cmake.patch
+}
+
build() {
- cd "$srcdir/$_main_name"
- mkdir build && cd build
+ cd "${srcdir}/frcmake"
+
+ mkdir -p build && cd build
cmake ..
- make ${MAKEFLAGS} || return 1
+ make
}
package() {
- cd "$srcdir/$_main_name/build"
- make ${MAKEFLAGS} DESTDIR=$pkgdir install || return 1
+ cd "${srcdir}/frcmake/build"
+
+ make DESTDIR=${pkgdir} install
mv $pkgdir/usr/bin/frcmake $pkgdir/usr/bin/frcmake-wrs
}
-
-# vim:set ts=2 sw=2 et:
diff --git a/toolchain-cmake.patch b/toolchain-cmake.patch
new file mode 100644
index 000000000000..0270d3cea6c9
--- /dev/null
+++ b/toolchain-cmake.patch
@@ -0,0 +1,150 @@
+diff --git a/toolchain.cmake.in b/toolchain.cmake.in
+index a913671..32aa4d8 100644
+--- a/toolchain.cmake.in
++++ b/toolchain.cmake.in
+@@ -9,49 +9,40 @@ include(CMakeForceCompiler)
+
+ ### CONFIGURATION ###
+
+-set(TOOLCHAIN_PREFIX /usr/powerpc-wrs-vxworks)
+-set(TOOLCHAIN_IS_GCCDIST false)
+-set(TOOLCHAIN_C_COMPILER powerpc-wrs-vxworks-gcc)
+-set(TOOLCHAIN_CXX_COMPILER powerpc-wrs-vxworks-g++)
++set(TARGET powerpc-wrs-vxworks)
++set(TOOLCHAIN_PREFIX /usr/${TARGET})
+
+-set(STRIPSYMS powerpc-wrs-vxworks-stripsyms) #ignore for gccdist
+-set(MUNCH powerpc-wrs-vxworks-munch) #see README
++set(STRIPSYMS ${TARGET}-stripsyms)
++set(MUNCH ${TARGET}-munch) #see README
+
+ ### CONFIGURATION BELOW SHOULD NOT NEED TO BE CHANGED ###
+
+ set(WIND_BASE "$ENV{WIND_BASE}")
+-set(CMAKE_INSTALL_PREFIX "${TOOLCHAIN_PREFIX}")
+-set(CMAKE_FIND_ROOT_PATH "${TOOLCHAIN_PREFIX}")
+-set(VXWORKS_USE_SOFT_FLOAT false)
++set(CMAKE_INSTALL_PREFIX "/usr/${TARGET}")
++set(CMAKE_FIND_ROOT_PATH "/usr/${TARGET}")
+
+-CMAKE_FORCE_C_COMPILER("${TOOLCHAIN_C_COMPILER}" GNU)
+-CMAKE_FORCE_CXX_COMPILER("${TOOLCHAIN_CXX_COMPILER}" GNU)
++CMAKE_FORCE_C_COMPILER("${TARGET}-gcc" GNU)
++CMAKE_FORCE_CXX_COMPILER("${TARGET}-g++" GNU)
+ set(CMAKE_LIBRARY_PATH_FLAG -L)
+
+ ### TOOLCHAIN SPECIFIC CONFIGURATION ###
+-if(${TOOLCHAIN_IS_GCCDIST})
+- ### CONFIGURATION FOR GCCDIST ONLY ###
+- set(DKM_LINK_SCRIPT "${WIND_BASE}/target/h/tool/gnu/ldscripts/link.OUT")
+-else()
+- ### CONFIGURATION FOR NON-GCCDIST TOOLCHAINS ONLY ###
+- #locations of libraries so we can use nm to find their symbols
+- set(VXWORKS_LIBSTDCXX "${TOOLCHAIN_PREFIX}/lib/libstdc++.a")
+- set(VXWORKS_LIBSUPCXX "${TOOLCHAIN_PREFIX}/lib/libsupc++.a")
+- #libgcc's location changes based on gcc, so ask compiler where it is
+- execute_process(COMMAND "${TOOLCHAIN_C_COMPILER}" -print-libgcc-file-name OUTPUT_VARIABLE VXWORKS_LIBGCC)
+-
+- #the above command leaves a newline at the end of VXWORKS_LIBGCC.
+- #This triggers a bug in cmake's link script execution which will
+- #segfault because it sees a blank line and passes an empty string to
+- #execvp(). For now, workaround: use regex to strip trailing newline
+- string(REGEX REPLACE "(\r?\n)+$" "" VXWORKS_LIBGCC "${VXWORKS_LIBGCC}")
+-
+- #link flags for standard libraries
+- set(VXWORKS_STDLIB_LINK " -lsupc++ -lstdc++ -lgcc")
+- #TODO: Do we want libsupc++?
+-
+- set(DKM_LINK_SCRIPT "${TOOLCHAIN_PREFIX}/share/ldscripts/dkm.ld")
+-endif()
++#locations of libraries so we can use nm to find their symbols
++set(VXWORKS_LIBSTDCXX "/usr/${TARGET}/lib/libstdc++.a")
++set(VXWORKS_LIBSUPCXX "/usr/${TARGET}/lib/libsupc++.a")
++#libgcc's location changes based on gcc, so ask compiler where it is
++ execute_process(COMMAND "${TARGET}-gcc" -print-libgcc-file-name OUTPUT_VARIABLE VXWORKS_LIBGCC)
++
++ #the above command leaves a newline at the end of VXWORKS_LIBGCC.
++ #This triggers a bug in cmake's link script execution which will
++ #segfault because it sees a blank line and passes an empty string to
++ #execvp(). For now, workaround: use regex to strip trailing newline
++string(REGEX REPLACE "(\r?\n)+$" "" VXWORKS_LIBGCC "${VXWORKS_LIBGCC}")
++
++#link flags for standard libraries
++set(VXWORKS_STDLIB_LINK " -lsupc++ -lstdc++ -lgcc")
++#TODO: Do we want libsupc++?
++
++ set(DKM_LINK_SCRIPT "/usr/${TARGET}/share/ldscripts/dkm.ld")
+ ### END TOOLCHAIN SPECIFIC CONFIGURATION ###
+
+ ### END CONFIGURATION ###
+@@ -73,23 +64,12 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+-#System Headers
+-if(${TOOLCHAIN_IS_GCCDIST})
+- set(SYSTEM_INCLUDES "-isystem ${WIND_BASE}/target/h -isystem ${WIND_BASE}/target/h/wrn/coreip")
+-else()
+- #modern build toolchains do not presently require additional includes
+-endif()
+-
+ #build flags
+ set(CPU PPC603)
+ set(TOOL_FAMILY gnu)
+ set(TOOL gnu)
+ set(ARCH_SPEC "-mcpu=603 -mstrict-align -mlongcall")
+
+-if (${VXWORKS_USE_SOFT_FLOAT})
+- set(ARCH_SPEC "${ARCH_SPEC} -msoft_float")
+-endif()
+-
+ #Set CFLAGS, LDFLAGS
+ #Note that we use -nostdlib and then link with the standard library
+ set(VXWORKS_COMPILE_FLAGS "${ARCH_SPEC} -nostdlib -Wall ${SYSTEM_INCLUDES} -DCPU=${CPU} -DTOOL_FAMILY=${TOOL_FAMILY} -DTOOL=${TOOL} -D_WRS_KERNEL")
+@@ -105,25 +85,6 @@ set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LI
+
+ #link rules for C++:
+ #TODO: This will NOT work on win32!
+-if(${TOOLCHAIN_IS_GCCDIST})
+-# Do a partial link.
+-# - The first line compiles the partial image - NOTE: we link static libraries at this point so that all of
+-# the symbols that are pulled into the module (and only those symbols) will be munched in the next step
+-# - The second line "munches" the executable to generate a file (<TARGET>_ctdt.c) that contains all of the
+-# static constructors and destructors in an array so that the kernel can call them at the appropriate times.
+-# - The third line compiles the ctor/dtor file.
+-# - The fourth line links the partial image together with the ctor/dtor object to create the finished executable
+-# - The last line cleans up all these generated files (which will have to be regenerated later anyway)
+-#
+-# NOTE: We don't link the standard library here as we'll get the kernel's copy when we get loaded in
+- set(CMAKE_CXX_LINK_EXECUTABLE
+- "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> ${VXWORKS_DKM_LINK_FLAGS} <LINK_FLAGS> <OBJECTS> -o <TARGET>_PartialImage.out <LINK_LIBRARIES>"
+- "${MUNCH} <TARGET>_ctdt.c <TARGET>_PartialImage.out"
+- "<CMAKE_C_COMPILER> -c <TARGET>_ctdt.c -o <TARGET>_ctdt.c.o ${VXWORKS_COMPILE_FLAGS}"
+- "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <TARGET>_PartialImage.out <TARGET>_ctdt.c.o -o <TARGET> ${VXWORKS_DKM_LINK_FLAGS} ${VXWORKS_DKM_LINK_SCRIPT_FLAG}"
+- "<CMAKE_COMMAND> -E remove <TARGET>_PartialImage.out <TARGET>_ctdt.c <TARGET>_ctdt.c.o"
+- )
+-else()
+ # Here's the crazy part...
+ # - The first line compiles the partial image - NOTE: notice we also link the standard library at this point
+ # - We munch the executable, which now contains the standard library as well
+@@ -138,12 +99,11 @@ else()
+ # in what symbols are defined, inline functions, and other internals between the kernel's stdlib (which is a whole
+ # major version old!) and the one we have. Even if its just the headers, something might break. The gccdist link
+ # command might work, but I don't recommend it.
+- set(CMAKE_CXX_LINK_EXECUTABLE
+- "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> ${VXWORKS_DKM_LINK_FLAGS} <LINK_FLAGS> <OBJECTS> -o <TARGET>_PartialImage.out <LINK_LIBRARIES> ${VXWORKS_STDLIB_LINK}"
+- "${MUNCH} <TARGET>_ctdt.c <TARGET>_PartialImage.out"
+- "<CMAKE_C_COMPILER> -c <TARGET>_ctdt.c -o <TARGET>_ctdt.c.o ${VXWORKS_COMPILE_FLAGS}"
+- "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <TARGET>_PartialImage.out <TARGET>_ctdt.c.o -o <TARGET> ${VXWORKS_DKM_LINK_FLAGS} ${VXWORKS_DKM_LINK_SCRIPT_FLAG}"
+- "${STRIPSYMS} <TARGET> ${VXWORKS_LIBSTDCXX} ${VXWORKS_LIBSUPCXX} ${VXWORKS_LIBGCC}"
+- "<CMAKE_COMMAND> -E remove <TARGET>_PartialImage.out <TARGET>_ctdt.c <TARGET>_ctdt.c.o"
+- )
+-endif()
++set(CMAKE_CXX_LINK_EXECUTABLE
++ "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> ${VXWORKS_DKM_LINK_FLAGS} <LINK_FLAGS> <OBJECTS> -o <TARGET>_PartialImage.out <LINK_LIBRARIES> ${VXWORKS_STDLIB_LINK}"
++ "${MUNCH} <TARGET>_ctdt.c <TARGET>_PartialImage.out"
++ "<CMAKE_C_COMPILER> -c <TARGET>_ctdt.c -o <TARGET>_ctdt.c.o ${VXWORKS_COMPILE_FLAGS}"
++ "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <TARGET>_PartialImage.out <TARGET>_ctdt.c.o -o <TARGET> ${VXWORKS_DKM_LINK_FLAGS} ${VXWORKS_DKM_LINK_SCRIPT_FLAG}"
++ "${STRIPSYMS} <TARGET> ${VXWORKS_LIBSTDCXX} ${VXWORKS_LIBSUPCXX} ${VXWORKS_LIBGCC}"
++ "<CMAKE_COMMAND> -E remove <TARGET>_PartialImage.out <TARGET>_ctdt.c <TARGET>_ctdt.c.o"
++)