new package: qjson

This commit is contained in:
Mark Brand 2011-07-13 22:45:26 +02:00
parent d481024236
commit 5f9ddbc738
2 changed files with 115 additions and 0 deletions

84
src/qjson-1-static.patch Normal file
View File

@ -0,0 +1,84 @@
This file is part of mingw-cross-env.
See doc/index.html for further information.
This patch taken from:
http://sourceforge.net/mailarchive/forum.php?thread_name=4E1DBC0D.10000%40jrit.at&forum_name=qjson-devel
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ed5478..9a378a1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,6 +30,13 @@ IF(QJSON_VERBOSE_DEBUG_OUTPUT)
ADD_DEFINITIONS("-DQJSON_VERBOSE_DEBUG_OUTPUT")
endif(QJSON_VERBOSE_DEBUG_OUTPUT)
+# For Static builds
+IF(LIBTYPE STREQUAL "STATIC")
+ ADD_DEFINITIONS("-DQJSON_STATIC")
+ ADD_DEFINITIONS("-DQT_NODLL")
+ SET(PKG_CONFIG_CFLAGS -DQJSON_STATIC ${PKG_CONFIG_CFLAGS})
+endif()
+
# Find Qt4
FIND_PACKAGE( Qt4 REQUIRED )
@@ -51,13 +58,13 @@ set(QJSON_LIB_VERSION_STRING "${QJSON_LIB_MAJOR_VERSION}.${QJSON_LIB_MINOR_VERSI
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib${LIB_SUFFIX}" )
# pkg-config
-IF (NOT WIN32)
+if (NOT WIN32 OR MINGW)
CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/QJson.pc.in
${CMAKE_CURRENT_BINARY_DIR}/QJson.pc
@ONLY)
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/QJson.pc
DESTINATION lib${LIB_SUFFIX}/pkgconfig)
-ENDIF (NOT WIN32)
+endif()
# Include the cmake file needed to use qt4
INCLUDE( ${QT_USE_FILE} )
diff --git a/QJson.pc.in b/QJson.pc.in
index e4704bd..bf5fd01 100644
--- a/QJson.pc.in
+++ b/QJson.pc.in
@@ -8,4 +8,4 @@ Description: QJson is a qt-based library that maps JSON data to QVariant objects
Version: @QJSON_LIB_MAJOR_VERSION@.@QJSON_LIB_MINOR_VERSION@.@QJSON_LIB_PATCH_VERSION@
Requires: QtCore
Libs: -L${libdir} -lqjson
-Cflags: -I${includedir}
\ No newline at end of file
+Cflags: -I${includedir} @PKG_CONFIG_CFLAGS@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ced213d..d0d9c68 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -26,7 +26,12 @@ qt4_wrap_cpp(qjson_MOC_SRCS ${qjson_MOC_HDRS})
set (qjson_SRCS parser.cpp qobjecthelper.cpp json_scanner.cpp json_parser.cc parserrunnable.cpp serializer.cpp serializerrunnable.cpp)
-add_library (qjson SHARED ${qjson_SRCS} ${qjson_MOC_SRCS})
+IF(LIBTYPE STREQUAL "STATIC")
+ add_library (qjson STATIC ${qjson_SRCS} ${qjson_MOC_SRCS})
+else()
+ add_library (qjson SHARED ${qjson_SRCS} ${qjson_MOC_SRCS})
+endif()
+
target_link_libraries( qjson ${QT_LIBRARIES})
set_target_properties(qjson PROPERTIES
diff --git a/src/qjson_export.h b/src/qjson_export.h
index c7f5325..d5871e2 100644
--- a/src/qjson_export.h
+++ b/src/qjson_export.h
@@ -23,7 +23,9 @@
#include <QtCore/qglobal.h>
#ifndef QJSON_EXPORT
-# if defined(QJSON_MAKEDLL)
+# ifdef QJSON_STATIC
+# define QJSON_EXPORT
+# elif defined(QJSON_MAKEDLL)
/* We are building this library */
# define QJSON_EXPORT Q_DECL_EXPORT
# else

31
src/qjson.mk Normal file
View File

@ -0,0 +1,31 @@
# This file is part of mingw-cross-env.
# See doc/index.html for further information.
PKG := qjson
$(PKG)_IGNORE :=
$(PKG)_VERSION := 0.7.1
$(PKG)_CHECKSUM := 19bbef24132b238e99744bb35194c6dadece98f9
$(PKG)_SUBDIR := $(PKG)
$(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.bz2
$(PKG)_WEBSITE := http://$(PKG).sourceforge.net/
$(PKG)_URL := http://$(SOURCEFORGE_MIRROR)/project/$(PKG)/$(PKG)/$($(PKG)_VERSION)/$($(PKG)_FILE)
$(PKG)_DEPS := gcc qt
define $(PKG)_UPDATE
wget -q -O- 'http://sourceforge.net/projects/qjson/files/qjson/' | \
$(SED) -n 's,.*/\([0-9][^"]*\)/".*,\1,p' | \
head -1
endef
define $(PKG)_BUILD
echo '$(PREFIX)/bin/$(TARGET)-qmake'
mkdir '$(1)/build'
cd '$(1)/build' && cmake .. \
-DCMAKE_TOOLCHAIN_FILE='$(CMAKE_TOOLCHAIN_FILE)' \
-DQT_QMAKE_EXECUTABLE='$(PREFIX)/bin/$(TARGET)-qmake' \
-DCMAKE_BUILD_TYPE=Release \
-DLIBTYPE=STATIC
$(MAKE) -C '$(1)/build' -j '$(JOBS)' install
endef