add-cmake.diff
changeset 87 78238d26911a
parent 61 9b4f7e14c19c
child 88 0a87df8ad9c1
equal deleted inserted replaced
86:ac5fed257211 87:78238d26911a
     1 # HG changeset patch
     1 # HG changeset patch
     2 # Parent 19a36ac5d0b55244c4b3bdef8cb6f98874a9d961
     2 # Parent 386f3b8646a61ba6af61609ff67f2da2cc70251e
     3 [work-in-progress] Add possibility to build with CMake
     3 Add possibility to build with CMake
     4 
     4 
     5 diff -r 19a36ac5d0b5 .hgignore
     5 diff --git a/.hgignore b/.hgignore
     6 --- a/.hgignore	Sun Jan 13 06:17:13 2013 +0200
     6 --- a/.hgignore
     7 +++ b/.hgignore	Sun Jan 13 06:40:40 2013 +0200
     7 +++ b/.hgignore
     8 @@ -34,3 +34,5 @@
     8 @@ -36,3 +36,5 @@
     9  tags
     9  tags
    10  mcabber/ptodo
    10  mcabber/ptodo
    11  mcabber/ppatches
    11  mcabber/ppatches
    12 +
    12 +
    13 +mcabber/build
    13 +mcabber/build
    14 diff -r 19a36ac5d0b5 mcabber/CMakeLists.txt
    14 diff --git a/mcabber/CMakeLists.txt b/mcabber/CMakeLists.txt
    15 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15 new file mode 100644
    16 +++ b/mcabber/CMakeLists.txt	Sun Jan 13 06:40:40 2013 +0200
    16 --- /dev/null
       
    17 +++ b/mcabber/CMakeLists.txt
    17 @@ -0,0 +1,303 @@
    18 @@ -0,0 +1,303 @@
    18 +## Copyright 2010-2012 Myhailo Danylenko
    19 +## Copyright 2010-2012 Myhailo Danylenko
    19 +# This file is part of mcabber.
    20 +# This file is part of mcabber.
    20 +#
    21 +#
    21 +# mcabber is free software: you can redistribute it and/or modify
    22 +# mcabber is free software: you can redistribute it and/or modify
    36 +set ( PROJECT_VERSION "0.10.2-dev" )
    37 +set ( PROJECT_VERSION "0.10.2-dev" )
    37 +
    38 +
    38 +## User settable options
    39 +## User settable options
    39 +option ( ENABLE_DEBUG    "Enable debugging output"                       OFF ) # XXX is it really used?
    40 +option ( ENABLE_DEBUG    "Enable debugging output"                       OFF ) # XXX is it really used?
    40 +option ( USE_SIGWINCH    "Compile with SIGWINCH handler"                 OFF )
    41 +option ( USE_SIGWINCH    "Compile with SIGWINCH handler"                 OFF )
    41 +option ( XEP0022         "Enable obsolete Message Events (XEP-0022)"     OFF ) # + XEP0085?
       
    42 +option ( MODULES_ENABLE  "Enable dynamic module loading"                 ON  )
    42 +option ( MODULES_ENABLE  "Enable dynamic module loading"                 ON  )
    43 +option ( WANT_LIBIDN     "Compile with libidn support"                   ON  )
    43 +option ( WANT_LIBIDN     "Compile with libidn support"                   ON  )
    44 +option ( WANT_GPGME      "Compile with PGP support (libgpgme required)"  ON  )
    44 +option ( WANT_GPGME      "Compile with PGP support (libgpgme required)"  ON  )
    45 +option ( WANT_OTR        "Compile with OTR support"                      OFF )
    45 +option ( WANT_OTR        "Compile with OTR support"                      OFF )
    46 +option ( WANT_ENCHANT    "Use enchant for spell-checking"                OFF )
    46 +option ( WANT_ENCHANT    "Use enchant for spell-checking"                OFF )
    82 +
    82 +
    83 +# Loudmouth
    83 +# Loudmouth
    84 +pkg_check_modules ( LM REQUIRED loudmouth-1.0>=1.4.2 )
    84 +pkg_check_modules ( LM REQUIRED loudmouth-1.0>=1.4.2 )
    85 +set ( CMAKE_REQUIRED_INCLUDES  ${LM_INCLUDE_DIRS}         )
    85 +set ( CMAKE_REQUIRED_INCLUDES  ${LM_INCLUDE_DIRS}         )
    86 +set ( CMAKE_REQUIRED_LIBRARIES ${LM_LIBRARIES}            )
    86 +set ( CMAKE_REQUIRED_LIBRARIES ${LM_LIBRARIES}            )
    87 +set ( CMAKE_REQUIRESD_FLAGS    ${LM_LDFLAGS} ${LM_CFLAGS} )
    87 +set ( CMAKE_REQUIRED_FLAGS    ${LM_LDFLAGS} ${LM_CFLAGS} )
    88 +check_symbol_exists ( lm_connection_unregister_reply_handler "loudmouth/loudmouth.h" HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER )
    88 +check_symbol_exists ( lm_connection_unregister_reply_handler "loudmouth/loudmouth.h" HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER )
       
    89 +check_symbol_exists ( lm_ssl_set_cipher_list                 "loudmouth/loudmouth.h" HAVE_LM_SSL_CIPHER_LIST                     )
       
    90 +check_symbol_exists ( lm_ssl_set_ca                          "loudmouth/loudmouth.h" HAVE_LM_SSL_CA                              )
    89 +
    91 +
    90 +# Libidn
    92 +# Libidn
    91 +if ( WANT_LIBIDN )
    93 +if ( WANT_LIBIDN )
    92 +	pkg_check_modules ( LIBIDN libidn )
    94 +	pkg_check_modules ( LIBIDN libidn )
    93 +	if ( LIBIDN_FOUND )
    95 +	if ( LIBIDN_FOUND )
   176 +				   ${PANEL_LIBRARY_DIRS}
   178 +				   ${PANEL_LIBRARY_DIRS}
   177 +				   ${LIBOTR_LIBRARY_DIRS} )
   179 +				   ${LIBOTR_LIBRARY_DIRS} )
   178 +
   180 +
   179 +## Define targets
   181 +## Define targets
   180 +set ( mcabber_SUBSYSTEMS
   182 +set ( mcabber_SUBSYSTEMS
   181 +	caps commands compl events hbuf help histolog hooks
   183 +	caps carbons commands compl events hbuf help histolog hooks
   182 +	modules nohtml otr pgp roster screen settings utf8 utils
   184 +	modules nohtml otr pgp roster screen settings utf8 utils
   183 +	xmpp xmpp_helper xmpp_iq xmpp_iqrequest xmpp_muc xmpp_s10n )
   185 +	xmpp xmpp_helper xmpp_iq xmpp_iqrequest xmpp_muc xmpp_s10n )
   184 +if ( NOT MODULES_ENABLE )
   186 +if ( NOT MODULES_ENABLE )
   185 +	list ( APPEND mcabber_SUBSYSTEMS extcmd fifo )
   187 +	list ( APPEND mcabber_SUBSYSTEMS extcmd fifo )
   186 +endif ()
   188 +endif ()
   197 +add_executable ( mcabber ${mcabber_SOURCES} )
   199 +add_executable ( mcabber ${mcabber_SOURCES} )
   198 +
   200 +
   199 +if ( MODULES_ENABLE )
   201 +if ( MODULES_ENABLE )
   200 +	add_library ( beep      MODULE modules/beep/beep.c                          )
   202 +	add_library ( beep      MODULE modules/beep/beep.c                          )
   201 +	add_library ( eventcmd  MODULE modules/eventcmd/eventcmd.c mcabber/extcmd.c )
   203 +	add_library ( eventcmd  MODULE modules/eventcmd/eventcmd.c mcabber/extcmd.c )
   202 +	add_library ( fifo      MODULE modules/fifo/fifo_module.c mcabber/fifo.c    )
   204 +	add_library ( fifo      MODULE modules/fifo/fifo.c mcabber/fifo_internal.c  )
   203 +	add_library ( urlregex  MODULE modules/urlregex/urlregex.c                  )
   205 +	add_library ( urlregex  MODULE modules/urlregex/urlregex.c                  )
   204 +	add_library ( xttitle   MODULE modules/xttitle/xttitle.c                    )
   206 +	add_library ( xttitle   MODULE modules/xttitle/xttitle.c                    )
   205 +endif ()
   207 +endif ()
   206 +
   208 +
   207 +## Compiler setup
   209 +## Compiler setup
   226 +						${ASPELL_LIBRARIES}
   228 +						${ASPELL_LIBRARIES}
   227 +					    ${CURSES_LIBRARIES}
   229 +					    ${CURSES_LIBRARIES}
   228 +					    ${PANEL_LIBRARIES}
   230 +					    ${PANEL_LIBRARIES}
   229 +						${GPGME_LIBRARIES}
   231 +						${GPGME_LIBRARIES}
   230 +						${LIBOTR_LIBRARIES} )
   232 +						${LIBOTR_LIBRARIES} )
   231 +target_link_libraries ( fifo
   233 +if ( MODULES_ENABLE )
   232 +                        ${GLIB_LIBRARIES} )
   234 +	target_link_libraries ( fifo     ${GLIB_LIBRARIES} )
   233 +target_link_libraries ( eventcmd
   235 +	target_link_libraries ( eventcmd ${GLIB_LIBRARIES} )
   234 +                        ${GLIB_LIBRARIES} )
   236 +	target_link_libraries ( xttitle  ${GLIB_LIBRARIES} )
   235 +target_link_libraries ( xttitle
   237 +endif ()
   236 +                        ${GLIB_LIBRARIES} )
       
   237 +include_directories ( ${mcabber_SOURCE_DIR}
   238 +include_directories ( ${mcabber_SOURCE_DIR}
   238 +                      ${mcabber_BINARY_DIR}/include
   239 +					  ${mcabber_BINARY_DIR}/include
   239 +					  ${mcabber_BINARY_DIR}/include/mcabber )
   240 +					  ${mcabber_BINARY_DIR}/include/mcabber )
   240 +set_target_properties ( mcabber PROPERTIES
   241 +set_target_properties ( mcabber PROPERTIES
   241 +					    COMPILE_FLAGS "-Wall ${GPGME_CFLAGS} -D_GNU_SOURCE" )
   242 +						COMPILE_FLAGS "-Wall ${GPGME_CFLAGS} -D_GNU_SOURCE" )
   242 +
   243 +
   243 +## Extra targets
   244 +## Extra targets
   244 +if ( HAVE_LATEX )
   245 +if ( HAVE_LATEX )
   245 +	add_custom_command ( OUTPUT guide.aux
   246 +	add_custom_command ( OUTPUT guide.aux
   246 +	                    COMMAND ${PDFLATEX_COMPILER} -output-directory=${mcabber_BINARY_DIR} guide >/dev/null
   247 +	                    COMMAND ${PDFLATEX_COMPILER} -output-directory=${mcabber_BINARY_DIR} guide >/dev/null
   316 +if ( HAVE_LATEX )
   317 +if ( HAVE_LATEX )
   317 +	install ( FILES ${mcabber_BINARY_DIR}/guide.pdf                       DESTINATION share/doc/${CPACK_PACKAGE_NAME} ) # :/
   318 +	install ( FILES ${mcabber_BINARY_DIR}/guide.pdf                       DESTINATION share/doc/${CPACK_PACKAGE_NAME} ) # :/
   318 +endif ()
   319 +endif ()
   319 +
   320 +
   320 +## The End ## vim: se ts=4 sw=4: ##
   321 +## The End ## vim: se ts=4 sw=4: ##
   321 diff -r 19a36ac5d0b5 mcabber/config.h.in
   322 diff --git a/mcabber/config.h.in b/mcabber/config.h.in
   322 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   323 new file mode 100644
   323 +++ b/mcabber/config.h.in	Sun Jan 13 06:40:40 2013 +0200
   324 --- /dev/null
   324 @@ -0,0 +1,51 @@
   325 +++ b/mcabber/config.h.in
       
   326 @@ -0,0 +1,53 @@
   325 +/* help @help.c */
   327 +/* help @help.c */
   326 +#define DATA_DIR                      "@DATA_DIR@"
   328 +#define DATA_DIR                      "@DATA_DIR@"
   327 +/* conditional @main.c */ /* does it have any effect really? */
   329 +/* conditional @main.c */ /* does it have any effect really? */
   328 +#cmakedefine ENABLE_DEBUG             @ENABLE_DEBUG@
   330 +#cmakedefine ENABLE_DEBUG             @ENABLE_DEBUG@
   329 +/* conditional @main.c */
   331 +/* conditional @main.c */
   330 +#cmakedefine ENABLE_HGCSET            @ENABLE_HGCSET@
   332 +#cmakedefine ENABLE_HGCSET            @ENABLE_HGCSET@
   331 +/* @xmpp.c */
   333 +/* @xmpp.c */
   332 +#cmakedefine HAVE_ARC4RANDOM          @HAVE_ARC4RANDOM@
   334 +#cmakedefine HAVE_ARC4RANDOM          @HAVE_ARC4RANDOM@
       
   335 +#cmakedefine HAVE_LM_SSL_CIPHER_LIST  @HAVE_LM_SSL_CIPHER_LIST@
       
   336 +#cmakedefine HAVE_LM_SSL_CA           @HAVE_LM_SSL_CA@
   333 +/* @screen.c */
   337 +/* @screen.c */
   334 +#cmakedefine HAVE_ESCDELAY            @HAVE_ESCDELAY@
   338 +#cmakedefine HAVE_ESCDELAY            @HAVE_ESCDELAY@
   335 +/* alot */
   339 +/* alot */
   336 +#cmakedefine HAVE_GPGME               @HAVE_GPGME@
   340 +#cmakedefine HAVE_GPGME               @HAVE_GPGME@
   337 +/* @utf8.h */
   341 +/* @utf8.h */
   368 +/* option */
   372 +/* option */
   369 +#cmakedefine USE_SIGWINCH             @USE_SIGWINCH@
   373 +#cmakedefine USE_SIGWINCH             @USE_SIGWINCH@
   370 +/* spelling */
   374 +/* spelling */
   371 +#cmakedefine WITH_ASPELL              @WITH_ASPELL@
   375 +#cmakedefine WITH_ASPELL              @WITH_ASPELL@
   372 +#cmakedefine WITH_ENCHANT             @WITH_ENCHANT@
   376 +#cmakedefine WITH_ENCHANT             @WITH_ENCHANT@
   373 +/* option, also XEP0085? */
   377 +/* unused, but helpful for modules */
   374 +#cmakedefine XEP0022                  @XEP0022@
   378 +/* #cmakedefine HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER @HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER@ */
   375 +/* end */
   379 +/* end */
   376 diff -r 19a36ac5d0b5 mcabber/configure.ac
   380 diff --git a/mcabber/configure.ac b/mcabber/configure.ac
   377 --- a/mcabber/configure.ac	Sun Jan 13 06:17:13 2013 +0200
   381 --- a/mcabber/configure.ac
   378 +++ b/mcabber/configure.ac	Sun Jan 13 06:40:40 2013 +0200
   382 +++ b/mcabber/configure.ac
   379 @@ -35,9 +35,8 @@
   383 @@ -36,9 +36,8 @@
   380  
   384  
   381  # Checks for header files.
   385  # Checks for header files.
   382  AC_HEADER_STDC
   386  AC_HEADER_STDC
   383 -AC_CHECK_HEADERS([arpa/inet.h fcntl.h locale.h netdb.h netinet/in.h stddef.h \
   387 -AC_CHECK_HEADERS([arpa/inet.h fcntl.h locale.h netdb.h netinet/in.h stddef.h \
   384 -                  stdlib.h string.h strings.h sys/socket.h sys/time.h \
   388 -                  stdlib.h string.h strings.h sys/socket.h sys/time.h \
   386 +AC_CHECK_HEADERS([fcntl.h locale.h stdlib.h string.h sys/time.h \
   390 +AC_CHECK_HEADERS([fcntl.h locale.h stdlib.h string.h sys/time.h \
   387 +                  termios.h wchar.h wctype.h localcharset.h])
   391 +                  termios.h wchar.h wctype.h localcharset.h])
   388  AC_CHECK_HEADERS([unistd.h], , AC_MSG_ERROR([Missing header file]))
   392  AC_CHECK_HEADERS([unistd.h], , AC_MSG_ERROR([Missing header file]))
   389  AC_VAR_TIMEZONE_EXTERNALS
   393  AC_VAR_TIMEZONE_EXTERNALS
   390  
   394  
   391 @@ -58,10 +57,8 @@
   395 @@ -59,10 +58,8 @@
   392  AC_TYPE_SIGNAL
   396  AC_TYPE_SIGNAL
   393  AC_FUNC_STRFTIME
   397  AC_FUNC_STRFTIME
   394  AC_FUNC_VPRINTF
   398  AC_FUNC_VPRINTF
   395 -AC_CHECK_FUNCS([alarm arc4random bzero gethostbyname gethostname inet_ntoa \
   399 -AC_CHECK_FUNCS([alarm arc4random bzero gethostbyname gethostname inet_ntoa \
   396 -                isascii memmove memset modf select setlocale socket strcasecmp \
   400 -                isascii memmove memset modf select setlocale socket strcasecmp \
   399 +AC_CHECK_FUNCS([arc4random memset setlocale strcasecmp strchr strncasecmp \
   403 +AC_CHECK_FUNCS([arc4random memset setlocale strcasecmp strchr strncasecmp \
   400 +                strrchr strstr strcasestr iswblank])
   404 +                strrchr strstr strcasestr iswblank])
   401  
   405  
   402  
   406  
   403  AC_CHECK_DECLS([strptime],,,
   407  AC_CHECK_DECLS([strptime],,,
   404 diff -r 19a36ac5d0b5 mcabber/hgcset.h.in
   408 diff --git a/mcabber/hgcset.h.in b/mcabber/hgcset.h.in
   405 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   409 new file mode 100644
   406 +++ b/mcabber/hgcset.h.in	Sun Jan 13 06:40:40 2013 +0200
   410 --- /dev/null
       
   411 +++ b/mcabber/hgcset.h.in
   407 @@ -0,0 +1,3 @@
   412 @@ -0,0 +1,3 @@
   408 +/* this can go to config.h */
   413 +/* this can go to config.h */
   409 +#define HGCSET "@HGCSET@"
   414 +#define HGCSET "@HGCSET@"
   410 +/* end */
   415 +/* end */
   411 diff -r 19a36ac5d0b5 mcabber/mcabber.menu.in
   416 diff --git a/mcabber/mcabber.menu.in b/mcabber/mcabber.menu.in
   412 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   417 new file mode 100644
   413 +++ b/mcabber/mcabber.menu.in	Sun Jan 13 06:40:40 2013 +0200
   418 --- /dev/null
       
   419 +++ b/mcabber/mcabber.menu.in
   414 @@ -0,0 +1,2 @@
   420 @@ -0,0 +1,2 @@
   415 +?package(mcabber):needs="text" section="Applications/Network/Communication"\
   421 +?package(mcabber):needs="text" section="Applications/Network/Communication"\
   416 +  title="mcabber" command="@CMAKE_INSTALL_PREFIX@/bin/mcabber"
   422 +  title="mcabber" command="@CMAKE_INSTALL_PREFIX@/bin/mcabber"
   417 diff -r 19a36ac5d0b5 mcabber/mcabber.pc.in.in
   423 diff --git a/mcabber/mcabber.pc.in.in b/mcabber/mcabber.pc.in.in
   418 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   424 new file mode 100644
   419 +++ b/mcabber/mcabber.pc.in.in	Sun Jan 13 06:40:40 2013 +0200
   425 --- /dev/null
       
   426 +++ b/mcabber/mcabber.pc.in.in
   420 @@ -0,0 +1,14 @@
   427 @@ -0,0 +1,14 @@
   421 +prefix=${CMAKE_INSTALL_PREFIX}
   428 +prefix=${CMAKE_INSTALL_PREFIX}
   422 +exec_prefix=$${EMPTY}{prefix}
   429 +exec_prefix=$${EMPTY}{prefix}
   423 +libdir=$${EMPTY}{prefix}/lib
   430 +libdir=$${EMPTY}{prefix}/lib
   424 +includedir=$${EMPTY}{prefix}/include
   431 +includedir=$${EMPTY}{prefix}/include
   430 +URL:              http://mcabber.com
   437 +URL:              http://mcabber.com
   431 +Requires.private: glib-2.0 gmodule-2.0 loudmouth-1.0
   438 +Requires.private: glib-2.0 gmodule-2.0 loudmouth-1.0
   432 +Version:          @PROJECT_VERSION@
   439 +Version:          @PROJECT_VERSION@
   433 +Libs: 
   440 +Libs: 
   434 +Cflags:           -I$${EMPTY}{includedir} @LIBOTR_CFLAGS@ @GPGME_CFLAGS@
   441 +Cflags:           -I$${EMPTY}{includedir} @LIBOTR_CFLAGS@ @GPGME_CFLAGS@
       
   442 diff --git a/mcabber/mcabber/fifo.c b/mcabber/mcabber/fifo.c
       
   443 new file mode 120000
       
   444 --- /dev/null
       
   445 +++ b/mcabber/mcabber/fifo.c
       
   446 @@ -0,0 +1,1 @@
       
   447 +fifo_internal.c
       
   448 \ No newline at end of file