Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Squashed 'libzypp/' content from commit 8b5d5f8
git-subtree-dir: libzypp
git-subtree-split: 8b5d5f8a897a51d7d1adefe9d5602be9be56cdbe
  • Loading branch information
kaltsi committed Nov 6, 2013
0 parents commit 252fc1e
Show file tree
Hide file tree
Showing 1,096 changed files with 190,924 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
@@ -0,0 +1,11 @@
build
*.orig
*.rej
*.swp
#*
.#*
*#
.*project
.externalToolBuilders
.settings
*flymake.h.gch
227 changes: 227 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,227 @@
PROJECT(LIBZYPP)
SET( PACKAGE "libzypp" )
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
SET( CMAKE_MODULE_PATH ${LIBZYPP_SOURCE_DIR}/cmake/modules )
cmake_minimum_required(VERSION 2.6)


OPTION (DISABLE_LIBPROXY "Build without libproxy support even if package is installed?" OFF)
OPTION (DISABLE_AUTODOCS "Do not require doxygen being installed (required to build autodocs)?" OFF)

# allow name libraries by name mixed with full
# paths
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)

INCLUDE(ZyppCommon)
INCLUDE( ${LIBZYPP_SOURCE_DIR}/VERSION.cmake )

MATH( EXPR LIBZYPP_CURRENT "${LIBZYPP_MAJOR} * 100 + ${LIBZYPP_MINOR}" )
MATH( EXPR LIBZYPP_AGE "${LIBZYPP_MINOR} - ${LIBZYPP_COMPATMINOR}" )
# Libtool wanted current:patch:age
# But cmake is not libtool, it wants the verbatim suffix to libzypp.so
MATH( EXPR LIBZYPP_SO_FIRST "${LIBZYPP_CURRENT}-${LIBZYPP_AGE}" )
SET( VERSION "${LIBZYPP_MAJOR}.${LIBZYPP_MINOR}.${LIBZYPP_PATCH}" )

include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
CHECK_C_COMPILER_FLAG("-Werror=format-security" CC_FORMAT_SECURITY)
CHECK_CXX_COMPILER_FLAG("-Werror=format-security" CXX_FORMAT_SECURITY)

SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -fno-strict-aliasing -fPIC -g -Wall -Woverloaded-virtual -Wnon-virtual-dtor -Wl,-as-needed -std=c++0x" )
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing -fPIC -g -Wall -Wl,-as-needed" )

set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3" )

IF(${CC_FORMAT_SECURITY})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=format-security")
ENDIF(${CC_FORMAT_SECURITY})

IF(${CXX_FORMAT_SECURITY})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=format-security")
ENDIF(${CXX_FORMAT_SECURITY})

INCLUDE(CheckFunctionExists)
CHECK_FUNCTION_EXISTS(pipe2 PIPE2_FOUND)
IF(${PIPE2_FOUND})
ADD_DEFINITIONS(-DHAVE_PIPE2)
ENDIF(${PIPE2_FOUND})

ADD_DEFINITIONS( -D_FILE_OFFSET_BITS=64 )
ADD_DEFINITIONS( -DVERSION="${VERSION}" )
SET( LIBZYPP_VERSION_INFO "${LIBZYPP_SO_FIRST}.${LIBZYPP_AGE}.${LIBZYPP_PATCH}" )
SET( LIBZYPP_SOVERSION_INFO "${LIBZYPP_SO_FIRST}" )

GENERATE_PACKAGING(${PACKAGE} ${VERSION})

INCLUDE(CPack)

MACRO(ADD_TESTS)
FOREACH( loop_var ${ARGV} )
SET_SOURCE_FILES_PROPERTIES( ${loop_var}_test.cc COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN -DBOOST_AUTO_TEST_MAIN=\"\" " )
ADD_EXECUTABLE( ${loop_var}_test ${loop_var}_test.cc )
TARGET_LINK_LIBRARIES( ${loop_var}_test zypp boost_unit_test_framework zypp_test_utils)
ADD_TEST( ${loop_var}_test ${CMAKE_CURRENT_BINARY_DIR}/${loop_var}_test --catch_system_errors=no)
ENDFOREACH( loop_var )
ENDMACRO(ADD_TESTS)

####################################################################
# prefer packages using the same install prefix as we do
SET(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX} usr/localX /usr/local /usr)

FIND_PACKAGE(Rpm REQUIRED)
IF ( NOT RPM_FOUND)
MESSAGE( FATAL_ERROR " rpm-devel not found" )
ELSE ( NOT RPM_FOUND)
INCLUDE_DIRECTORIES(${RPM_INCLUDE_DIR})
# fix includes not relative to rpm
INCLUDE_DIRECTORIES(${RPM_INCLUDE_DIR}/rpm)
if ( RPM_SUSPECT_VERSION STREQUAL "5.x" )
MESSAGE( STATUS "rpm found: enable rpm-4 compat interface." )
ADD_DEFINITIONS(-D_RPM_5)
elseif ( RPM_SUSPECT_VERSION STREQUAL "4.x" )
MESSAGE( STATUS "rpm found: use rpm-4.x interface." )
ADD_DEFINITIONS(-D_RPM_4_X)
elseif ( RPM_SUSPECT_VERSION STREQUAL "4.4" )
MESSAGE( STATUS "rpm found: enable rpm-4.4 legacy interface." )
ADD_DEFINITIONS(-D_RPM_4_4)
endif ( RPM_SUSPECT_VERSION STREQUAL "5.x" )
ENDIF( NOT RPM_FOUND)

FIND_PACKAGE(Boost REQUIRED COMPONENTS program_options unit_test_framework)
IF (Boost_FOUND)
MESSAGE( STATUS "boost found: includes in ${Boost_INCLUDE_DIRS}, library in ${Boost_LIBRARY_DIRS}")
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
ENDIF(Boost_FOUND)

FIND_PACKAGE(Gettext REQUIRED)
IF (GETTEXT_FOUND)
MESSAGE(STATUS "Found Gettext: ${GETTEXT_SOURCE}")
INCLUDE_DIRECTORIES(${GETTEXT_INCLUDE_DIR})
ELSE (GETTEXT_FOUND)
MESSAGE( FATAL_ERROR "Gettext not found" )
ENDIF (GETTEXT_FOUND)

FIND_PACKAGE(Curl REQUIRED)
IF ( NOT CURL_FOUND)
MESSAGE( FATAL_ERROR " curl not found" )
ELSE ( NOT CURL_FOUND)
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
ENDIF( NOT CURL_FOUND)

FIND_PACKAGE(Libxml REQUIRED)
IF ( NOT LIBXML_FOUND)
MESSAGE( FATAL_ERROR " libxml not found" )
ELSE ( NOT LIBXML_FOUND)
INCLUDE_DIRECTORIES(${LIBXML_INCLUDE_DIR})
ENDIF( NOT LIBXML_FOUND)

FIND_PACKAGE(ZLIB REQUIRED)
IF ( NOT ZLIB_FOUND)
MESSAGE( FATAL_ERROR " zlib not found" )
ELSE ( NOT ZLIB_FOUND)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
ENDIF( NOT ZLIB_FOUND)

#SET(LibSolv_USE_STATIC_LIBS ON)
FIND_PACKAGE(LibSolv REQUIRED ext)
IF ( NOT LibSolv_FOUND )
MESSAGE( FATAL_ERROR " libsolv not found" )
ELSE()
INCLUDE_DIRECTORIES( ${LibSolv_INCLUDE_DIRS} )
ENDIF()

# libsolv uses expat and has open references to it:
FIND_PACKAGE(EXPAT REQUIRED)

FIND_PACKAGE(OpenSSL REQUIRED)

FIND_PACKAGE(Udev)
IF ( NOT UDEV_FOUND )
FIND_PACKAGE(Hal)
IF ( NOT HAL_FOUND )
MESSAGE(WARNING "No udev or HAL. CD device detection will be poor")
ELSE ( NOT HAL_FOUND )
ADD_DEFINITIONS(-DHAVE_HAL)
INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR}/hal)
# HAL requires working dbus
FIND_PACKAGE(Dbus REQUIRED)
IF(DBUS_FOUND)
INCLUDE_DIRECTORIES(${DBUS_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${DBUS_ARCH_INCLUDE_DIR})
ENDIF(DBUS_FOUND)
ENDIF ( NOT HAL_FOUND )
ELSE ( NOT UDEV_FOUND )
ADD_DEFINITIONS(-DHAVE_UDEV)
ENDIF ( NOT UDEV_FOUND )

IF( DISABLE_LIBPROXY )
MESSAGE( STATUS "libproxy support disabled" )
ELSE( DISABLE_LIBPROXY )
FIND_PACKAGE(libproxy)
IF ( NOT LIBPROXY_FOUND )
MESSAGE( STATUS "libproxy not found" )
ELSE ( NOT LIBPROXY_FOUND )
INCLUDE_DIRECTORIES( ${LIBPROXY_INCLUDE_DIR} )
ADD_DEFINITIONS(-D_WITH_LIBPROXY_SUPPORT_)
ENDIF( NOT LIBPROXY_FOUND )
ENDIF( DISABLE_LIBPROXY )

FIND_PROGRAM( DOXYGEN doxygen )
IF ( NOT DOXYGEN )
IF ( DISABLE_AUTODOCS )
MESSAGE( STATUS "doxygen is not available. Can't build the documentation." )
ELSE ( DISABLE_AUTODOCS )
MESSAGE( FATAL_ERROR "doxygen not found: install doxygen to build the documentation!" )
ENDIF ( DISABLE_AUTODOCS )
ELSE ( NOT DOXYGEN )
MESSAGE( STATUS "doxygen found: ${DOXYGEN}" )
ENDIF ( NOT DOXYGEN )

MESSAGE(STATUS "soname: ${LIBZYPP_VERSION_INFO}")
MESSAGE(STATUS "version: ${VERSION}")

MESSAGE(STATUS "Writing pkg-config file...")
CONFIGURE_FILE(${LIBZYPP_SOURCE_DIR}/libzypp.pc.cmake ${LIBZYPP_BINARY_DIR}/libzypp.pc @ONLY)
INSTALL( FILES ${LIBZYPP_BINARY_DIR}/libzypp.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )

MESSAGE(STATUS "FindZypp.cmake will be installed in ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules")
INSTALL( FILES ${LIBZYPP_SOURCE_DIR}/cmake/modules/FindZypp.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules )
INSTALL( FILES ${LIBZYPP_SOURCE_DIR}/cmake/modules/ZyppCommon.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules )

####################################################################
# config templates
# (don't forget to mention them in the .spec file)
####################################################################

MESSAGE(STATUS "zypp.conf will be installed in ${SYSCONFDIR}/zypp")
INSTALL( FILES ${LIBZYPP_SOURCE_DIR}/zypp.conf DESTINATION ${SYSCONFDIR}/zypp )

#install systemCheck
MESSAGE(STATUS "systemCheck will be installed in ${SYSCONFDIR}/zypp")
INSTALL( FILES ${LIBZYPP_SOURCE_DIR}/systemCheck DESTINATION ${SYSCONFDIR}/zypp )

# logrotate config file
INSTALL( FILES ${LIBZYPP_SOURCE_DIR}/zypp-history.lr DESTINATION ${SYSCONFDIR}/logrotate.d )

####################################################################
# SUBDIRECTORIES #
####################################################################

ADD_SUBDIRECTORY( zypp )
#ADD_SUBDIRECTORY( zypp2 )
# do not build devel by default
ADD_SUBDIRECTORY( devel EXCLUDE_FROM_ALL )
ADD_SUBDIRECTORY( tools )
ADD_SUBDIRECTORY( examples )
ADD_SUBDIRECTORY( po EXCLUDE_FROM_ALL )
ADD_SUBDIRECTORY( doc )
ADD_SUBDIRECTORY( vendor )
ADD_SUBDIRECTORY( tests EXCLUDE_FROM_ALL )

INCLUDE(CTest)
ENABLE_TESTING()
21 changes: 21 additions & 0 deletions COPYING
@@ -0,0 +1,21 @@
/*---------------------------------------------------------------------\
| ____ _ __ __ ___ |
| |__ / \ / / . \ . \ |
| / / \ V /| _/ _/ |
| / /__ | | | | | | |
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/

Copyright (C) 2000-2002 Ximian, Inc.
Copyright (C) 2005 SUSE Linux Products GmbH

ZYpp is licensed under the GNU General Public License version 2
or later. The text of the GNU General Public License can be viewed at
http://www.gnu.org/licenses/gpl.html

As a special exception, you have permission to link this program
with the following libraries and distribute executables, as long as you
follow the requirements of the GNU GPL in regard to all of the
software in the executable aside from the following libraries:
- OpenSSL (http://www.openssl.org)
30 changes: 30 additions & 0 deletions Makefile.cvs
@@ -0,0 +1,30 @@
# Generic Makefile.cvs for CMake-based projects:
#
# Create a subdirecory build/ and call cmake from there with /usr prefix.
#
# Intentionally using /usr rather than the default /usr/local since this is for
# internal use, and we are the distribution makers: /usr/local is off limits
# for us.
#
# Author: Stefan Hundhammer <sh@suse.de>

BUILD_SUBDIR = build
HERE_FROM_BUILD_SUBDIR = ..
PREFIX = /usr
CMAKE = /usr/bin/cmake

all: cmake


cmake: create-build-subdir create-toplevel-makefile
( cd $(BUILD_SUBDIR) && $(CMAKE) -DCMAKE_INSTALL_PREFIX=$(PREFIX) $(HERE_FROM_BUILD_SUBDIR) )


create-build-subdir:
test -d $(BUILD_SUBDIR) || mkdir $(BUILD_SUBDIR)


create-toplevel-makefile:
echo 'all:' >Makefile
echo -e '\t$$(MAKE) $$(MAKEFLAGS) -C $(BUILD_SUBDIR)' >>Makefile

9 changes: 9 additions & 0 deletions TODO
@@ -0,0 +1,9 @@

API Cleanups:
=============

Source.h
- remove const from return types:
ie: const Pathname providePackage( Package::constPtr package );
- pass by reference
resolvables(zypp::Resolvable::Kind kind) const;
68 changes: 68 additions & 0 deletions VERSION.cmake
@@ -0,0 +1,68 @@
# ==================================================
# Versioning
# ==========
#
# MAJOR Major number for this branch.
#
# MINOR The most recent interface number this
# library implements.
#
# COMPATMINOR The latest binary compatible minor number
# this library implements.
#
# PATCH The implementation number of the current interface.
#
#
# - The package VERSION will be MAJOR.MINOR.PATCH.
#
# - Libtool's -version-info will be derived from MAJOR, MINOR, PATCH
# and COMPATMINOR (see configure.ac).
#
# - Changing MAJOR always breaks binary compatibility.
#
# - Changing MINOR doesn't break binary compatibility by default.
# Only if COMPATMINOR is changed as well.
#
#
# 1) After branching from TRUNK increment TRUNKs MAJOR and
# start with version `MAJOR.0.0' and also set COMPATMINOR to 0.
#
# 2) Update the version information only immediately before a public release
# of your software. More frequent updates are unnecessary, and only guarantee
# that the current interface number gets larger faster.
#
# 3) If the library source code has changed at all since the last update,
# then increment PATCH.
#
# 4) If any interfaces have been added, removed, or changed since the last
# update, increment MINOR, and set PATCH to 0.
#
# 5) If any interfaces have been added since the last public release, then
# leave COMPATMINOR unchanged. (binary compatible change)
#
# 6) If any interfaces have been removed since the last public release, then
# set COMPATMINOR to MINOR. (binary incompatible change)
# ==================================================

#=======
# - MOST IMPORTANT:
# - Before you submitt to git:
# - Remember the new version in 'LAST RELEASED:'
# - State the new version in the changes file by adding a line
# "- version MAJOR.MINOR.PATCH (COMPATMINOR)"
# - Commit changes and version files together in a separate
# commit using -m 'changes MAJOR.MINOR.PATCH (COMPATMINOR)'
# - Tag the above commit with 'MAJOR.MINOR.PATCH' using
# -m "tagging MAJOR.MINOR.PATCH".
#
# - Consider calling ./mkChangelog to assist you.
# See './mkChangelog -h' for help.
#
SET(LIBZYPP_MAJOR "12")
SET(LIBZYPP_COMPATMINOR "0")
SET(LIBZYPP_MINOR "2")
SET(LIBZYPP_PATCH "0")
#
# LAST RELEASED: 12.2.0 (0)
# (The number in parenthesis is LIBZYPP_COMPATMINOR)
#=======

0 comments on commit 252fc1e

Please sign in to comment.