diff options
47 files changed, 915 insertions, 752 deletions
| @@ -1,2 +1,51 @@ | |||
| 1 | *.swp | 1 | *.swp |
| 2 | build/* | 2 | *.o |
| 3 | *.lo | ||
| 4 | *.la | ||
| 5 | *.pc | ||
| 6 | *.log | ||
| 7 | *.exe | ||
| 8 | configure | ||
| 9 | Makefile | ||
| 10 | Makefile.in | ||
| 11 | aclocal.m4 | ||
| 12 | autom4te.cache | ||
| 13 | compile | ||
| 14 | config.* | ||
| 15 | depcomp | ||
| 16 | doxygen.cfg | ||
| 17 | install-sh | ||
| 18 | libtool | ||
| 19 | ltmain.sh | ||
| 20 | missing | ||
| 21 | stamp-h1 | ||
| 22 | m4/libtool.m4 | ||
| 23 | m4/ltoptions.m4 | ||
| 24 | m4/ltsugar.m4 | ||
| 25 | m4/ltversion.m4 | ||
| 26 | m4/lt~obsolete.m4 | ||
| 27 | src/Makefile | ||
| 28 | src/Makefile.in | ||
| 29 | src/.libs | ||
| 30 | src/.deps | ||
| 31 | include/Makefile | ||
| 32 | include/Makefile.in | ||
| 33 | libcnary/Makefile | ||
| 34 | libcnary/Makefile.in | ||
| 35 | libcnary/.libs | ||
| 36 | libcnary/.deps | ||
| 37 | tools/Makefile | ||
| 38 | tools/Makefile.in | ||
| 39 | tools/.libs | ||
| 40 | tools/.deps | ||
| 41 | tools/plistutil | ||
| 42 | test/Makefile | ||
| 43 | test/Makefile.in | ||
| 44 | test/.libs | ||
| 45 | test/.deps | ||
| 46 | test/plist_cmp | ||
| 47 | test/plist_test | ||
| 48 | test/data/*.out | ||
| 49 | cython/Makefile | ||
| 50 | cython/Makefile.in | ||
| 51 | cython/.deps | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index e55bb29..0000000 --- a/CMakeLists.txt +++ /dev/null | |||
| @@ -1,83 +0,0 @@ | |||
| 1 | PROJECT( libplist ) | ||
| 2 | |||
| 3 | SET( LIBPLIST_VERSION_MAJOR "1" ) | ||
| 4 | SET( LIBPLIST_VERSION_MINOR "10" ) | ||
| 5 | SET( LIBPLIST_SOVERSION "1" ) | ||
| 6 | SET( LIBPLIST_VERSION "${LIBPLIST_VERSION_MAJOR}.${LIBPLIST_VERSION_MINOR}" ) | ||
| 7 | SET( LIBPLIST_LIBVERSION "${LIBPLIST_SOVERSION}.${LIBPLIST_VERSION}" ) | ||
| 8 | SET( PLISTUTIL_VERSION ${LIBPLIST_VERSION} ) | ||
| 9 | |||
| 10 | SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/cmake/modules ) | ||
| 11 | |||
| 12 | cmake_minimum_required(VERSION 2.6) | ||
| 13 | |||
| 14 | IF(NOT DEFINED CMAKE_INSTALL_LIBDIR) | ||
| 15 | SET(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Output directory for libraries") | ||
| 16 | ENDIF(NOT DEFINED CMAKE_INSTALL_LIBDIR) | ||
| 17 | |||
| 18 | FIND_PACKAGE( LibXml2 REQUIRED ) | ||
| 19 | |||
| 20 | OPTION(ENABLE_SWIG "Enable SWIG Python bindings (needs Swig)" ON) | ||
| 21 | OPTION(ENABLE_CYTHON "Enable Cython Python bindings (needs Cython)" ON) | ||
| 22 | |||
| 23 | IF(ENABLE_SWIG) | ||
| 24 | FIND_PACKAGE( SWIG ) | ||
| 25 | ENDIF(ENABLE_SWIG) | ||
| 26 | |||
| 27 | IF(ENABLE_CYTHON) | ||
| 28 | FIND_PACKAGE( Cython ) | ||
| 29 | ENDIF(ENABLE_CYTHON) | ||
| 30 | |||
| 31 | IF(ENABLE_SWIG OR ENABLE_CYTHON) | ||
| 32 | FIND_PACKAGE( PythonInterp ) | ||
| 33 | FIND_PACKAGE( PythonLibs ) | ||
| 34 | ENDIF(ENABLE_SWIG OR ENABLE_CYTHON) | ||
| 35 | |||
| 36 | INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/include | ||
| 37 | ${CMAKE_INCLUDE_PATH}) | ||
| 38 | |||
| 39 | ENABLE_TESTING() | ||
| 40 | |||
| 41 | IF (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libcnary/CMakeLists.txt") | ||
| 42 | MESSAGE(FATAL_ERROR " | ||
| 43 | You need to checkout the 'libcnary' submodule to build libplist. | ||
| 44 | To do so, perform the following steps in the base directory: | ||
| 45 | git submodule init | ||
| 46 | git submodule update | ||
| 47 | Then, run cmake again.") | ||
| 48 | ENDIF() | ||
| 49 | |||
| 50 | INCLUDE (TestBigEndian) | ||
| 51 | TEST_BIG_ENDIAN(endianess) | ||
| 52 | SET ( PLIST_BYTE_ORDER ${endianess} ) | ||
| 53 | |||
| 54 | ADD_SUBDIRECTORY( libcnary ) | ||
| 55 | ADD_SUBDIRECTORY( src ) | ||
| 56 | ADD_SUBDIRECTORY( plistutil ) | ||
| 57 | ADD_SUBDIRECTORY( include ) | ||
| 58 | ADD_SUBDIRECTORY( test ) | ||
| 59 | |||
| 60 | ADD_DEPENDENCIES( plist libcnary ) | ||
| 61 | |||
| 62 | IF ( SWIG_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND ) | ||
| 63 | ADD_SUBDIRECTORY( swig ) | ||
| 64 | ENDIF ( SWIG_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND ) | ||
| 65 | IF ( CYTHON_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND ) | ||
| 66 | ADD_SUBDIRECTORY( cython ) | ||
| 67 | ENDIF ( CYTHON_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND ) | ||
| 68 | |||
| 69 | # add uninstall target | ||
| 70 | CONFIGURE_FILE( "${CMAKE_SOURCE_DIR}/cmake/modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) | ||
| 71 | ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") | ||
| 72 | |||
| 73 | ########## PkgConfig ############################ | ||
| 74 | CONFIGURE_FILE( "libplist.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libplist.pc" ) | ||
| 75 | CONFIGURE_FILE( "libplist++.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libplist++.pc" ) | ||
| 76 | |||
| 77 | ########## INSTALL ############################## | ||
| 78 | INSTALL( FILES "${CMAKE_CURRENT_BINARY_DIR}/libplist.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ ) | ||
| 79 | INSTALL( FILES "${CMAKE_CURRENT_BINARY_DIR}/libplist++.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ ) | ||
| 80 | |||
| 81 | ########## CPack ################################ | ||
| 82 | INCLUDE( libplistPackaging ) | ||
| 83 | LIBPLIST_PACKAGE(LIBPLIST_VERSION_MAJOR LIBPLIST_VERSION_MINOR) | ||
diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..e80743a --- /dev/null +++ b/Makefile.am | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | AUTOMAKE_OPTIONS = foreign | ||
| 2 | ACLOCAL_AMFLAGS = -I m4 | ||
| 3 | SUBDIRS = libcnary src include tools $(CYTHON_SUB) test | ||
diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..3292973 --- /dev/null +++ b/autogen.sh | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | gprefix=`which glibtoolize 2>&1 >/dev/null` | ||
| 3 | if [ $? -eq 0 ]; then | ||
| 4 | glibtoolize --force | ||
| 5 | else | ||
| 6 | libtoolize --force | ||
| 7 | fi | ||
| 8 | aclocal -I m4 | ||
| 9 | autoheader | ||
| 10 | automake --add-missing | ||
| 11 | autoconf | ||
| 12 | |||
| 13 | if [ -z "$NOCONFIGURE" ]; then | ||
| 14 | ./configure "$@" | ||
| 15 | fi | ||
diff --git a/cmake/libplistPackaging.cmake b/cmake/libplistPackaging.cmake deleted file mode 100644 index fbd865f..0000000 --- a/cmake/libplistPackaging.cmake +++ /dev/null | |||
| @@ -1,15 +0,0 @@ | |||
| 1 | MACRO( LIBPLIST_PACKAGE _major _minor) | ||
| 2 | |||
| 3 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Library to parse and generate Apple's binary and XML PList format") | ||
| 4 | SET(CPACK_PACKAGE_VERSION_MAJOR ${_major}) | ||
| 5 | SET(CPACK_PACKAGE_VERSION_MINOR ${_minor}) | ||
| 6 | SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") | ||
| 7 | SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.LESSER") | ||
| 8 | SET(CPACK_COMPONENT_LIB_DISPLAY_NAME "PList library") | ||
| 9 | SET(CPACK_COMPONENT_DEV_DISPLAY_NAME "PList development files") | ||
| 10 | SET(CPACK_COMPONENT_PLISTUTIL_DISPLAY_NAME "PList conversion tool") | ||
| 11 | set(CPACK_COMPONENT_DEV_DEPENDS lib) | ||
| 12 | set(CPACK_COMPONENT_PLISTUTIL_DEPENDS lib) | ||
| 13 | INCLUDE( CPack ) | ||
| 14 | |||
| 15 | ENDMACRO( LIBPLIST_PACKAGE ) | ||
diff --git a/cmake/modules/FindCython.cmake b/cmake/modules/FindCython.cmake deleted file mode 100644 index 89005b7..0000000 --- a/cmake/modules/FindCython.cmake +++ /dev/null | |||
| @@ -1,10 +0,0 @@ | |||
| 1 | FIND_PROGRAM(CYTHON_EXECUTABLE cython) | ||
| 2 | |||
| 3 | INCLUDE(FindPackageHandleStandardArgs) | ||
| 4 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cython DEFAULT_MSG CYTHON_EXECUTABLE) | ||
| 5 | |||
| 6 | MARK_AS_ADVANCED(CYTHON_EXECUTABLE) | ||
| 7 | |||
| 8 | IF(CYTHON_FOUND) | ||
| 9 | SET(CYTHON_USE_FILE ${CMAKE_SOURCE_DIR}/cmake/modules/UseCython.cmake) | ||
| 10 | ENDIF(CYTHON_FOUND) | ||
diff --git a/cmake/modules/FindGLIB2.cmake b/cmake/modules/FindGLIB2.cmake deleted file mode 100644 index 226d551..0000000 --- a/cmake/modules/FindGLIB2.cmake +++ /dev/null | |||
| @@ -1,51 +0,0 @@ | |||
| 1 | # - Try to find the GLIB2 libraries | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # GLIB2_FOUND - system has glib2 | ||
| 5 | # GLIB2_INCLUDE_DIR - the glib2 include directory | ||
| 6 | # GLIB2_LIBRARIES - glib2 library | ||
| 7 | |||
| 8 | # Copyright (c) 2008 Laurent Montel, <montel@kde.org> | ||
| 9 | # | ||
| 10 | # Redistribution and use is allowed according to the terms of the BSD license. | ||
| 11 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
| 12 | |||
| 13 | |||
| 14 | if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES) | ||
| 15 | # Already in cache, be silent | ||
| 16 | set(GLIB2_FIND_QUIETLY TRUE) | ||
| 17 | endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES) | ||
| 18 | |||
| 19 | if (NOT WIN32) | ||
| 20 | FIND_PACKAGE(PkgConfig) | ||
| 21 | PKG_CHECK_MODULES(PC_GLIB2 glib-2.0) | ||
| 22 | SET(GLIB2_DEFINITIONS ${PC_GLIB2_CFLAGS_OTHER}) | ||
| 23 | endif(NOT WIN32) | ||
| 24 | |||
| 25 | find_path(GLIB2_MAIN_INCLUDE_DIR glib.h | ||
| 26 | PATH_SUFFIXES glib-2.0 | ||
| 27 | PATHS ${_LibGLIB2IncDir} ) | ||
| 28 | |||
| 29 | # search the glibconfig.h include dir under the same root where the library is found | ||
| 30 | find_library(GLIB2_LIBRARIES | ||
| 31 | NAMES glib-2.0 | ||
| 32 | PATHS ${_LibGLIB2LinkDir} ) | ||
| 33 | |||
| 34 | get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH) | ||
| 35 | |||
| 36 | find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h | ||
| 37 | PATH_SUFFIXES glib-2.0/include | ||
| 38 | PATHS ${_LibGLIB2IncDir} "${glib2LibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH}) | ||
| 39 | |||
| 40 | set(GLIB2_INCLUDE_DIR "${GLIB2_MAIN_INCLUDE_DIR}") | ||
| 41 | |||
| 42 | # not sure if this include dir is optional or required | ||
| 43 | # for now it is optional | ||
| 44 | if(GLIB2_INTERNAL_INCLUDE_DIR) | ||
| 45 | set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} "${GLIB2_INTERNAL_INCLUDE_DIR}") | ||
| 46 | endif(GLIB2_INTERNAL_INCLUDE_DIR) | ||
| 47 | |||
| 48 | include(FindPackageHandleStandardArgs) | ||
| 49 | find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR) | ||
| 50 | |||
| 51 | mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES) \ No newline at end of file | ||
diff --git a/cmake/modules/FindLibXml2.cmake b/cmake/modules/FindLibXml2.cmake deleted file mode 100644 index 8d3c77e..0000000 --- a/cmake/modules/FindLibXml2.cmake +++ /dev/null | |||
| @@ -1,57 +0,0 @@ | |||
| 1 | # - Try to find LibXml2 | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # LIBXML2_FOUND - System has LibXml2 | ||
| 5 | # LIBXML2_INCLUDE_DIR - The LibXml2 include directory | ||
| 6 | # LIBXML2_LIBRARIES - The libraries needed to use LibXml2 | ||
| 7 | # LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2 | ||
| 8 | # LIBXML2_XMLLINT_EXECUTABLE - The XML checking tool xmllint coming with LibXml2 | ||
| 9 | |||
| 10 | # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> | ||
| 11 | # | ||
| 12 | # Redistribution and use is allowed according to the terms of the BSD license. | ||
| 13 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
| 14 | |||
| 15 | |||
| 16 | IF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES) | ||
| 17 | # in cache already | ||
| 18 | SET(LibXml2_FIND_QUIETLY TRUE) | ||
| 19 | ENDIF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES) | ||
| 20 | |||
| 21 | IF (NOT WIN32) | ||
| 22 | # use pkg-config to get the directories and then use these values | ||
| 23 | # in the FIND_PATH() and FIND_LIBRARY() calls | ||
| 24 | FIND_PACKAGE(PkgConfig) | ||
| 25 | PKG_CHECK_MODULES(PC_LIBXML libxml-2.0) | ||
| 26 | SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER}) | ||
| 27 | ENDIF (NOT WIN32) | ||
| 28 | |||
| 29 | FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xpath.h | ||
| 30 | HINTS | ||
| 31 | ${PC_LIBXML_INCLUDEDIR} | ||
| 32 | ${PC_LIBXML_INCLUDE_DIRS} | ||
| 33 | PATH_SUFFIXES libxml2 | ||
| 34 | ) | ||
| 35 | |||
| 36 | FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2 | ||
| 37 | HINTS | ||
| 38 | ${PC_LIBXML_LIBDIR} | ||
| 39 | ${PC_LIBXML_LIBRARY_DIRS} | ||
| 40 | ) | ||
| 41 | |||
| 42 | FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint) | ||
| 43 | # for backwards compat. with KDE 4.0.x: | ||
| 44 | SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}") | ||
| 45 | |||
| 46 | IF( NOT LIBXML2_XMLLINT_EXECUTABLE ) | ||
| 47 | MESSAGE(STATUS "xmllint program not found. Install it if you want validate generated doc file.") | ||
| 48 | ENDIF(NOT LIBXML2_XMLLINT_EXECUTABLE ) | ||
| 49 | |||
| 50 | |||
| 51 | INCLUDE(FindPackageHandleStandardArgs) | ||
| 52 | |||
| 53 | # handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if | ||
| 54 | # all listed variables are TRUE | ||
| 55 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) | ||
| 56 | |||
| 57 | MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE) | ||
diff --git a/cmake/modules/cmake_uninstall.cmake.in b/cmake/modules/cmake_uninstall.cmake.in deleted file mode 100644 index 4bfb0bf..0000000 --- a/cmake/modules/cmake_uninstall.cmake.in +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | ||
| 2 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") | ||
| 3 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | ||
| 4 | |||
| 5 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) | ||
| 6 | STRING(REGEX REPLACE "\n" ";" files "${files}") | ||
| 7 | FOREACH(file ${files}) | ||
| 8 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") | ||
| 9 | IF(EXISTS "$ENV{DESTDIR}${file}") | ||
| 10 | EXEC_PROGRAM( | ||
| 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" | ||
| 12 | OUTPUT_VARIABLE rm_out | ||
| 13 | RETURN_VALUE rm_retval | ||
| 14 | ) | ||
| 15 | IF(NOT "${rm_retval}" STREQUAL 0) | ||
| 16 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") | ||
| 17 | ENDIF(NOT "${rm_retval}" STREQUAL 0) | ||
| 18 | ELSE(EXISTS "$ENV{DESTDIR}${file}") | ||
| 19 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") | ||
| 20 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") | ||
| 21 | ENDFOREACH(file) | ||
diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..d59f8a7 --- /dev/null +++ b/configure.ac | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | # -*- Autoconf -*- | ||
| 2 | # Process this file with autoconf to produce a configure script. | ||
| 3 | |||
| 4 | AC_PREREQ(2.61) | ||
| 5 | AC_INIT(libplist, 1.11, nospam@nowhere.com) | ||
| 6 | AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip]) | ||
| 7 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) | ||
| 8 | AC_CONFIG_SRCDIR([src/]) | ||
| 9 | AC_CONFIG_HEADERS([config.h]) | ||
| 10 | AC_CONFIG_MACRO_DIR([m4]) | ||
| 11 | |||
| 12 | dnl libtool versioning | ||
| 13 | # +1 : 0 : +1 == adds new functions to the interface | ||
| 14 | # +1 : 0 : 0 == changes or removes functions (changes include both | ||
| 15 | # changes to the signature and the semantic) | ||
| 16 | # ? :+1 : ? == just internal changes | ||
| 17 | # CURRENT : REVISION : AGE | ||
| 18 | LIBPLIST_SO_VERSION=2:0:0 | ||
| 19 | |||
| 20 | AC_SUBST(LIBPLIST_SO_VERSION) | ||
| 21 | |||
| 22 | dnl Minimum package versions | ||
| 23 | LIBXML2_VERSION=2.8.0 | ||
| 24 | |||
| 25 | AC_SUBST(LIBXML2_VERSION) | ||
| 26 | |||
| 27 | # Checks for programs. | ||
| 28 | AC_PROG_CC | ||
| 29 | AC_PROG_CXX | ||
| 30 | AM_PROG_CC_C_O | ||
| 31 | AC_PROG_LIBTOOL | ||
| 32 | |||
| 33 | # Checks for libraries. | ||
| 34 | PKG_CHECK_MODULES(libxml2, libxml-2.0 >= $LIBXML2_VERSION) | ||
| 35 | |||
| 36 | # Checks for header files. | ||
| 37 | AC_HEADER_STDC | ||
| 38 | AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) | ||
| 39 | |||
| 40 | # Checks for typedefs, structures, and compiler characteristics. | ||
| 41 | AC_C_CONST | ||
| 42 | AC_TYPE_SIZE_T | ||
| 43 | AC_TYPE_SSIZE_T | ||
| 44 | AC_TYPE_UINT16_T | ||
| 45 | AC_TYPE_UINT32_T | ||
| 46 | AC_TYPE_UINT8_T | ||
| 47 | |||
| 48 | # Checks for library functions. | ||
| 49 | AC_CHECK_FUNCS([asprintf strcasecmp strdup strerror strndup stpcpy vasprintf]) | ||
| 50 | |||
| 51 | AC_CHECK_HEADER(endian.h, [ac_cv_have_endian_h="yes"], [ac_cv_have_endian_h="no"]) | ||
| 52 | if test "x$ac_cv_have_endian_h" = "xno"; then | ||
| 53 | AC_DEFINE(__LITTLE_ENDIAN,1234,[little endian]) | ||
| 54 | AC_DEFINE(__BIG_ENDIAN,4321,[big endian]) | ||
| 55 | AC_C_BIGENDIAN([ac_cv_c_bigendian="yes"], [ac_cv_c_bigendian="no"], [], []) | ||
| 56 | if test "x$ac_cv_c_bigendian" = "xyes"; then | ||
| 57 | AC_DEFINE(__BYTE_ORDER,4321,[big endian byte order]) | ||
| 58 | else | ||
| 59 | AC_DEFINE(__BYTE_ORDER,1234,[little endian byte order]) | ||
| 60 | fi | ||
| 61 | fi | ||
| 62 | |||
| 63 | # Check for operating system | ||
| 64 | AC_MSG_CHECKING([whether to enable WIN32 build settings]) | ||
| 65 | case ${host_os} in | ||
| 66 | *mingw32*|*cygwin*) | ||
| 67 | win32=true | ||
| 68 | AC_MSG_RESULT([yes]) | ||
| 69 | AC_SUBST(WINDRES) | ||
| 70 | ;; | ||
| 71 | *) | ||
| 72 | win32=false | ||
| 73 | AC_MSG_RESULT([no]) | ||
| 74 | ;; | ||
| 75 | esac | ||
| 76 | AM_CONDITIONAL(WIN32, test x$win32 = xtrue) | ||
| 77 | |||
| 78 | # Cython Python Bindings | ||
| 79 | AC_ARG_WITH([cython], | ||
| 80 | [AS_HELP_STRING([--without-cython], | ||
| 81 | [build Python bindings using Cython (default is yes)])], | ||
| 82 | [build_cython=false], | ||
| 83 | [build_cython=true]) | ||
| 84 | if test "$build_cython" = "true"; then | ||
| 85 | AM_PATH_PYTHON(2.3) | ||
| 86 | AC_PROG_CYTHON(0.17.0) | ||
| 87 | CYTHON_PYTHON | ||
| 88 | else | ||
| 89 | CYTHON=false | ||
| 90 | fi | ||
| 91 | if [test "x$CYTHON" != "xfalse"]; then | ||
| 92 | AC_MSG_CHECKING([for libplist Cython bindings]) | ||
| 93 | CYTHON_PLIST_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir libplist)/plist/cython | ||
| 94 | if [test ! -d "$CYTHON_PLIST_INCLUDE_DIR"]; then | ||
| 95 | CYTHON=false | ||
| 96 | CYTHON_SUB= | ||
| 97 | cython_python_bindings=no | ||
| 98 | AC_MSG_RESULT([no]) | ||
| 99 | AC_MSG_WARN([cannot find libplist Cython bindings. You should install your distribution specific libplist Cython bindings package.]) | ||
| 100 | else | ||
| 101 | AC_SUBST([CYTHON_PLIST_INCLUDE_DIR]) | ||
| 102 | AC_MSG_RESULT([$CYTHON_PLIST_INCLUDE_DIR]) | ||
| 103 | CYTHON_SUB=cython | ||
| 104 | cython_python_bindings=yes | ||
| 105 | fi | ||
| 106 | else | ||
| 107 | CYTHON_SUB= | ||
| 108 | cython_python_bindings=no | ||
| 109 | fi | ||
| 110 | AM_CONDITIONAL([HAVE_CYTHON],[test "x$CYTHON_SUB" = "xcython"]) | ||
| 111 | AC_SUBST([CYTHON_SUB]) | ||
| 112 | |||
| 113 | AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter") | ||
| 114 | AC_SUBST(GLOBAL_CFLAGS) | ||
| 115 | |||
| 116 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) | ||
| 117 | |||
| 118 | AC_OUTPUT([ | ||
| 119 | Makefile | ||
| 120 | libcnary/Makefile | ||
| 121 | src/Makefile | ||
| 122 | include/Makefile | ||
| 123 | tools/Makefile | ||
| 124 | cython/Makefile | ||
| 125 | test/Makefile | ||
| 126 | libplist.pc | ||
| 127 | libplist++.pc | ||
| 128 | doxygen.cfg | ||
| 129 | ]) | ||
| 130 | |||
| 131 | echo " | ||
| 132 | Configuration for $PACKAGE $VERSION: | ||
| 133 | ------------------------------------------- | ||
| 134 | |||
| 135 | Install prefix: .........: $prefix | ||
| 136 | Python bindings .........: $cython_python_bindings | ||
| 137 | |||
| 138 | Now type 'make' to build $PACKAGE $VERSION, | ||
| 139 | and then 'make install' for installation. | ||
| 140 | " | ||
diff --git a/cython/CMakeLists.txt b/cython/CMakeLists.txt deleted file mode 100644 index eac6bee..0000000 --- a/cython/CMakeLists.txt +++ /dev/null | |||
| @@ -1,30 +0,0 @@ | |||
| 1 | |||
| 2 | INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} ${CMAKE_CURRENT_SOURCE_DIR} ) | ||
| 3 | |||
| 4 | |||
| 5 | SET(plist_SRC | ||
| 6 | ${CMAKE_CURRENT_BINARY_DIR}/plist.c ) | ||
| 7 | |||
| 8 | SET(plist_HDR | ||
| 9 | ${CMAKE_CURRENT_SOURCE_DIR}/plist.pxd ) | ||
| 10 | |||
| 11 | ADD_CUSTOM_COMMAND( | ||
| 12 | OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plist.c | ||
| 13 | COMMAND ${CYTHON_EXECUTABLE} -o ${CMAKE_CURRENT_BINARY_DIR}/plist.c ${CMAKE_CURRENT_SOURCE_DIR}/plist.pyx | ||
| 14 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/plist.pyx ${CMAKE_CURRENT_SOURCE_DIR}/plist.pxd | ||
| 15 | ) | ||
| 16 | |||
| 17 | |||
| 18 | EXEC_PROGRAM("${PYTHON_EXECUTABLE}" | ||
| 19 | ARGS "-c 'try:\n import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1,0,\"${CMAKE_INSTALL_PREFIX}\")\nexcept: pass\n'" | ||
| 20 | OUTPUT_VARIABLE DISTUTILS_PYTHON_ILIBRARY_PATH | ||
| 21 | ) | ||
| 22 | |||
| 23 | PYTHON_ADD_MODULE(cython_plist plist.c plist_util.c) | ||
| 24 | SET_TARGET_PROPERTIES(cython_plist PROPERTIES PREFIX "" OUTPUT_NAME plist) | ||
| 25 | TARGET_LINK_LIBRARIES(cython_plist plist ${PYTHON_LIBRARIES}) | ||
| 26 | |||
| 27 | INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/plist${CMAKE_SHARED_MODULE_SUFFIX} | ||
| 28 | DESTINATION ${DISTUTILS_PYTHON_ILIBRARY_PATH} ) | ||
| 29 | INSTALL( FILES ${CMAKE_CURRENT_SOURCE_DIR}/plist.pxd | ||
| 30 | DESTINATION include/plist/cython COMPONENT dev) | ||
diff --git a/cython/Makefile.am b/cython/Makefile.am new file mode 100644 index 0000000..1dc8a00 --- /dev/null +++ b/cython/Makefile.am | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | AM_CPPFLAGS = -I$(top_srcdir)/include | ||
| 2 | |||
| 3 | AM_CFLAGS = $(GLOBAL_CFLAGS) $(libxml2_CFLAGS) | ||
| 4 | AM_LDFLAGS = $(libxml2_LIBS) | ||
| 5 | |||
| 6 | if HAVE_CYTHON | ||
| 7 | |||
| 8 | BUILT_SOURCES = plist.c | ||
| 9 | PXDINCLUDES = plist.pxd $(CYTHON_PLIST_INCLUDE_DIR)/plist.pxd | ||
| 10 | PXIINCLUDES = | ||
| 11 | |||
| 12 | CLEANFILES = \ | ||
| 13 | *.pyc \ | ||
| 14 | *.pyo \ | ||
| 15 | plist.c | ||
| 16 | |||
| 17 | EXTRA_DIST = plist.pyx plist.pxd $(PXIINCLUDES) | ||
| 18 | |||
| 19 | plistdir = $(pyexecdir) | ||
| 20 | plist_LTLIBRARIES = plist.la | ||
| 21 | plist_la_SOURCES = plist_util.c plist_util.h plist.pyx | ||
| 22 | plist_la_CFLAGS = -I../include -I../src $(PYTHON_CPPFLAGS) $(AM_CFLAGS) -Wno-shadow -Wno-redundant-decls -Wno-switch-default -Wno-strict-aliasing -Wno-implicit-function-declaration | ||
| 23 | plist_la_LDFLAGS = -module -avoid-version -L$(libdir) $(PYTHON_LDFLAGS) $(AM_LDFLAGS) | ||
| 24 | plist_la_LIBADD = ../src/libplist.la | ||
| 25 | |||
| 26 | plist.c: plist.pyx $(PXDINCLUDES) $(PXIINCLUDES) | ||
| 27 | |||
| 28 | .pyx.c: | ||
| 29 | $(CYTHON) -I$(CYTHON_PLIST_INCLUDE_DIR) -I$(top_srcdir)/src -o $@ $< | ||
| 30 | |||
| 31 | endif | ||
diff --git a/doxygen.cfg b/doxygen.cfg.in index 1218580..bb1aa13 100644 --- a/doxygen.cfg +++ b/doxygen.cfg.in | |||
| @@ -25,13 +25,13 @@ DOXYFILE_ENCODING = UTF-8 | |||
| 25 | # The PROJECT_NAME tag is a single word (or a sequence of words surrounded | 25 | # The PROJECT_NAME tag is a single word (or a sequence of words surrounded |
| 26 | # by quotes) that should identify the project. | 26 | # by quotes) that should identify the project. |
| 27 | 27 | ||
| 28 | PROJECT_NAME = libplist | 28 | PROJECT_NAME = @PACKAGE@ |
| 29 | 29 | ||
| 30 | # The PROJECT_NUMBER tag can be used to enter a project or revision number. | 30 | # The PROJECT_NUMBER tag can be used to enter a project or revision number. |
| 31 | # This could be handy for archiving the generated documentation or | 31 | # This could be handy for archiving the generated documentation or |
| 32 | # if some version control system is used. | 32 | # if some version control system is used. |
| 33 | 33 | ||
| 34 | PROJECT_NUMBER = 1.10 | 34 | PROJECT_NUMBER = @VERSION@ |
| 35 | 35 | ||
| 36 | # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) | 36 | # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) |
| 37 | # base path where the generated documentation will be put. | 37 | # base path where the generated documentation will be put. |
| @@ -293,7 +293,7 @@ EXTRACT_STATIC = NO | |||
| 293 | # defined locally in source files will be included in the documentation. | 293 | # defined locally in source files will be included in the documentation. |
| 294 | # If set to NO only classes defined in header files are included. | 294 | # If set to NO only classes defined in header files are included. |
| 295 | 295 | ||
| 296 | EXTRACT_LOCAL_CLASSES = YES | 296 | EXTRACT_LOCAL_CLASSES = NO |
| 297 | 297 | ||
| 298 | # This flag is only useful for Objective-C code. When set to YES local | 298 | # This flag is only useful for Objective-C code. When set to YES local |
| 299 | # methods, which are defined in the implementation section but not in | 299 | # methods, which are defined in the implementation section but not in |
| @@ -851,7 +851,7 @@ DISABLE_INDEX = NO | |||
| 851 | # This tag can be used to set the number of enum values (range [1..20]) | 851 | # This tag can be used to set the number of enum values (range [1..20]) |
| 852 | # that doxygen will group on one line in the generated HTML documentation. | 852 | # that doxygen will group on one line in the generated HTML documentation. |
| 853 | 853 | ||
| 854 | ENUM_VALUES_PER_LINE = 4 | 854 | ENUM_VALUES_PER_LINE = 1 |
| 855 | 855 | ||
| 856 | # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index | 856 | # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index |
| 857 | # structure should be generated to display hierarchical information. | 857 | # structure should be generated to display hierarchical information. |
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt deleted file mode 100644 index f6d3ea7..0000000 --- a/include/CMakeLists.txt +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | SET( libplist_HDR | ||
| 2 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/plist.h | ||
| 3 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/plist++.h | ||
| 4 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/Array.h | ||
| 5 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/Boolean.h | ||
| 6 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/Data.h | ||
| 7 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/Date.h | ||
| 8 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/Dictionary.h | ||
| 9 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/Integer.h | ||
| 10 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/Node.h | ||
| 11 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/Real.h | ||
| 12 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/String.h | ||
| 13 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/Key.h | ||
| 14 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/Uid.h | ||
| 15 | ${CMAKE_CURRENT_SOURCE_DIR}/plist/Structure.h | ||
| 16 | ) | ||
| 17 | |||
| 18 | INSTALL( FILES ${libplist_HDR} | ||
| 19 | DESTINATION include/plist COMPONENT dev) | ||
diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 0000000..4e4db2e --- /dev/null +++ b/include/Makefile.am | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | nobase_include_HEADERS = plist/plist.h \ | ||
| 2 | plist/plist++.h \ | ||
| 3 | plist/Array.h \ | ||
| 4 | plist/Boolean.h \ | ||
| 5 | plist/Data.h \ | ||
| 6 | plist/Date.h \ | ||
| 7 | plist/Dictionary.h \ | ||
| 8 | plist/Integer.h \ | ||
| 9 | plist/Key.h \ | ||
| 10 | plist/Node.h \ | ||
| 11 | plist/Real.h \ | ||
| 12 | plist/String.h \ | ||
| 13 | plist/Structure.h \ | ||
| 14 | plist/Uid.h | ||
diff --git a/libcnary/CMakeLists.txt b/libcnary/CMakeLists.txt deleted file mode 100644 index bbbe8ce..0000000 --- a/libcnary/CMakeLists.txt +++ /dev/null | |||
| @@ -1,16 +0,0 @@ | |||
| 1 | cmake_minimum_required(VERSION 2.6) | ||
| 2 | |||
| 3 | SET(libcnary_SRC | ||
| 4 | iterator.c | ||
| 5 | list.c | ||
| 6 | node.c | ||
| 7 | node_iterator.c | ||
| 8 | node_list.c ) | ||
| 9 | |||
| 10 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
| 11 | |||
| 12 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") | ||
| 13 | ADD_LIBRARY(libcnary STATIC ${libcnary_SRC}) | ||
| 14 | |||
| 15 | SET_TARGET_PROPERTIES(libcnary PROPERTIES OUTPUT_NAME cnary) | ||
| 16 | |||
diff --git a/libcnary/Makefile b/libcnary/Makefile deleted file mode 100644 index bdd165d..0000000 --- a/libcnary/Makefile +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | TARGET = cnary | ||
| 2 | LIBRARY = libcnary.a | ||
| 3 | OBJECTS = cnary.o libcnary.a | ||
| 4 | LIBRARY_OBJECTS = node.o list.o iterator.o node_list.o node_iterator.o | ||
| 5 | CFLAGS=-g -I./include -I/opt/local/include -mmacosx-version-min=10.5 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk | ||
| 6 | LDFLAGS=-L/opt/local/lib -framework CoreFoundation -mmacosx-version-min=10.5 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -Wl,-no_compact_linkedit | ||
| 7 | |||
| 8 | |||
| 9 | %.o: %.c | ||
| 10 | $(CC) -o $(@) -c $(^) $(CFLAGS) | ||
| 11 | |||
| 12 | $(LIBRARY): $(LIBRARY_OBJECTS) | ||
| 13 | $(AR) rs $(@) $(^) | ||
| 14 | |||
| 15 | $(TARGET): $(OBJECTS) | ||
| 16 | $(CC) -o $(@) $(^) $(CFLAGS) $(LDFLAGS) | ||
| 17 | |||
| 18 | all: $(TARGET) | ||
| 19 | |||
| 20 | clean: | ||
| 21 | rm -rf $(TARGET) $(LIBRARY) $(OBJECTS) $(LIBRARY_OBJECTS) \ No newline at end of file | ||
diff --git a/libcnary/Makefile.am b/libcnary/Makefile.am new file mode 100644 index 0000000..ef61c31 --- /dev/null +++ b/libcnary/Makefile.am | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | AM_CFLAGS = $(GLOBAL_CFLAGS) -Iinclude | ||
| 2 | AM_LDFLAGS = | ||
| 3 | |||
| 4 | noinst_LTLIBRARIES = libcnary.la | ||
| 5 | libcnary_la_LIBADD = | ||
| 6 | libcnary_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined | ||
| 7 | libcnary_la_SOURCES = \ | ||
| 8 | node.c \ | ||
| 9 | list.c \ | ||
| 10 | node_list.c \ | ||
| 11 | iterator.c \ | ||
| 12 | node_iterator.c \ | ||
| 13 | include/node.h \ | ||
| 14 | include/list.h \ | ||
| 15 | include/node_list.h \ | ||
| 16 | include/iterator.h \ | ||
| 17 | include/node_iterator.h \ | ||
| 18 | include/object.h | ||
diff --git a/libplist++.pc.in b/libplist++.pc.in index 89e40d7..2132a8d 100644 --- a/libplist++.pc.in +++ b/libplist++.pc.in | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | prefix=${CMAKE_INSTALL_PREFIX} | 1 | prefix=@prefix@ |
| 2 | exec_prefix=${CMAKE_INSTALL_PREFIX} | 2 | exec_prefix=@exec_prefix@ |
| 3 | libdir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} | 3 | libdir=@libdir@ |
| 4 | includedir=${CMAKE_INSTALL_PREFIX}/include | 4 | includedir=@includedir@ |
| 5 | 5 | ||
| 6 | Name: libplist++ | 6 | Name: libplist++ |
| 7 | Description: C++ binding of libplist | 7 | Description: C++ binding of libplist |
| 8 | Version: ${LIBPLIST_VERSION} | 8 | Version: @VERSION@ |
| 9 | Requires: libplist >= ${LIBPLIST_VERSION} | 9 | Requires: libplist >= @VERSION@ |
| 10 | Libs: -L${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} -lplist++ | 10 | Libs: -L${libdir} -lplist++ |
| 11 | Cflags: -I${CMAKE_INSTALL_PREFIX}/include | 11 | Cflags: -I${includedir} |
| 12 | 12 | ||
diff --git a/libplist.pc.in b/libplist.pc.in index 971b8b5..d922c19 100644 --- a/libplist.pc.in +++ b/libplist.pc.in | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | prefix=${CMAKE_INSTALL_PREFIX} | 1 | prefix=@prefix@ |
| 2 | exec_prefix=${CMAKE_INSTALL_PREFIX} | 2 | exec_prefix=@exec_prefix@ |
| 3 | libdir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} | 3 | libdir=@libdir@ |
| 4 | includedir=${CMAKE_INSTALL_PREFIX}/include | 4 | includedir=@includedir@ |
| 5 | 5 | ||
| 6 | Name: libplist | 6 | Name: libplist |
| 7 | Description: A library to handle Apple Property Lists whereas they are binary or XML | 7 | Description: A library to handle Apple Property Lists whereas they are binary or XML |
| 8 | Version: ${LIBPLIST_VERSION} | 8 | Version: @VERSION@ |
| 9 | Requires.private: libxml-2.0 >= 2.6.30 | 9 | Requires.private: libxml-2.0 >= @LIBXML2_VERSION@ |
| 10 | Libs: -L${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} -lplist | 10 | Libs: -L${libdir} -lplist |
| 11 | Cflags: -I${CMAKE_INSTALL_PREFIX}/include | 11 | Cflags: -I${includedir} |
| 12 | 12 | ||
diff --git a/m4/ac_pkg_cython.m4 b/m4/ac_pkg_cython.m4 new file mode 100644 index 0000000..3b4c9a7 --- /dev/null +++ b/m4/ac_pkg_cython.m4 | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | |||
| 2 | AC_DEFUN([AC_PROG_CYTHON],[ | ||
| 3 | AC_PATH_PROG([CYTHON],[cython]) | ||
| 4 | if test -z "$CYTHON" ; then | ||
| 5 | AC_MSG_WARN([cannot find 'cython' program. You should look at http://www.cython.org] or install your distribution specific cython package.) | ||
| 6 | CYTHON=false | ||
| 7 | elif test -n "$1" ; then | ||
| 8 | AC_MSG_CHECKING([for Cython version]) | ||
| 9 | [cython_version=`$CYTHON --version 2>&1 | sed 's/Cython version \(.*\)$/\1/g'`] | ||
| 10 | AC_MSG_RESULT([$cython_version]) | ||
| 11 | |||
| 12 | # Setup extra version string for parsing | ||
| 13 | [cython_version_stripped=`echo $cython_version | sed 's/\([0-9]\+\)\.\([0-9]\+\)[^\.]*\(\.\([0-9]\+\)\)\?.*/0\1.0\2.0\4/g'`] | ||
| 14 | if test -n "$cython_version" ; then | ||
| 15 | # Calculate the required version number components | ||
| 16 | [required=$1] | ||
| 17 | [required_major=`echo $required | sed 's/[^0-9].*//'`] | ||
| 18 | if test -z "$required_major" ; then | ||
| 19 | [required_major=0] | ||
| 20 | fi | ||
| 21 | [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] | ||
| 22 | [required_minor=`echo $required | sed 's/[^0-9].*//'`] | ||
| 23 | if test -z "$required_minor" ; then | ||
| 24 | [required_minor=0] | ||
| 25 | fi | ||
| 26 | [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] | ||
| 27 | [required_patch=`echo $required | sed 's/[^0-9].*//'`] | ||
| 28 | if test -z "$required_patch" ; then | ||
| 29 | [required_patch=0] | ||
| 30 | fi | ||
| 31 | |||
| 32 | # Calculate the available version number components | ||
| 33 | [available=$cython_version_stripped] | ||
| 34 | [available_major=`echo $available | sed 's/[^0-9].*//'`] | ||
| 35 | if test -z "$available_major" ; then | ||
| 36 | [available_major=0] | ||
| 37 | fi | ||
| 38 | [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] | ||
| 39 | [available_minor=`echo $available | sed 's/[^0-9].*//'`] | ||
| 40 | if test -z "$available_minor" ; then | ||
| 41 | [available_minor=0] | ||
| 42 | fi | ||
| 43 | [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] | ||
| 44 | [available_patch=`echo $available | sed 's/[^0-9].*//'`] | ||
| 45 | if test -z "$available_patch" ; then | ||
| 46 | [available_patch=0] | ||
| 47 | fi | ||
| 48 | |||
| 49 | if test $available_major -gt $required_major || \ | ||
| 50 | ( test $available_major -eq $required_major && \ | ||
| 51 | test $available_minor -gt $required_minor ) || \ | ||
| 52 | ( test $available_major -eq $required_major && \ | ||
| 53 | test $available_minor -eq $required_minor && \ | ||
| 54 | test $available_patch -ge $required_patch ) ; then | ||
| 55 | |||
| 56 | AC_MSG_NOTICE([Cython executable is '$CYTHON']) | ||
| 57 | else | ||
| 58 | AC_MSG_WARN([Cython version >= $1 is required. You have $cython_version. You should look at http://www.cython.org]) | ||
| 59 | CYTHON='echo "Error: Cython version >= $1 is required. You have '"$cython_version"'. You should look at http://www.cython.org" ; false' | ||
| 60 | fi | ||
| 61 | else | ||
| 62 | AC_MSG_WARN([cannot determine Cython version]) | ||
| 63 | CYTHON=false | ||
| 64 | fi | ||
| 65 | fi | ||
| 66 | AC_SUBST([CYTHON_LIB]) | ||
| 67 | ]) | ||
diff --git a/m4/ac_python_devel.m4 b/m4/ac_python_devel.m4 new file mode 100644 index 0000000..99ff7d0 --- /dev/null +++ b/m4/ac_python_devel.m4 | |||
| @@ -0,0 +1,265 @@ | |||
| 1 | # =========================================================================== | ||
| 2 | # http://autoconf-archive.cryp.to/ac_python_devel.html | ||
| 3 | # =========================================================================== | ||
| 4 | # | ||
| 5 | # SYNOPSIS | ||
| 6 | # | ||
| 7 | # AC_PYTHON_DEVEL([version]) | ||
| 8 | # | ||
| 9 | # DESCRIPTION | ||
| 10 | # | ||
| 11 | # Note: Defines as a precious variable "PYTHON_VERSION". Don't override it | ||
| 12 | # in your configure.ac. | ||
| 13 | # | ||
| 14 | # This macro checks for Python and tries to get the include path to | ||
| 15 | # 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) | ||
| 16 | # output variables. It also exports $(PYTHON_EXTRA_LIBS) and | ||
| 17 | # $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code. | ||
| 18 | # | ||
| 19 | # You can search for some particular version of Python by passing a | ||
| 20 | # parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please | ||
| 21 | # note that you *have* to pass also an operator along with the version to | ||
| 22 | # match, and pay special attention to the single quotes surrounding the | ||
| 23 | # version number. Don't use "PYTHON_VERSION" for this: that environment | ||
| 24 | # variable is declared as precious and thus reserved for the end-user. | ||
| 25 | # | ||
| 26 | # This macro should work for all versions of Python >= 2.1.0. As an end | ||
| 27 | # user, you can disable the check for the python version by setting the | ||
| 28 | # PYTHON_NOVERSIONCHECK environment variable to something else than the | ||
| 29 | # empty string. | ||
| 30 | # | ||
| 31 | # If you need to use this macro for an older Python version, please | ||
| 32 | # contact the authors. We're always open for feedback. | ||
| 33 | # | ||
| 34 | # LAST MODIFICATION | ||
| 35 | # | ||
| 36 | # 2008-04-12 | ||
| 37 | # | ||
| 38 | # COPYLEFT | ||
| 39 | # | ||
| 40 | # Copyright (c) 2008 Sebastian Huber <sebastian-huber@web.de> | ||
| 41 | # Copyright (c) 2008 Alan W. Irwin <irwin@beluga.phys.uvic.ca> | ||
| 42 | # Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net> | ||
| 43 | # Copyright (c) 2008 Andrew Collier <colliera@ukzn.ac.za> | ||
| 44 | # Copyright (c) 2008 Matteo Settenvini <matteo@member.fsf.org> | ||
| 45 | # Copyright (c) 2008 Horst Knorr <hk_classes@knoda.org> | ||
| 46 | # | ||
| 47 | # This program is free software: you can redistribute it and/or modify it | ||
| 48 | # under the terms of the GNU General Public License as published by the | ||
| 49 | # Free Software Foundation, either version 3 of the License, or (at your | ||
| 50 | # option) any later version. | ||
| 51 | # | ||
| 52 | # This program is distributed in the hope that it will be useful, but | ||
| 53 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 54 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
| 55 | # Public License for more details. | ||
| 56 | # | ||
| 57 | # You should have received a copy of the GNU General Public License along | ||
| 58 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 59 | # | ||
| 60 | # As a special exception, the respective Autoconf Macro's copyright owner | ||
| 61 | # gives unlimited permission to copy, distribute and modify the configure | ||
| 62 | # scripts that are the output of Autoconf when processing the Macro. You | ||
| 63 | # need not follow the terms of the GNU General Public License when using | ||
| 64 | # or distributing such scripts, even though portions of the text of the | ||
| 65 | # Macro appear in them. The GNU General Public License (GPL) does govern | ||
| 66 | # all other use of the material that constitutes the Autoconf Macro. | ||
| 67 | # | ||
| 68 | # This special exception to the GPL applies to versions of the Autoconf | ||
| 69 | # Macro released by the Autoconf Macro Archive. When you make and | ||
| 70 | # distribute a modified version of the Autoconf Macro, you may extend this | ||
| 71 | # special exception to the GPL to apply to your modified version as well. | ||
| 72 | |||
| 73 | AC_DEFUN([AC_PYTHON_DEVEL],[ | ||
| 74 | # | ||
| 75 | # Allow the use of a (user set) custom python version | ||
| 76 | # | ||
| 77 | AC_ARG_VAR([PYTHON_VERSION],[The installed Python | ||
| 78 | version to use, for example '2.3'. This string | ||
| 79 | will be appended to the Python interpreter | ||
| 80 | canonical name.]) | ||
| 81 | |||
| 82 | AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) | ||
| 83 | if test -z "$PYTHON"; then | ||
| 84 | AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) | ||
| 85 | PYTHON_VERSION="" | ||
| 86 | fi | ||
| 87 | |||
| 88 | # | ||
| 89 | # Check for a version of Python >= 2.1.0 | ||
| 90 | # | ||
| 91 | AC_MSG_CHECKING([for a version of Python >= '2.1.0']) | ||
| 92 | ac_supports_python_ver=`$PYTHON -c "import sys, string; \ | ||
| 93 | ver = string.split(sys.version)[[0]]; \ | ||
| 94 | print ver >= '2.1.0'"` | ||
| 95 | if test "$ac_supports_python_ver" != "True"; then | ||
| 96 | if test -z "$PYTHON_NOVERSIONCHECK"; then | ||
| 97 | AC_MSG_RESULT([no]) | ||
| 98 | AC_MSG_FAILURE([ | ||
| 99 | This version of the AC@&t@_PYTHON_DEVEL macro | ||
| 100 | doesn't work properly with versions of Python before | ||
| 101 | 2.1.0. You may need to re-run configure, setting the | ||
| 102 | variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, | ||
| 103 | PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. | ||
| 104 | Moreover, to disable this check, set PYTHON_NOVERSIONCHECK | ||
| 105 | to something else than an empty string. | ||
| 106 | ]) | ||
| 107 | else | ||
| 108 | AC_MSG_RESULT([skip at user request]) | ||
| 109 | fi | ||
| 110 | else | ||
| 111 | AC_MSG_RESULT([yes]) | ||
| 112 | fi | ||
| 113 | |||
| 114 | # | ||
| 115 | # if the macro parameter ``version'' is set, honour it | ||
| 116 | # | ||
| 117 | if test -n "$1"; then | ||
| 118 | AC_MSG_CHECKING([for a version of Python $1]) | ||
| 119 | ac_supports_python_ver=`$PYTHON -c "import sys, string; \ | ||
| 120 | ver = string.split(sys.version)[[0]]; \ | ||
| 121 | print ver $1"` | ||
| 122 | if test "$ac_supports_python_ver" = "True"; then | ||
| 123 | AC_MSG_RESULT([yes]) | ||
| 124 | else | ||
| 125 | AC_MSG_RESULT([no]) | ||
| 126 | AC_MSG_ERROR([this package requires Python $1. | ||
| 127 | If you have it installed, but it isn't the default Python | ||
| 128 | interpreter in your system path, please pass the PYTHON_VERSION | ||
| 129 | variable to configure. See ``configure --help'' for reference. | ||
| 130 | ]) | ||
| 131 | PYTHON_VERSION="" | ||
| 132 | fi | ||
| 133 | fi | ||
| 134 | |||
| 135 | # | ||
| 136 | # Check if you have distutils, else fail | ||
| 137 | # | ||
| 138 | AC_MSG_CHECKING([for the distutils Python package]) | ||
| 139 | ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` | ||
| 140 | if test -z "$ac_distutils_result"; then | ||
| 141 | AC_MSG_RESULT([yes]) | ||
| 142 | else | ||
| 143 | AC_MSG_RESULT([no]) | ||
| 144 | AC_MSG_ERROR([cannot import Python module "distutils". | ||
| 145 | Please check your Python installation. The error was: | ||
| 146 | $ac_distutils_result]) | ||
| 147 | PYTHON_VERSION="" | ||
| 148 | fi | ||
| 149 | |||
| 150 | # | ||
| 151 | # Check for Python include path | ||
| 152 | # | ||
| 153 | AC_MSG_CHECKING([for Python include path]) | ||
| 154 | if test -z "$PYTHON_CPPFLAGS"; then | ||
| 155 | python_path=`$PYTHON -c "import distutils.sysconfig; \ | ||
| 156 | print distutils.sysconfig.get_python_inc();"` | ||
| 157 | if test -n "${python_path}"; then | ||
| 158 | python_path="-I$python_path" | ||
| 159 | fi | ||
| 160 | PYTHON_CPPFLAGS=$python_path | ||
| 161 | fi | ||
| 162 | AC_MSG_RESULT([$PYTHON_CPPFLAGS]) | ||
| 163 | AC_SUBST([PYTHON_CPPFLAGS]) | ||
| 164 | |||
| 165 | # | ||
| 166 | # Check for Python library path | ||
| 167 | # | ||
| 168 | AC_MSG_CHECKING([for Python library path]) | ||
| 169 | if test -z "$PYTHON_LDFLAGS"; then | ||
| 170 | # (makes two attempts to ensure we've got a version number | ||
| 171 | # from the interpreter) | ||
| 172 | py_version=`$PYTHON -c "from distutils.sysconfig import *; \ | ||
| 173 | from string import join; \ | ||
| 174 | print join(get_config_vars('VERSION'))"` | ||
| 175 | if test "$py_version" = "[None]"; then | ||
| 176 | if test -n "$PYTHON_VERSION"; then | ||
| 177 | py_version=$PYTHON_VERSION | ||
| 178 | else | ||
| 179 | py_version=`$PYTHON -c "import sys; \ | ||
| 180 | print sys.version[[:3]]"` | ||
| 181 | fi | ||
| 182 | fi | ||
| 183 | |||
| 184 | PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \ | ||
| 185 | from string import join; \ | ||
| 186 | print '-L' + get_python_lib(0,1), \ | ||
| 187 | '-lpython';"`$py_version | ||
| 188 | fi | ||
| 189 | AC_MSG_RESULT([$PYTHON_LDFLAGS]) | ||
| 190 | AC_SUBST([PYTHON_LDFLAGS]) | ||
| 191 | |||
| 192 | # | ||
| 193 | # Check for site packages | ||
| 194 | # | ||
| 195 | AC_MSG_CHECKING([for Python site-packages path]) | ||
| 196 | if test -z "$PYTHON_SITE_PKG"; then | ||
| 197 | PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ | ||
| 198 | print distutils.sysconfig.get_python_lib(0,0);"` | ||
| 199 | fi | ||
| 200 | AC_MSG_RESULT([$PYTHON_SITE_PKG]) | ||
| 201 | AC_SUBST([PYTHON_SITE_PKG]) | ||
| 202 | |||
| 203 | # | ||
| 204 | # libraries which must be linked in when embedding | ||
| 205 | # | ||
| 206 | AC_MSG_CHECKING(python extra libraries) | ||
| 207 | if test -z "$PYTHON_EXTRA_LIBS"; then | ||
| 208 | PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ | ||
| 209 | conf = distutils.sysconfig.get_config_var; \ | ||
| 210 | print conf('LOCALMODLIBS'), conf('LIBS')"` | ||
| 211 | fi | ||
| 212 | AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) | ||
| 213 | AC_SUBST(PYTHON_EXTRA_LIBS) | ||
| 214 | |||
| 215 | # | ||
| 216 | # linking flags needed when embedding | ||
| 217 | # | ||
| 218 | AC_MSG_CHECKING(python extra linking flags) | ||
| 219 | if test -z "$PYTHON_EXTRA_LDFLAGS"; then | ||
| 220 | PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ | ||
| 221 | conf = distutils.sysconfig.get_config_var; \ | ||
| 222 | print conf('LINKFORSHARED')"` | ||
| 223 | fi | ||
| 224 | AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) | ||
| 225 | AC_SUBST(PYTHON_EXTRA_LDFLAGS) | ||
| 226 | |||
| 227 | # | ||
| 228 | # final check to see if everything compiles alright | ||
| 229 | # | ||
| 230 | AC_MSG_CHECKING([consistency of all components of python development environment]) | ||
| 231 | AC_LANG_PUSH([C]) | ||
| 232 | # save current global flags | ||
| 233 | LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" | ||
| 234 | CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" | ||
| 235 | AC_TRY_LINK([ | ||
| 236 | #include <Python.h> | ||
| 237 | ],[ | ||
| 238 | Py_Initialize(); | ||
| 239 | ],[pythonexists=yes],[pythonexists=no]) | ||
| 240 | |||
| 241 | AC_MSG_RESULT([$pythonexists]) | ||
| 242 | |||
| 243 | if test ! "$pythonexists" = "yes"; then | ||
| 244 | AC_MSG_ERROR([ | ||
| 245 | Could not link test program to Python. Maybe the main Python library has been | ||
| 246 | installed in some non-standard library path. If so, pass it to configure, | ||
| 247 | via the LDFLAGS environment variable. | ||
| 248 | Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" | ||
| 249 | ============================================================================ | ||
| 250 | ERROR! | ||
| 251 | You probably have to install the development version of the Python package | ||
| 252 | for your distribution. The exact name of this package varies among them. | ||
| 253 | ============================================================================ | ||
| 254 | ]) | ||
| 255 | PYTHON_VERSION="" | ||
| 256 | fi | ||
| 257 | AC_LANG_POP | ||
| 258 | # turn back to default flags | ||
| 259 | CPPFLAGS="$ac_save_CPPFLAGS" | ||
| 260 | LIBS="$ac_save_LIBS" | ||
| 261 | |||
| 262 | # | ||
| 263 | # all done! | ||
| 264 | # | ||
| 265 | ]) | ||
diff --git a/m4/as-compiler-flag.m4 b/m4/as-compiler-flag.m4 new file mode 100644 index 0000000..0f660cf --- /dev/null +++ b/m4/as-compiler-flag.m4 | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | dnl as-compiler-flag.m4 0.1.0 | ||
| 2 | |||
| 3 | dnl autostars m4 macro for detection of compiler flags | ||
| 4 | |||
| 5 | dnl David Schleef <ds@schleef.org> | ||
| 6 | |||
| 7 | dnl $Id: as-compiler-flag.m4,v 1.1 2005/12/15 23:35:19 ds Exp $ | ||
| 8 | |||
| 9 | dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) | ||
| 10 | dnl Tries to compile with the given CFLAGS. | ||
| 11 | dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, | ||
| 12 | dnl and ACTION-IF-NOT-ACCEPTED otherwise. | ||
| 13 | |||
| 14 | AC_DEFUN([AS_COMPILER_FLAG], | ||
| 15 | [ | ||
| 16 | AC_MSG_CHECKING([to see if compiler understands $1]) | ||
| 17 | |||
| 18 | save_CFLAGS="$CFLAGS" | ||
| 19 | CFLAGS="$CFLAGS $1" | ||
| 20 | |||
| 21 | AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) | ||
| 22 | CFLAGS="$save_CFLAGS" | ||
| 23 | |||
| 24 | if test "X$flag_ok" = Xyes ; then | ||
| 25 | m4_ifvaln([$2],[$2]) | ||
| 26 | true | ||
| 27 | else | ||
| 28 | m4_ifvaln([$3],[$3]) | ||
| 29 | true | ||
| 30 | fi | ||
| 31 | AC_MSG_RESULT([$flag_ok]) | ||
| 32 | ]) | ||
| 33 | |||
| 34 | dnl AS_COMPILER_FLAGS(VAR, FLAGS) | ||
| 35 | dnl Tries to compile with the given CFLAGS. | ||
| 36 | |||
| 37 | AC_DEFUN([AS_COMPILER_FLAGS], | ||
| 38 | [ | ||
| 39 | list=$2 | ||
| 40 | flags_supported="" | ||
| 41 | flags_unsupported="" | ||
| 42 | AC_MSG_CHECKING([for supported compiler flags]) | ||
| 43 | for each in $list | ||
| 44 | do | ||
| 45 | save_CFLAGS="$CFLAGS" | ||
| 46 | CFLAGS="$CFLAGS $each" | ||
| 47 | AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) | ||
| 48 | CFLAGS="$save_CFLAGS" | ||
| 49 | |||
| 50 | if test "X$flag_ok" = Xyes ; then | ||
| 51 | flags_supported="$flags_supported $each" | ||
| 52 | else | ||
| 53 | flags_unsupported="$flags_unsupported $each" | ||
| 54 | fi | ||
| 55 | done | ||
| 56 | AC_MSG_RESULT([$flags_supported]) | ||
| 57 | if test "X$flags_unsupported" != X ; then | ||
| 58 | AC_MSG_WARN([unsupported compiler flags: $flags_unsupported]) | ||
| 59 | fi | ||
| 60 | $1="$$1 $flags_supported" | ||
| 61 | ]) | ||
| 62 | |||
diff --git a/m4/cython_python.m4 b/m4/cython_python.m4 new file mode 100644 index 0000000..ba730d5 --- /dev/null +++ b/m4/cython_python.m4 | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | AC_DEFUN([CYTHON_PYTHON],[ | ||
| 2 | AC_REQUIRE([AC_PROG_CYTHON]) | ||
| 3 | AC_REQUIRE([AC_PYTHON_DEVEL]) | ||
| 4 | test "x$1" != "xno" || cython_shadow=" -noproxy" | ||
| 5 | AC_SUBST([CYTHON_PYTHON_OPT],[-python$cython_shadow]) | ||
| 6 | AC_SUBST([CYTHON_PYTHON_CPPFLAGS],[$PYTHON_CPPFLAGS]) | ||
| 7 | ]) | ||
diff --git a/plistutil/CMakeLists.txt b/plistutil/CMakeLists.txt deleted file mode 100644 index 68382ee..0000000 --- a/plistutil/CMakeLists.txt +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | |||
| 2 | SET(plistutil_SRC | ||
| 3 | plistutil.c) | ||
| 4 | |||
| 5 | ADD_EXECUTABLE(plistutil ${plistutil_SRC}) | ||
| 6 | TARGET_LINK_LIBRARIES(plistutil plist) | ||
| 7 | SET_TARGET_PROPERTIES( plistutil PROPERTIES VERSION ${PLISTUTIL_VERSION} ) | ||
| 8 | |||
| 9 | INSTALL( TARGETS plistutil RUNTIME DESTINATION bin COMPONENT plistutil ) | ||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index c4f5483..0000000 --- a/src/CMakeLists.txt +++ /dev/null | |||
| @@ -1,59 +0,0 @@ | |||
| 1 | |||
| 2 | INCLUDE_DIRECTORIES( ${LIBXML2_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/libcnary/include ) | ||
| 3 | |||
| 4 | |||
| 5 | SET(libplist_SRC | ||
| 6 | plist.c | ||
| 7 | hashtable.c | ||
| 8 | bytearray.c | ||
| 9 | ptrarray.c | ||
| 10 | bplist.c | ||
| 11 | base64.c | ||
| 12 | xplist.c ) | ||
| 13 | |||
| 14 | SET(libplist++_SRC | ||
| 15 | Node.cpp | ||
| 16 | Boolean.cpp | ||
| 17 | Integer.cpp | ||
| 18 | Real.cpp | ||
| 19 | String.cpp | ||
| 20 | Date.cpp | ||
| 21 | Data.cpp | ||
| 22 | Key.cpp | ||
| 23 | Uid.cpp | ||
| 24 | Structure.cpp | ||
| 25 | Array.cpp | ||
| 26 | Dictionary.cpp | ||
| 27 | ) | ||
| 28 | |||
| 29 | SET(libcnary_object_files | ||
| 30 | ${CMAKE_BINARY_DIR}/libcnary/CMakeFiles/libcnary.dir/iterator.c${CMAKE_C_OUTPUT_EXTENSION} | ||
| 31 | ${CMAKE_BINARY_DIR}/libcnary/CMakeFiles/libcnary.dir/list.c${CMAKE_C_OUTPUT_EXTENSION} | ||
| 32 | ${CMAKE_BINARY_DIR}/libcnary/CMakeFiles/libcnary.dir/node.c${CMAKE_C_OUTPUT_EXTENSION} | ||
| 33 | ${CMAKE_BINARY_DIR}/libcnary/CMakeFiles/libcnary.dir/node_iterator.c${CMAKE_C_OUTPUT_EXTENSION} | ||
| 34 | ${CMAKE_BINARY_DIR}/libcnary/CMakeFiles/libcnary.dir/node_list.c${CMAKE_C_OUTPUT_EXTENSION} | ||
| 35 | ) | ||
| 36 | |||
| 37 | SET_SOURCE_FILES_PROPERTIES(${libcnary_object_files} PROPERTIES EXTERNAL_OBJECT true GENERATED true) | ||
| 38 | |||
| 39 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLIST_BYTE_ORDER=${PLIST_BYTE_ORDER}") | ||
| 40 | ADD_LIBRARY( plist SHARED ${libplist_SRC} ${libcnary_object_files} ) | ||
| 41 | TARGET_LINK_LIBRARIES( plist ${LIBXML2_LIBRARIES} ) | ||
| 42 | SET_TARGET_PROPERTIES( plist PROPERTIES VERSION ${LIBPLIST_LIBVERSION} ) | ||
| 43 | SET_TARGET_PROPERTIES( plist PROPERTIES SOVERSION ${LIBPLIST_SOVERSION} ) | ||
| 44 | if(APPLE) | ||
| 45 | SET_TARGET_PROPERTIES( plist PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") | ||
| 46 | endif() | ||
| 47 | |||
| 48 | ADD_LIBRARY( plist++ SHARED ${libplist++_SRC} ) | ||
| 49 | TARGET_LINK_LIBRARIES( plist++ plist ) | ||
| 50 | SET_TARGET_PROPERTIES( plist++ PROPERTIES VERSION ${LIBPLIST_LIBVERSION} ) | ||
| 51 | SET_TARGET_PROPERTIES( plist++ PROPERTIES SOVERSION ${LIBPLIST_SOVERSION} ) | ||
| 52 | if(APPLE) | ||
| 53 | SET_TARGET_PROPERTIES( plist++ PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") | ||
| 54 | endif() | ||
| 55 | |||
| 56 | INSTALL(TARGETS plist plist++ | ||
| 57 | RUNTIME DESTINATION bin COMPONENT lib | ||
| 58 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev | ||
| 59 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev) | ||
diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..16cf655 --- /dev/null +++ b/src/Makefile.am | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir) -I$(top_srcdir)/libcnary/include | ||
| 2 | |||
| 3 | AM_CFLAGS = $(GLOBAL_CFLAGS) $(libxml2_CFLAGS) | ||
| 4 | AM_LDFLAGS = $(libxml2_LIBS) | ||
| 5 | |||
| 6 | lib_LTLIBRARIES = libplist.la libplist++.la | ||
| 7 | libplist_la_LIBADD = $(top_srcdir)/libcnary/libcnary.la | ||
| 8 | libplist_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBPLIST_SO_VERSION) -no-undefined | ||
| 9 | libplist_la_SOURCES = base64.c base64.h \ | ||
| 10 | bytearray.c bytearray.h \ | ||
| 11 | hashtable.c hashtable.h \ | ||
| 12 | ptrarray.c ptrarray.h \ | ||
| 13 | xplist.c xplist.h \ | ||
| 14 | bplist.c bplist.h \ | ||
| 15 | plist.c plist.h \ | ||
| 16 | common.h | ||
| 17 | |||
| 18 | libplist___la_LIBADD = libplist.la | ||
| 19 | libplist___la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBPLIST_SO_VERSION) -no-undefined | ||
| 20 | libplist___la_SOURCES = Node.cpp \ | ||
| 21 | Structure.cpp \ | ||
| 22 | Array.cpp \ | ||
| 23 | Boolean.cpp \ | ||
| 24 | Data.cpp \ | ||
| 25 | Date.cpp \ | ||
| 26 | Dictionary.cpp \ | ||
| 27 | Integer.cpp \ | ||
| 28 | Key.cpp \ | ||
| 29 | Real.cpp \ | ||
| 30 | String.cpp \ | ||
| 31 | Uid.cpp \ | ||
| 32 | $(top_srcdir)/include/plist/Node.h \ | ||
| 33 | $(top_srcdir)/include/plist/Structure.h \ | ||
| 34 | $(top_srcdir)/include/plist/Array.h \ | ||
| 35 | $(top_srcdir)/include/plist/Boolean.h \ | ||
| 36 | $(top_srcdir)/include/plist/Data.h \ | ||
| 37 | $(top_srcdir)/include/plist/Date.h \ | ||
| 38 | $(top_srcdir)/include/plist/Dictionary.h \ | ||
| 39 | $(top_srcdir)/include/plist/Integer.h \ | ||
| 40 | $(top_srcdir)/include/plist/Key.h \ | ||
| 41 | $(top_srcdir)/include/plist/Real.h \ | ||
| 42 | $(top_srcdir)/include/plist/String.h \ | ||
| 43 | $(top_srcdir)/include/plist/Uid.h | ||
| 44 | |||
| 45 | if WIN32 | ||
| 46 | libplist_la_LDFLAGS += -avoid-version | ||
| 47 | endif | ||
diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt deleted file mode 100644 index 379cb95..0000000 --- a/swig/CMakeLists.txt +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | INCLUDE( ${SWIG_USE_FILE} ) | ||
| 2 | |||
| 3 | SET(CMAKE_SWIG_FLAGS -Werror -Wall -modern) | ||
| 4 | |||
| 5 | INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} ) | ||
| 6 | |||
| 7 | SET_SOURCE_FILES_PROPERTIES(plist.i PROPERTIES CPLUSPLUS ON) | ||
| 8 | SWIG_ADD_MODULE( plist python plist.i ) | ||
| 9 | SWIG_LINK_LIBRARIES( plist plist plist++ ${PYTHON_LIBRARIES} ) | ||
| 10 | |||
| 11 | EXEC_PROGRAM("${PYTHON_EXECUTABLE}" | ||
| 12 | ARGS "-c 'try:\n import distutils.sysconfig; print distutils.sysconfig.get_python_lib(plat_specific=1)\nexcept: pass\n'" | ||
| 13 | OUTPUT_VARIABLE DISTUTILS_PYTHON_ILIBRARY_PATH | ||
| 14 | ) | ||
| 15 | |||
| 16 | INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/_plist${CMAKE_SHARED_MODULE_SUFFIX} | ||
| 17 | DESTINATION ${DISTUTILS_PYTHON_ILIBRARY_PATH}/plist/ ) | ||
| 18 | INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/plist.py | ||
| 19 | DESTINATION ${DISTUTILS_PYTHON_ILIBRARY_PATH}/plist/ ) | ||
| 20 | INSTALL( FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py | ||
| 21 | DESTINATION ${DISTUTILS_PYTHON_ILIBRARY_PATH}/plist/ ) | ||
| 22 | INSTALL( FILES ${CMAKE_CURRENT_SOURCE_DIR}/plist.i | ||
| 23 | DESTINATION include/plist/swig COMPONENT dev) | ||
| 24 | |||
diff --git a/swig/__init__.py b/swig/__init__.py deleted file mode 100644 index f4c0dbb..0000000 --- a/swig/__init__.py +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | |||
| 3 | from plist import * | ||
diff --git a/swig/plist.i b/swig/plist.i deleted file mode 100644 index 3ae3d02..0000000 --- a/swig/plist.i +++ /dev/null | |||
| @@ -1,284 +0,0 @@ | |||
| 1 | /* swig.i */ | ||
| 2 | %module plist | ||
| 3 | %feature("autodoc", "1"); | ||
| 4 | %{ | ||
| 5 | /* Includes the header in the wrapper code */ | ||
| 6 | #include <plist/plist++.h> | ||
| 7 | #include <cstddef> | ||
| 8 | %} | ||
| 9 | |||
| 10 | %include "std_string.i" | ||
| 11 | %include "stdint.i" | ||
| 12 | |||
| 13 | %typemap(out) std::vector<char> { | ||
| 14 | $result = SWIG_FromCharPtrAndSize((const char*)&($1[0]),(size_t)($1.size())); | ||
| 15 | } | ||
| 16 | |||
| 17 | %typemap(in) (const std::vector<char>&) | ||
| 18 | { | ||
| 19 | char* buffer = NULL; | ||
| 20 | size_t length = 0; | ||
| 21 | SWIG_AsCharPtrAndSize($input, &buffer, &length, NULL); | ||
| 22 | $1 = new std::vector<char>(buffer, buffer + length - 1); | ||
| 23 | } | ||
| 24 | |||
| 25 | #if SWIGPYTHON | ||
| 26 | //for datetime in python | ||
| 27 | %{ | ||
| 28 | #include <ctime> | ||
| 29 | #include <datetime.h> | ||
| 30 | %} | ||
| 31 | |||
| 32 | %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) timeval { | ||
| 33 | PyDateTime_IMPORT; | ||
| 34 | $1 = PyDateTime_Check($input) ? 1 : 0; | ||
| 35 | } | ||
| 36 | |||
| 37 | %typemap(out) timeval { | ||
| 38 | struct tm* t = gmtime ( &$1.tv_sec ); | ||
| 39 | if (t) | ||
| 40 | { | ||
| 41 | PyDateTime_IMPORT; | ||
| 42 | $result = PyDateTime_FromDateAndTime(t->tm_year+1900, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, $1.tv_usec); | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | %typemap(in) (timeval t) | ||
| 47 | { | ||
| 48 | PyDateTime_IMPORT; | ||
| 49 | if (!PyDateTime_Check($input)) { | ||
| 50 | PyErr_SetString(PyExc_ValueError,"Expected a datetime"); | ||
| 51 | return NULL; | ||
| 52 | } | ||
| 53 | struct tm t = { | ||
| 54 | PyDateTime_DATE_GET_SECOND($input), | ||
| 55 | PyDateTime_DATE_GET_MINUTE($input), | ||
| 56 | PyDateTime_DATE_GET_HOUR($input), | ||
| 57 | PyDateTime_GET_DAY($input), | ||
| 58 | PyDateTime_GET_MONTH($input)-1, | ||
| 59 | PyDateTime_GET_YEAR($input)-1900, | ||
| 60 | 0,0,0 | ||
| 61 | }; | ||
| 62 | timeval ret = {(int)mktime(&t), PyDateTime_DATE_GET_MICROSECOND($input)}; | ||
| 63 | $1 = ret; | ||
| 64 | } | ||
| 65 | #endif | ||
| 66 | |||
| 67 | %apply SWIGTYPE *DYNAMIC { PList::Node* }; | ||
| 68 | %apply SWIGTYPE *DYNAMIC { PList::Structure* }; | ||
| 69 | |||
| 70 | %{ | ||
| 71 | static swig_type_info *Node_dynamic(void **ptr) | ||
| 72 | { | ||
| 73 | PList::Node* node = dynamic_cast<PList::Node *>((PList::Node *) *ptr); | ||
| 74 | if (node) | ||
| 75 | { | ||
| 76 | plist_type type = node->GetType(); | ||
| 77 | switch(type) | ||
| 78 | { | ||
| 79 | case PLIST_DICT: | ||
| 80 | *ptr = dynamic_cast<PList::Dictionary *>(node); | ||
| 81 | return SWIGTYPE_p_PList__Dictionary; | ||
| 82 | case PLIST_ARRAY: | ||
| 83 | *ptr = dynamic_cast<PList::Array *>(node); | ||
| 84 | return SWIGTYPE_p_PList__Array; | ||
| 85 | case PLIST_BOOLEAN: | ||
| 86 | *ptr = dynamic_cast<PList::Boolean *>(node); | ||
| 87 | return SWIGTYPE_p_PList__Boolean; | ||
| 88 | case PLIST_UINT: | ||
| 89 | *ptr = dynamic_cast<PList::Integer *>(node); | ||
| 90 | return SWIGTYPE_p_PList__Integer; | ||
| 91 | case PLIST_REAL: | ||
| 92 | *ptr = dynamic_cast<PList::Real *>(node); | ||
| 93 | return SWIGTYPE_p_PList__Real; | ||
| 94 | case PLIST_KEY: | ||
| 95 | *ptr = dynamic_cast<PList::Key *>(node); | ||
| 96 | return SWIGTYPE_p_PList__Key; | ||
| 97 | case PLIST_UID: | ||
| 98 | *ptr = dynamic_cast<PList::Uid *>(node); | ||
| 99 | return SWIGTYPE_p_PList__Uid; | ||
| 100 | case PLIST_STRING: | ||
| 101 | *ptr = dynamic_cast<PList::String *>(node); | ||
| 102 | return SWIGTYPE_p_PList__String; | ||
| 103 | case PLIST_DATE: | ||
| 104 | *ptr = dynamic_cast<PList::Date *>(node); | ||
| 105 | return SWIGTYPE_p_PList__Date; | ||
| 106 | case PLIST_DATA: | ||
| 107 | *ptr = dynamic_cast<PList::Data *>(node); | ||
| 108 | return SWIGTYPE_p_PList__Data; | ||
| 109 | default: | ||
| 110 | break; | ||
| 111 | } | ||
| 112 | } | ||
| 113 | return 0; | ||
| 114 | } | ||
| 115 | %} | ||
| 116 | |||
| 117 | // Register the above casting function | ||
| 118 | DYNAMIC_CAST(SWIGTYPE_p_PList__Node, Node_dynamic); | ||
| 119 | DYNAMIC_CAST(SWIGTYPE_p_PList__Structure, Node_dynamic); | ||
| 120 | |||
| 121 | %include "std_map.i" | ||
| 122 | // Instantiate templates used by example | ||
| 123 | namespace std { | ||
| 124 | %template(PairStringNodePtr) std::pair<string, PList::Node*>; | ||
| 125 | %template(MapStringNodePtr) map<string,PList::Node*>; | ||
| 126 | } | ||
| 127 | |||
| 128 | #if SWIGPYTHON | ||
| 129 | %rename(__assign__) *::operator=; | ||
| 130 | %rename(__getitem__) *::operator[]; | ||
| 131 | %rename(__delitem__) *::Remove; | ||
| 132 | %rename(__setitem__) PList::Dictionary::Insert; | ||
| 133 | %rename(__deepcopy__) *::Clone; | ||
| 134 | %rename(__len__) *::GetSize; | ||
| 135 | %rename(get_type) *::GetType; | ||
| 136 | %rename(set_value) *::SetValue; | ||
| 137 | %rename(get_value) *::GetValue; | ||
| 138 | %rename(to_xml) *::ToXml; | ||
| 139 | %rename(to_bin) *::ToBin; | ||
| 140 | %rename(from_xml) *::FromXml; | ||
| 141 | %rename(from_bin) *::FromBin; | ||
| 142 | %rename(append) *::Append; | ||
| 143 | %rename(insert) PList::Array::Insert; | ||
| 144 | #endif | ||
| 145 | |||
| 146 | %ignore GetPlist(); | ||
| 147 | %ignore Boolean(plist_t); | ||
| 148 | %ignore Integer(plist_t); | ||
| 149 | %ignore Real(plist_t); | ||
| 150 | %ignore Key(plist_t); | ||
| 151 | %ignore Uid(plist_t); | ||
| 152 | %ignore String(plist_t); | ||
| 153 | %ignore Data(plist_t); | ||
| 154 | %ignore Date(plist_t); | ||
| 155 | %ignore Array(plist_t); | ||
| 156 | %ignore Dictionary(plist_t); | ||
| 157 | %ignore Begin(); | ||
| 158 | %ignore End(); | ||
| 159 | %ignore Find(); | ||
| 160 | |||
| 161 | %include <plist/Node.h> | ||
| 162 | %include <plist/Boolean.h> | ||
| 163 | %include <plist/Integer.h> | ||
| 164 | %include <plist/Real.h> | ||
| 165 | %include <plist/Key.h> | ||
| 166 | %include <plist/Uid.h> | ||
| 167 | %include <plist/String.h> | ||
| 168 | %include <plist/Data.h> | ||
| 169 | %include <plist/Date.h> | ||
| 170 | %include <plist/Structure.h> | ||
| 171 | %include <plist/Array.h> | ||
| 172 | %include <plist/Dictionary.h> | ||
| 173 | |||
| 174 | typedef enum { | ||
| 175 | PLIST_BOOLEAN, | ||
| 176 | PLIST_UINT, | ||
| 177 | PLIST_REAL, | ||
| 178 | PLIST_STRING, | ||
| 179 | PLIST_ARRAY, | ||
| 180 | PLIST_DICT, | ||
| 181 | PLIST_DATE, | ||
| 182 | PLIST_DATA, | ||
| 183 | PLIST_KEY, | ||
| 184 | PLIST_UID, | ||
| 185 | PLIST_NONE | ||
| 186 | } plist_type; | ||
| 187 | |||
| 188 | #if SWIGPYTHON | ||
| 189 | |||
| 190 | #if SWIG_VERSION <= 0x010336 | ||
| 191 | #define SwigPyIterator PySwigIterator | ||
| 192 | #endif | ||
| 193 | |||
| 194 | %extend PList::Dictionary { | ||
| 195 | |||
| 196 | %newobject key_iterator(PyObject **PYTHON_SELF); | ||
| 197 | swig::SwigPyIterator* key_iterator(PyObject **PYTHON_SELF) { | ||
| 198 | return swig::make_output_key_iterator(self->Begin(), self->Begin(), self->End(), *PYTHON_SELF); | ||
| 199 | } | ||
| 200 | |||
| 201 | %newobject value_iterator(PyObject **PYTHON_SELF); | ||
| 202 | swig::SwigPyIterator* value_iterator(PyObject **PYTHON_SELF) { | ||
| 203 | return swig::make_output_value_iterator(self->Begin(), self->Begin(), self->End(), *PYTHON_SELF); | ||
| 204 | } | ||
| 205 | |||
| 206 | iterator iteritems() | ||
| 207 | { | ||
| 208 | return self->Begin(); | ||
| 209 | } | ||
| 210 | |||
| 211 | bool has_key(const std::string& key) const { | ||
| 212 | PList::Dictionary* dict = const_cast<PList::Dictionary*>(self); | ||
| 213 | PList::Dictionary::iterator i = dict->Find(key); | ||
| 214 | return i != dict->End(); | ||
| 215 | } | ||
| 216 | |||
| 217 | PyObject* keys() { | ||
| 218 | uint32_t size = self->GetSize(); | ||
| 219 | int pysize = (size <= (uint32_t) INT_MAX) ? (int) size : -1; | ||
| 220 | if (pysize < 0) { | ||
| 221 | SWIG_PYTHON_THREAD_BEGIN_BLOCK; | ||
| 222 | PyErr_SetString(PyExc_OverflowError, | ||
| 223 | "map size not valid in python"); | ||
| 224 | SWIG_PYTHON_THREAD_END_BLOCK; | ||
| 225 | return NULL; | ||
| 226 | } | ||
| 227 | PyObject* keyList = PyList_New(pysize); | ||
| 228 | PList::Dictionary::iterator i = self->Begin(); | ||
| 229 | for (int j = 0; j < pysize; ++i, ++j) { | ||
| 230 | PyList_SET_ITEM(keyList, j, swig::from(i->first)); | ||
| 231 | } | ||
| 232 | return keyList; | ||
| 233 | } | ||
| 234 | |||
| 235 | PyObject* values() { | ||
| 236 | uint32_t size = self->GetSize(); | ||
| 237 | int pysize = (size <= (uint32_t) INT_MAX) ? (int) size : -1; | ||
| 238 | if (pysize < 0) { | ||
| 239 | SWIG_PYTHON_THREAD_BEGIN_BLOCK; | ||
| 240 | PyErr_SetString(PyExc_OverflowError, | ||
| 241 | "map size not valid in python"); | ||
| 242 | SWIG_PYTHON_THREAD_END_BLOCK; | ||
| 243 | return NULL; | ||
| 244 | } | ||
| 245 | PyObject* valList = PyList_New(pysize); | ||
| 246 | PList::Dictionary::iterator i = self->Begin(); | ||
| 247 | for (int j = 0; j < pysize; ++i, ++j) { | ||
| 248 | PList::Node *second = i->second; | ||
| 249 | PyObject *down = SWIG_NewPointerObj(SWIG_as_voidptr(second), SWIG_TypeDynamicCast(SWIGTYPE_p_PList__Node, SWIG_as_voidptrptr(&second)), 0 | 0 ); | ||
| 250 | PyList_SET_ITEM(valList, j, down); | ||
| 251 | } | ||
| 252 | return valList; | ||
| 253 | } | ||
| 254 | |||
| 255 | PyObject* items() { | ||
| 256 | uint32_t size = self->GetSize(); | ||
| 257 | int pysize = (size <= (uint32_t) INT_MAX) ? (int) size : -1; | ||
| 258 | if (pysize < 0) { | ||
| 259 | SWIG_PYTHON_THREAD_BEGIN_BLOCK; | ||
| 260 | PyErr_SetString(PyExc_OverflowError, | ||
| 261 | "map size not valid in python"); | ||
| 262 | SWIG_PYTHON_THREAD_END_BLOCK; | ||
| 263 | return NULL; | ||
| 264 | } | ||
| 265 | PyObject* itemList = PyList_New(pysize); | ||
| 266 | PList::Dictionary::iterator i = self->Begin(); | ||
| 267 | for (int j = 0; j < pysize; ++i, ++j) { | ||
| 268 | PyObject *item = PyTuple_New(2); | ||
| 269 | PList::Node *second = i->second; | ||
| 270 | PyObject *down = SWIG_NewPointerObj(SWIG_as_voidptr(second), SWIG_TypeDynamicCast(SWIGTYPE_p_PList__Node, SWIG_as_voidptrptr(&second)), 0 | 0 ); | ||
| 271 | PyTuple_SetItem(item, 0, swig::from(i->first)); | ||
| 272 | PyTuple_SetItem(item, 1, down); | ||
| 273 | PyList_SET_ITEM(itemList, j, item); | ||
| 274 | } | ||
| 275 | return itemList; | ||
| 276 | } | ||
| 277 | |||
| 278 | %pythoncode {def __iter__(self): return self.key_iterator()} | ||
| 279 | %pythoncode {def iterkeys(self): return self.key_iterator()} | ||
| 280 | %pythoncode {def itervalues(self): return self.value_iterator()} | ||
| 281 | } | ||
| 282 | |||
| 283 | #undef SwigPyIterator | ||
| 284 | #endif | ||
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 1b3d2f7..0000000 --- a/test/CMakeLists.txt +++ /dev/null | |||
| @@ -1,29 +0,0 @@ | |||
| 1 | |||
| 2 | #build the test executable | ||
| 3 | INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/libcnary/include ) | ||
| 4 | |||
| 5 | SET(plist_test_SRC | ||
| 6 | plist_test.c) | ||
| 7 | SET(plist_cmp_SRC | ||
| 8 | plist_cmp.c) | ||
| 9 | ADD_EXECUTABLE(plist_test ${plist_test_SRC}) | ||
| 10 | TARGET_LINK_LIBRARIES(plist_test plist) | ||
| 11 | ADD_EXECUTABLE(plist_cmp ${plist_cmp_SRC}) | ||
| 12 | TARGET_LINK_LIBRARIES(plist_cmp plist) | ||
| 13 | |||
| 14 | INCLUDE(CTest) | ||
| 15 | |||
| 16 | SET(TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}) | ||
| 17 | ADD_TEST(Empty plist_test ${TEST_DATA_DIR}/data/1.plist) | ||
| 18 | ADD_TEST(Small plist_test ${TEST_DATA_DIR}/data/2.plist) | ||
| 19 | ADD_TEST(Medium plist_test ${TEST_DATA_DIR}/data/3.plist) | ||
| 20 | ADD_TEST(Large plist_test ${TEST_DATA_DIR}/data/4.plist) | ||
| 21 | ADD_TEST(Huge plist_test ${TEST_DATA_DIR}/data/5.plist) | ||
| 22 | ADD_TEST(Big_Array plist_test ${TEST_DATA_DIR}/data/6.plist) | ||
| 23 | |||
| 24 | ADD_TEST(EmptyCmp plist_cmp ${TEST_DATA_DIR}/data/1.plist ${TEST_DATA_DIR}/data/1.plist.out) | ||
| 25 | ADD_TEST(SmallCmp plist_cmp ${TEST_DATA_DIR}/data/2.plist ${TEST_DATA_DIR}/data/2.plist.out) | ||
| 26 | ADD_TEST(MediumCmp plist_cmp ${TEST_DATA_DIR}/data/3.plist ${TEST_DATA_DIR}/data/3.plist.out) | ||
| 27 | ADD_TEST(LargeCmp plist_cmp ${TEST_DATA_DIR}/data/4.plist ${TEST_DATA_DIR}/data/4.plist.out) | ||
| 28 | ADD_TEST(HugeCmp plist_cmp ${TEST_DATA_DIR}/data/5.plist ${TEST_DATA_DIR}/data/5.plist.out) | ||
| 29 | ADD_TEST(Big_ArrayCmp plist_cmp ${TEST_DATA_DIR}/data/6.plist ${TEST_DATA_DIR}/data/6.plist.out) | ||
diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..837c1dd --- /dev/null +++ b/test/Makefile.am | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | AM_CFLAGS = $(GLOBAL_CFLAGS) -I$(top_srcdir)/include -I$(top_srcdir)/libcnary/include | ||
| 2 | AM_LDFLAGS = | ||
| 3 | |||
| 4 | noinst_PROGRAMS = plist_cmp plist_test | ||
| 5 | |||
| 6 | plist_cmp_SOURCES = plist_cmp.c | ||
| 7 | plist_cmp_LDADD = ../src/libplist.la | ||
| 8 | |||
| 9 | plist_test_SOURCES = plist_test.c | ||
| 10 | plist_test_LDADD = ../src/libplist.la | ||
| 11 | |||
| 12 | TESTS = \ | ||
| 13 | empty.test \ | ||
| 14 | small.test \ | ||
| 15 | medium.test \ | ||
| 16 | large.test \ | ||
| 17 | huge.test \ | ||
| 18 | bigarray.test \ | ||
| 19 | emptycmp.test \ | ||
| 20 | smallcmp.test \ | ||
| 21 | mediumcmp.test \ | ||
| 22 | largecmp.test \ | ||
| 23 | hugecmp.test \ | ||
| 24 | bigarraycmp.test | ||
| 25 | |||
diff --git a/test/bigarray.test b/test/bigarray.test new file mode 100755 index 0000000..fa27e69 --- /dev/null +++ b/test/bigarray.test | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ## -*- sh -*- | ||
| 2 | |||
| 3 | # Common definitions | ||
| 4 | if test -z "$srcdir"; then | ||
| 5 | srcdir=echo "$0" | sed 's,[^/]*$,,' | ||
| 6 | test "$srcdir" = "$0" && srcdir=. | ||
| 7 | test -z "$srcdir" && srcdir=. | ||
| 8 | test "${VERBOSE+set}" != set && VERBOSE=1 | ||
| 9 | fi | ||
| 10 | |||
| 11 | $srcdir/plist_test $srcdir/data/6.plist | ||
| 12 | |||
diff --git a/test/bigarraycmp.test b/test/bigarraycmp.test new file mode 100755 index 0000000..f95266e --- /dev/null +++ b/test/bigarraycmp.test | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ## -*- sh -*- | ||
| 2 | |||
| 3 | # Common definitions | ||
| 4 | if test -z "$srcdir"; then | ||
| 5 | srcdir=echo "$0" | sed 's,[^/]*$,,' | ||
| 6 | test "$srcdir" = "$0" && srcdir=. | ||
| 7 | test -z "$srcdir" && srcdir=. | ||
| 8 | test "${VERBOSE+set}" != set && VERBOSE=1 | ||
| 9 | fi | ||
| 10 | |||
| 11 | $srcdir/plist_cmp $srcdir/data/6.plist $srcdir/data/6.plist.out | ||
| 12 | |||
diff --git a/test/empty.test b/test/empty.test new file mode 100755 index 0000000..2a036a3 --- /dev/null +++ b/test/empty.test | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ## -*- sh -*- | ||
| 2 | |||
| 3 | # Common definitions | ||
| 4 | if test -z "$srcdir"; then | ||
| 5 | srcdir=echo "$0" | sed 's,[^/]*$,,' | ||
| 6 | test "$srcdir" = "$0" && srcdir=. | ||
| 7 | test -z "$srcdir" && srcdir=. | ||
| 8 | test "${VERBOSE+set}" != set && VERBOSE=1 | ||
| 9 | fi | ||
| 10 | |||
| 11 | $srcdir/plist_test $srcdir/data/1.plist | ||
| 12 | |||
diff --git a/test/emptycmp.test b/test/emptycmp.test new file mode 100755 index 0000000..9fcd685 --- /dev/null +++ b/test/emptycmp.test | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ## -*- sh -*- | ||
| 2 | |||
| 3 | # Common definitions | ||
| 4 | if test -z "$srcdir"; then | ||
| 5 | srcdir=echo "$0" | sed 's,[^/]*$,,' | ||
| 6 | test "$srcdir" = "$0" && srcdir=. | ||
| 7 | test -z "$srcdir" && srcdir=. | ||
| 8 | test "${VERBOSE+set}" != set && VERBOSE=1 | ||
| 9 | fi | ||
| 10 | |||
| 11 | $srcdir/plist_cmp $srcdir/data/1.plist $srcdir/data/1.plist.out | ||
| 12 | |||
diff --git a/test/huge.test b/test/huge.test new file mode 100755 index 0000000..a079d38 --- /dev/null +++ b/test/huge.test | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ## -*- sh -*- | ||
| 2 | |||
| 3 | # Common definitions | ||
| 4 | if test -z "$srcdir"; then | ||
| 5 | srcdir=echo "$0" | sed 's,[^/]*$,,' | ||
| 6 | test "$srcdir" = "$0" && srcdir=. | ||
| 7 | test -z "$srcdir" && srcdir=. | ||
| 8 | test "${VERBOSE+set}" != set && VERBOSE=1 | ||
| 9 | fi | ||
| 10 | |||
| 11 | $srcdir/plist_test $srcdir/data/5.plist | ||
| 12 | |||
diff --git a/test/hugecmp.test b/test/hugecmp.test new file mode 100755 index 0000000..618966d --- /dev/null +++ b/test/hugecmp.test | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ## -*- sh -*- | ||
| 2 | |||
| 3 | # Common definitions | ||
| 4 | if test -z "$srcdir"; then | ||
| 5 | srcdir=echo "$0" | sed 's,[^/]*$,,' | ||
| 6 | test "$srcdir" = "$0" && srcdir=. | ||
| 7 | test -z "$srcdir" && srcdir=. | ||
| 8 | test "${VERBOSE+set}" != set && VERBOSE=1 | ||
| 9 | fi | ||
| 10 | |||
| 11 | $srcdir/plist_cmp $srcdir/data/5.plist $srcdir/data/5.plist.out | ||
| 12 | |||
diff --git a/test/large.test b/test/large.test new file mode 100755 index 0000000..8034019 --- /dev/null +++ b/test/large.test | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ## -*- sh -*- | ||
| 2 | |||
| 3 | # Common definitions | ||
| 4 | if test -z "$srcdir"; then | ||
| 5 | srcdir=echo "$0" | sed 's,[^/]*$,,' | ||
| 6 | test "$srcdir" = "$0" && srcdir=. | ||
| 7 | test -z "$srcdir" && srcdir=. | ||
| 8 | test "${VERBOSE+set}" != set && VERBOSE=1 | ||
| 9 | fi | ||
| 10 | |||
| 11 | $srcdir/plist_test $srcdir/data/4.plist | ||
| 12 | |||
diff --git a/test/largecmp.test b/test/largecmp.test new file mode 100755 index 0000000..87a7e64 --- /dev/null +++ b/test/largecmp.test | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ## -*- sh -*- | ||
| 2 | |||
| 3 | # Common definitions | ||
| 4 | if test -z "$srcdir"; then | ||
| 5 | srcdir=echo "$0" | sed 's,[^/]*$,,' | ||
| 6 | test "$srcdir" = "$0" && srcdir=. | ||
| 7 | test -z "$srcdir" && srcdir=. | ||
| 8 | test "${VERBOSE+set}" != set && VERBOSE=1 | ||
| 9 | fi | ||
| 10 | |||
| 11 | $srcdir/plist_cmp $srcdir/data/4.plist $srcdir/data/4.plist.out | ||
| 12 | |||
diff --git a/test/medium.test b/test/medium.test new file mode 100755 index 0000000..231bb80 --- /dev/null +++ b/test/medium.test | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ## -*- sh -*- | ||
| 2 | |||
| 3 | # Common definitions | ||
| 4 | if test -z "$srcdir"; then | ||
| 5 | srcdir=echo "$0" | sed 's,[^/]*$,,' | ||
| 6 | test "$srcdir" = "$0" && srcdir=. | ||
| 7 | test -z "$srcdir" && srcdir=. | ||
| 8 | test "${VERBOSE+set}" != set && VERBOSE=1 | ||
| 9 | fi | ||
| 10 | |||
| 11 | $srcdir/plist_test $srcdir/data/3.plist | ||
| 12 | |||
diff --git a/test/mediumcmp.test b/test/mediumcmp.test new file mode 100755 index 0000000..33802ef --- /dev/null +++ b/test/mediumcmp.test | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ## -*- sh -*- | ||
| 2 | |||
| 3 | # Common definitions | ||
| 4 | if test -z "$srcdir"; then | ||
| 5 | srcdir=echo "$0" | sed 's,[^/]*$,,' | ||
| 6 | test "$srcdir" = "$0" && srcdir=. | ||
| 7 | test -z "$srcdir" && srcdir=. | ||
| 8 | test "${VERBOSE+set}" != set && VERBOSE=1 | ||
| 9 | fi | ||
| 10 | |||
| 11 | $srcdir/plist_cmp $srcdir/data/3.plist $srcdir/data/3.plist.out | ||
| 12 | |||
diff --git a/test/small.test b/test/small.test new file mode 100755 index 0000000..544f374 --- /dev/null +++ b/test/small.test | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ## -*- sh -*- | ||
| 2 | |||
| 3 | # Common definitions | ||
| 4 | if test -z "$srcdir"; then | ||
| 5 | srcdir=echo "$0" | sed 's,[^/]*$,,' | ||
| 6 | test "$srcdir" = "$0" && srcdir=. | ||
| 7 | test -z "$srcdir" && srcdir=. | ||
| 8 | test "${VERBOSE+set}" != set && VERBOSE=1 | ||
| 9 | fi | ||
| 10 | |||
| 11 | $srcdir/plist_test $srcdir/data/2.plist | ||
| 12 | |||
diff --git a/test/smallcmp.test b/test/smallcmp.test new file mode 100755 index 0000000..fb10787 --- /dev/null +++ b/test/smallcmp.test | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ## -*- sh -*- | ||
| 2 | |||
| 3 | # Common definitions | ||
| 4 | if test -z "$srcdir"; then | ||
| 5 | srcdir=echo "$0" | sed 's,[^/]*$,,' | ||
| 6 | test "$srcdir" = "$0" && srcdir=. | ||
| 7 | test -z "$srcdir" && srcdir=. | ||
| 8 | test "${VERBOSE+set}" != set && VERBOSE=1 | ||
| 9 | fi | ||
| 10 | |||
| 11 | $srcdir/plist_cmp $srcdir/data/2.plist $srcdir/data/2.plist.out | ||
| 12 | |||
diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000..a50f819 --- /dev/null +++ b/tools/Makefile.am | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | AM_CFLAGS = $(GLOBAL_CFLAGS) -I$(top_srcdir)/include | ||
| 2 | AM_LDFLAGS = | ||
| 3 | |||
| 4 | bin_PROGRAMS = plistutil | ||
| 5 | |||
| 6 | plistutil_SOURCES = plistutil.c plistutil.h | ||
| 7 | plistutil_LDADD = ../src/libplist.la | ||
diff --git a/plistutil/plistutil.c b/tools/plistutil.c index 3e09bb2..3e09bb2 100644 --- a/plistutil/plistutil.c +++ b/tools/plistutil.c | |||
diff --git a/plistutil/plistutil.h b/tools/plistutil.h index 40421a3..40421a3 100644 --- a/plistutil/plistutil.h +++ b/tools/plistutil.h | |||
