diff options
author | pingplug | 2015-06-12 10:05:03 +0800 |
---|---|---|
committer | pingplug | 2015-06-12 10:05:03 +0800 |
commit | 420ad195f9358c34cd6ff86b60b6239ff48671f7 (patch) | |
tree | ce0d81e7897854d7d4362edeb12d44a5ae216b9b | |
download | aur-420ad195f9358c34cd6ff86b60b6239ff48671f7.tar.gz |
Initial import
-rw-r--r-- | .SRCINFO | 30 | ||||
-rw-r--r-- | PKGBUILD | 63 | ||||
-rw-r--r-- | cmake | 237 | ||||
-rw-r--r-- | dlib-18.15.patch | 116 | ||||
-rw-r--r-- | mingw-w64-dlib.install | 9 |
5 files changed, 455 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..a27eb6b0207d --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,30 @@ +# Generated by makepkg 4.2.1 +# Fri May 8 03:04:35 UTC 2015 +pkgbase = mingw-w64-dlib + pkgdesc = Dlib is a general purpose cross-platform C++ library designed using contract programming and modern C++ techniques. (mingw-w64 with pre-build library) + pkgver = 18.15 + pkgrel = 1 + url = http://www.dlib.net/ + install = mingw-w64-dlib.install + arch = any + license = Boost Software License + makedepends = mingw-w64-gcc + makedepends = mingw-w64-cmake + depends = mingw-w64-crt + optdepends = mingw-w64-cblas: for BLAS support + optdepends = mingw-w64-lapack: for LAPACK support + optdepends = mingw-w64-libjpeg: for JPEG support + optdepends = mingw-w64-libpng: for PNG support + optdepends = mingw-w64-sqlite: for sqlite support + options = !buildflags + options = !strip + options = staticlibs + source = http://downloads.sourceforge.net/project/dclib/dlib/v18.15/dlib-18.15.tar.bz2 + source = dlib-18.15.patch + source = cmake + md5sums = 55922b2138913100634c42e36730dac7 + md5sums = f2a50bc7df3361c71b34b44641f3a52a + md5sums = c0c067d75d28a623e2036c793bc58ea2 + +pkgname = mingw-w64-dlib + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..9ee35e899d20 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,63 @@ +# Maintainer: pingplug <pingplug@foxmail.com> + +pkgname=mingw-w64-dlib +_pkgname=dlib +pkgver=18.15 +pkgrel=1 +pkgdesc="Dlib is a general purpose cross-platform C++ library designed using contract programming and modern C++ techniques. (mingw-w64 with pre-build library)" +arch=('any') +url="http://www.dlib.net/" +license=('Boost Software License') +depends=('mingw-w64-crt') +makedepends=('mingw-w64-gcc' 'mingw-w64-cmake') +optdepends=('mingw-w64-cblas: for BLAS support' + 'mingw-w64-lapack: for LAPACK support' + 'mingw-w64-libjpeg: for JPEG support' + 'mingw-w64-libpng: for PNG support' + 'mingw-w64-sqlite: for sqlite support') +options=('!buildflags' '!strip' 'staticlibs') +source=(http://downloads.sourceforge.net/project/dclib/${_pkgname}/v${pkgver}/${_pkgname}-${pkgver}.tar.bz2 + dlib-${pkgver}.patch + cmake) +md5sums=('55922b2138913100634c42e36730dac7' + 'f2a50bc7df3361c71b34b44641f3a52a' + 'c0c067d75d28a623e2036c793bc58ea2') +install=${pkgname}.install + +_architectures="i686-w64-mingw32 x86_64-w64-mingw32" + +prepare() { + cd ${srcdir} + + # fix the windres flag + # fix can't find blas and lapack + # fix a linking error while build a static binary with libpng + patch -Np0 -i dlib-${pkgver}.patch +} + +build() { + for _arch in ${_architectures}; do + mkdir -p "${srcdir}/${_pkgname}-build-${_arch}" + cd "${srcdir}/${_pkgname}-build-${_arch}" + + ${_arch}-cmake "../${_pkgname}-${pkgver}/${_pkgname}" + make + done +} + +package() { + for _arch in ${_architectures}; do + cd "${srcdir}/${_pkgname}-${pkgver}" + + mv ${_pkgname}/cmake ${_pkgname}/cmake.orig + install -Dm644 ../cmake ${_pkgname} + + install -Dm755 -d "${pkgdir}/usr/${_arch}/include" + cp -a ${_pkgname} "${pkgdir}/usr/${_arch}/include" + + cd "${srcdir}/${_pkgname}-build-${_arch}" + install -Dm755 -d "${pkgdir}/usr/${_arch}/lib" + install -Dm644 libdlib.a "${pkgdir}/usr/${_arch}/lib" + ${_arch}-strip -g "${pkgdir}/usr/${_arch}/lib/"*.a + done +} diff --git a/cmake b/cmake new file mode 100644 index 000000000000..c196f3fe0d3f --- /dev/null +++ b/cmake @@ -0,0 +1,237 @@ +# this file is written for mingw-w64-dlib package +# +# modified from CMakeLists.txt and cmake in this +# directory by pingplug<pingplug@foxmail.com> +# +# MAY NOT WORK IN OTHER LINUX DISTRIBUTIONS +# + +# make macros that can add #define directives to the entire project. Not just +# to the dlib library itself. I.e. to dlib and to any projects that depend +# on dlib. +macro ( add_global_define def_name ) + if (NOT CMAKE_CXX_FLAGS MATCHES "-D${def_name}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D${def_name}" + CACHE STRING "Flags used by the compiler during all C++ builds." + FORCE) + endif () +endmacro() +macro ( remove_global_define def_name ) + if (CMAKE_CXX_FLAGS MATCHES " -D${def_name}") + string (REGEX REPLACE " -D${def_name}" "" temp_var ${CMAKE_CXX_FLAGS}) + set (CMAKE_CXX_FLAGS "${temp_var}" + CACHE STRING "Flags used by the compiler during all C++ builds." + FORCE) + endif () +endmacro() + + +# Make sure ENABLE_ASSERTS is defined for debug builds +if (NOT CMAKE_CXX_FLAGS_DEBUG MATCHES "-DENABLE_ASSERTS") + set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLE_ASSERTS" + CACHE STRING "Flags used by the compiler during C++ debug builds." + FORCE) +endif () + + +# Don't add dlib if it's already been added to the cmake project +if (NOT TARGET dlib) + + set (USE_SYSTEM_DLIB_STR + "disable this if you want to compile dlib manually (i.e. you want a debug build of dlib)" ) + option(USE_SYSTEM_DLIB ${USE_SYSTEM_DLIB_STR} ON) + + # Determine the path to dlib. + string(REGEX REPLACE "cmake$" "" dlib_path ${CMAKE_CURRENT_LIST_FILE}) + + # By default, g++ won't warn or error if you forget to return a value in a + # function which requires you to do so. This option makes it give a warning + # for doing this. + set(${CMAKE_CXX_FLAGS} "${CMAKE_CXX_FLAGS} -Wreturn-type") + + # Setup some options to allow a user to enable SSE and AVX instruction use. + option(USE_SSE2_INSTRUCTIONS "Compile your program with SSE2 instructions" OFF) + option(USE_SSE4_INSTRUCTIONS "Compile your program with SSE4 instructions" OFF) + option(USE_AVX_INSTRUCTIONS "Compile your program with AVX instructions" OFF) + if(USE_AVX_INSTRUCTIONS) + add_definitions(-mavx) + elseif (USE_SSE4_INSTRUCTIONS) + add_definitions(-msse4) + elseif(USE_SSE2_INSTRUCTIONS) + add_definitions(-msse2) + endif() + + + # Add folder containing dlib to the include search path. + INCLUDE_DIRECTORIES(${dlib_path}/..) + + # This is really optional, but nice. It will make sure the build mode + # created by cmake is always release by default. + include(${dlib_path}/release_build_by_default) + + find_library(dlib_found dlib) + if(dlib_found AND USE_SYSTEM_DLIB) + set(USE_SYSTEM_DLIB ON) + message("Use system dlib") + else() + set(USE_SYSTEM_DLIB OFF CACHE STRING ${USE_SYSTEM_DLIB_STR} FORCE) + message("Build dlib manually") + add_subdirectory(${dlib_path} dlib_build) + endif() + +endif() + +if (NOT TARGET dlib) + + # Removed two debug options + set (DLIB_ISO_CPP_ONLY_STR + "Enable this if you don't want to compile any non-ISO C++ code (i.e. you don't use any of the API Wrappers)" ) + set (DLIB_NO_GUI_SUPPORT_STR + "Enable this if you don't want to compile any of the dlib GUI code" ) + set (DLIB_USE_BLAS_STR + "Disable this if you don't want to use a BLAS library" ) + set (DLIB_USE_LAPACK_STR + "Disable this if you don't want to use a LAPACK library" ) + set (DLIB_LINK_WITH_LIBPNG_STR + "Disable this if you don't want to link against libpng" ) + set (DLIB_LINK_WITH_LIBJPEG_STR + "Disable this if you don't want to link against libjpeg" ) + set (DLIB_LINK_WITH_SQLITE3_STR + "Disable this if you don't want to link against sqlite3" ) + #set (DLIB_LINK_WITH_FFTW_STR + #"Disable this if you don't want to link against fftw" ) + + option(DLIB_ISO_CPP_ONLY ${DLIB_ISO_CPP_ONLY_STR} OFF) + option(DLIB_NO_GUI_SUPPORT ${DLIB_NO_GUI_SUPPORT_STR} OFF) + option(DLIB_USE_BLAS ${DLIB_USE_BLAS_STR} ON) + option(DLIB_USE_LAPACK ${DLIB_USE_LAPACK_STR} ON) + option(DLIB_LINK_WITH_LIBPNG ${DLIB_LINK_WITH_LIBPNG_STR} ON) + option(DLIB_LINK_WITH_LIBJPEG ${DLIB_LINK_WITH_LIBJPEG_STR} ON) + option(DLIB_LINK_WITH_SQLITE3 ${DLIB_LINK_WITH_SQLITE3_STR} ON) + #option(DLIB_LINK_WITH_FFTW ${DLIB_LINK_WITH_FFTW_STR} ON) + + + # Removed check for headers + if (NOT DLIB_ISO_CPP_ONLY) + + if (DLIB_NO_GUI_SUPPORT) + set (dlib_needed_libraries " -lws2_32 ") + else() + set (dlib_needed_libraries " -lws2_32 -lcomctl32 -lgdi32 -limm32 ") + endif() + + if (DLIB_LINK_WITH_LIBPNG) + set(ZLIB_FIND_QUIETLY ON) + set(PNG_FIND_QUIETLY ON) + include(FindPNG) + if (PNG_FOUND) + set (dlib_needed_libraries "${dlib_needed_libraries} -lpng -lz ") + else() + set(DLIB_LINK_WITH_LIBPNG OFF CACHE STRING ${DLIB_LINK_WITH_LIBPNG_STR} FORCE ) + endif() + endif() + + if (DLIB_LINK_WITH_LIBJPEG) + include(FindJPEG) + if (JPEG_FOUND) + set (dlib_needed_libraries "${dlib_needed_libraries} -ljpeg ") + else() + set(DLIB_LINK_WITH_LIBJPEG OFF CACHE STRING ${DLIB_LINK_WITH_LIBJPEG_STR} FORCE ) + endif() + endif() + + if (DLIB_USE_BLAS) + find_library(blas_found cblas) + if (blas_found) + set (dlib_needed_libraries "${dlib_needed_libraries} -lcblas ") + else() + set(DLIB_USE_BLAS OFF CACHE STRING ${DLIB_USE_BLAS_STR} FORCE ) + endif() + endif() + + if (DLIB_USE_LAPACK) + find_library(lapack_found lapack) + if (lapack_found) + set (dlib_needed_libraries "${dlib_needed_libraries} -llapack ") + else() + set(DLIB_USE_LAPACK OFF CACHE STRING ${DLIB_USE_LAPACK_STR} FORCE ) + endif() + endif() + + if (DLIB_LINK_WITH_SQLITE3) + find_library(sqlite sqlite3) + if (sqlite) + set(dlib_needed_libraries "${dlib_needed_libraries} -lsqlite3 ") + else() + set(DLIB_LINK_WITH_SQLITE3 OFF CACHE STRING ${DLIB_LINK_WITH_SQLITE3_STR} FORCE ) + endif() + mark_as_advanced(sqlite) + endif() + + if (DLIB_LINK_WITH_FFTW) + find_library(fftw fftw3) + if (fftw) + set(dlib_needed_libraries "${dlib_needed_libraries} -lfftw3 ") + else() + set(DLIB_LINK_WITH_FFTW OFF CACHE STRING ${DLIB_LINK_WITH_SQLITE3_STR} FORCE ) + endif() + mark_as_advanced(fftw) + endif() + + set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} ${dlib_needed_libraries}") + + endif () ##### end of if NOT DLIB_ISO_CPP_ONLY ########################################################## + + + #test for some things that really should be true about the compiler + include(TestForSTDNamespace) + include(TestForANSIStreamHeaders) + + + if (DLIB_LINK_WITH_LIBPNG AND NOT DLIB_ISO_CPP_ONLY) + add_global_define(DLIB_PNG_SUPPORT) + else() + remove_global_define(DLIB_PNG_SUPPORT) + endif() + + if (DLIB_LINK_WITH_LIBJPEG AND NOT DLIB_ISO_CPP_ONLY) + add_global_define(DLIB_JPEG_SUPPORT) + else() + remove_global_define(DLIB_JPEG_SUPPORT) + endif() + + if (DLIB_LINK_WITH_FFTW AND NOT DLIB_ISO_CPP_ONLY) + add_global_define(DLIB_USE_FFTW) + else() + remove_global_define(DLIB_USE_FFTW) + endif() + + if (DLIB_USE_BLAS AND blas_found) + add_global_define(DLIB_USE_BLAS) + else() + remove_global_define(DLIB_USE_BLAS) + endif() + + if (DLIB_USE_LAPACK AND lapack_found) + add_global_define(DLIB_USE_LAPACK) + else() + remove_global_define(DLIB_USE_LAPACK) + endif() + + if (DLIB_ISO_CPP_ONLY) + add_global_define(DLIB_ISO_CPP_ONLY) + else() + remove_global_define(DLIB_ISO_CPP_ONLY) + endif() + + if (DLIB_NO_GUI_SUPPORT) + add_global_define(DLIB_NO_GUI_SUPPORT) + else() + remove_global_define(DLIB_NO_GUI_SUPPORT) + endif() + + remove_global_define(DLIB_ENABLE_STACK_TRACE) + remove_global_define(ENABLE_ASSERTS) + +endif() + diff --git a/dlib-18.15.patch b/dlib-18.15.patch new file mode 100644 index 000000000000..b91e9bee3363 --- /dev/null +++ b/dlib-18.15.patch @@ -0,0 +1,116 @@ +diff -ruN dlib-18.15/dlib/cmake dlib-18.15-fixed/dlib/cmake +--- dlib-18.15/dlib/cmake 2015-05-08 04:39:21.000000000 +0800 ++++ dlib-18.15-fixed/dlib/cmake 2015-05-08 17:08:26.328545784 +0800 +@@ -16,7 +16,7 @@ + # By default, g++ won't warn or error if you forget to return a value in a + # function which requires you to do so. This option makes it give a warning + # for doing this. +- add_definitions("-Wreturn-type") ++ set(${CMAKE_CXX_FLAGS} "${CMAKE_CXX_FLAGS} -Wreturn-type") + endif() + + # Setup some options to allow a user to enable SSE and AVX instruction use. +diff -ruN dlib-18.15/dlib/cmake_find_blas.txt dlib-18.15-fixed/dlib/cmake_find_blas.txt +--- dlib-18.15/dlib/cmake_find_blas.txt 2015-05-08 04:39:21.000000000 +0800 ++++ dlib-18.15-fixed/dlib/cmake_find_blas.txt 2015-05-08 17:08:26.331879117 +0800 +@@ -261,6 +261,89 @@ + endif() + + ++elseif(WIN32 AND CMAKE_CROSSCOMPILING) ++ ++ message(STATUS "Searching for BLAS and LAPACK") ++ ++ # try to find LAPACK libraries while cross compiling ++ set(extra_paths ++ /usr/i686-w64-mingw32/lib ++ /usr/i686-w64-mingw32/lib/atlas-sse3 ++ /usr/i686-w64-mingw32/lib/atlas-sse2 ++ /usr/i686-w64-mingw32/lib/atlas ++ /usr/x86_64-w64-mingw32/lib ++ /usr/x86_64-w64-mingw32/lib/atlas-sse3 ++ /usr/x86_64-w64-mingw32/lib/atlas-sse2 ++ /usr/x86_64-w64-mingw32/lib/atlas) ++ ++ if (NOT lapack_found) ++ find_library(lapack_lib NAMES lapack lapack-3 PATHS ${extra_paths}) ++ if (lapack_lib) ++ set(lapack_libraries ${lapack_lib}) ++ set(lapack_found 1) ++ message(STATUS "Found LAPACK library") ++ endif() ++ mark_as_advanced( lapack_lib) ++ endif() ++ ++ # try to find some other BLAS libraries if we didn't find the MKL ++ ++ if (NOT blas_found) ++ find_library(atlas_lib atlas PATHS ${extra_paths}) ++ find_library(cblas_lib cblas PATHS ${extra_paths}) ++ if (atlas_lib AND cblas_lib) ++ set(blas_libraries ${atlas_lib} ${cblas_lib}) ++ set(blas_found 1) ++ message(STATUS "Found ATLAS BLAS library") ++ endif() ++ mark_as_advanced( atlas_lib cblas_lib) ++ endif() ++ ++ if (NOT blas_found) ++ find_library(cblas_lib cblas PATHS ${extra_paths}) ++ if (cblas_lib) ++ set(blas_libraries ${cblas_lib}) ++ set(blas_found 1) ++ message(STATUS "Found CBLAS library") ++ endif() ++ mark_as_advanced( cblas_lib) ++ endif() ++ ++ if (NOT blas_found) ++ find_library(generic_blas blas PATHS ${extra_paths}) ++ if (generic_blas) ++ set(blas_libraries ${generic_blas}) ++ set(blas_found 1) ++ message(STATUS "Found BLAS library") ++ endif() ++ mark_as_advanced( generic_blas) ++ endif() ++ ++ # Make sure we really found a CBLAS library. That is, it needs to expose ++ # the proper cblas link symbols. So here we test if one of them is present ++ # and assume everything is good if it is. Note that we don't do this check if ++ # we found the Intel MKL since for some reason CHECK_FUNCTION_EXISTS doesn't work ++ # with it. But it's fine since the MKL should always have cblas. ++ if (blas_found AND NOT found_intel_mkl) ++ INCLUDE (CheckFunctionExists) ++ set(CMAKE_REQUIRED_LIBRARIES ${blas_libraries}) ++ CHECK_FUNCTION_EXISTS(cblas_ddot HAVE_CBLAS) ++ if (NOT HAVE_CBLAS) ++ message(STATUS "BLAS library does not have cblas symbols, so dlib will not use BLAS or LAPACK") ++ set(blas_found 0) ++ set(lapack_found 0) ++ endif() ++ endif() ++ ++ if (NOT blas_found) ++ message(" *****************************************************************************") ++ message(" *** No BLAS library found so using dlib's built in BLAS. However, if you ***") ++ message(" *** install an optimized BLAS such as openblas or the Intel MKL your code ***") ++ message(" *** will run faster. On Ubuntu you can install openblas by executing: ***") ++ message(" *** sudo apt-get install libopenblas-dev liblapack-dev ***") ++ message(" *****************************************************************************") ++ endif() ++ + endif() + + +diff -ruN dlib-18.15/dlib/CMakeLists.txt dlib-18.15-fixed/dlib/CMakeLists.txt +--- dlib-18.15/dlib/CMakeLists.txt 2015-05-08 04:39:21.000000000 +0800 ++++ dlib-18.15-fixed/dlib/CMakeLists.txt 2015-05-08 17:08:26.331879117 +0800 +@@ -227,6 +227,7 @@ + if (PNG_FOUND AND LIBPNG_IS_GOOD) + include_directories(${PNG_INCLUDE_DIR}) + set (dlib_needed_libraries ${dlib_needed_libraries} ${PNG_LIBRARY}) ++ set (dlib_needed_libraries ${dlib_needed_libraries} ${ZLIB_LIBRARY}) + else() + # If we can't find libpng then statically compile it in. + include_directories(external/libpng external/zlib) diff --git a/mingw-w64-dlib.install b/mingw-w64-dlib.install new file mode 100644 index 000000000000..c267fa2824a0 --- /dev/null +++ b/mingw-w64-dlib.install @@ -0,0 +1,9 @@ +post_install() { + echo "*****************************************" + echo "** The cmake file has been modified to **" + echo "** work with the pre-build library. **" + echo "** The original file has been renamed **" + echo "** to cmake.orig **" + echo "*****************************************" +} + |