From faf63392220fbb1d9e9d431cf72767b0102f1cfa Mon Sep 17 00:00:00 2001 From: beefcurtains Date: Mon, 29 Jun 2015 13:30:25 +0000 Subject: [PATCH] tidy5: allow cross compilation --- srcpkgs/tidy5/patches/allow-cross.patch | 20 ++++++++++++++++++++ srcpkgs/tidy5/patches/link-dynlib.patch | 8 ++++++-- srcpkgs/tidy5/template | 17 ++++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/tidy5/patches/allow-cross.patch diff --git a/srcpkgs/tidy5/patches/allow-cross.patch b/srcpkgs/tidy5/patches/allow-cross.patch new file mode 100644 index 00000000000..00513a1bf52 --- /dev/null +++ b/srcpkgs/tidy5/patches/allow-cross.patch @@ -0,0 +1,20 @@ +--- CMakeLists.txt.orig ++++ CMakeLists.txt +@@ -201,7 +201,7 @@ + # run built EXE to generate xml output + add_custom_command( + TARGET man +- COMMAND ${CMAKE_BINARY_DIR}/${LIB_NAME} -xml-help > ${TIDYHELP} ++ COMMAND ${CMAKE_SOURCE_DIR}/tidy5 -xml-help > ${TIDYHELP} + COMMENT "Generate ${TIDYHELP}" + VERBATIM + ) +@@ -209,7 +209,7 @@ + # run built EXE to generate more xml output + add_custom_command( + TARGET man +- COMMAND ${CMAKE_BINARY_DIR}/${LIB_NAME} -xml-config > ${TIDYCONFIG} ++ COMMAND ${CMAKE_SOURCE_DIR}/tidy5 -xml-config > ${TIDYCONFIG} + COMMENT "Generate ${TIDYCONFIG}" + VERBATIM + ) diff --git a/srcpkgs/tidy5/patches/link-dynlib.patch b/srcpkgs/tidy5/patches/link-dynlib.patch index 7c57574ddfd..e3c584b1573 100644 --- a/srcpkgs/tidy5/patches/link-dynlib.patch +++ b/srcpkgs/tidy5/patches/link-dynlib.patch @@ -1,11 +1,15 @@ --- CMakeLists.txt.orig +++ CMakeLists.txt -@@ -157,7 +157,7 @@ +@@ -157,7 +157,11 @@ set(name ${LIB_NAME}) set ( BINDIR console ) add_executable( ${name} ${BINDIR}/tidy.c ) -target_link_libraries( ${name} ${add_LIBS} ) -+target_link_libraries( ${name} tidy-share ) ++if (BUILD_SHARED_LIB) ++ target_link_libraries( ${name} tidy-share ) ++else() ++ target_link_libraries( ${name} tidy-static ) ++endif() if (MSVC) set_target_properties( ${name} PROPERTIES DEBUG_POSTFIX d ) endif () diff --git a/srcpkgs/tidy5/template b/srcpkgs/tidy5/template index 7a8acd8beb6..f047633589d 100644 --- a/srcpkgs/tidy5/template +++ b/srcpkgs/tidy5/template @@ -15,7 +15,22 @@ license="W3C" homepage="http://www.htacg.org/${_reponame}/" distfiles="https://github.com/htacg/${_reponame}/archive/${version}.tar.gz" checksum=569c23f9028e28ca5dd2020116dec01d2e43e0c698fdf9d0f6e599878495386d -nocross=yes + +pre_configure() { + # the $(man) target requires tidy5 to run on the host + ln -s ${cmake_builddir}/${pkgname} + if [ -n "$CROSS_BUILD" ]; then + rm ${pkgname} + cd ${cmake_builddir} + + env - PATH=/usr/bin cmake -DBUILD_SHARED_LIB:BOOL=FALSE ${wrksrc} + make ${makejobs} ${pkgname} + + cp ${pkgname} ${wrksrc} + cd ${wrksrc} + rm -rf ${cmake_builddir} + fi +} post_install() { vlicense LICENSE.txt LICENSE