diff options
author | Julian Andres Klode <jak@debian.org> | 2016-08-10 16:19:00 +0200 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2016-08-10 16:19:00 +0200 |
commit | e02c3a9ec2b2f7a8d4aecd70f2ecdae27c207aa9 (patch) | |
tree | ffa99f96949f3eab728a1b8caecdd014ea8d6f81 /apt-pkg | |
parent | b2cfacf1180e4b3fcbb2ae2ea52cf270ef74e971 (diff) | |
parent | 61fef4ddbec8f70bb9e213ac0491d4e6cfefab30 (diff) |
Merge branch 'cmake'
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/CMakeLists.txt | 46 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 2 | ||||
-rw-r--r-- | apt-pkg/makefile | 37 |
3 files changed, 47 insertions, 38 deletions
diff --git a/apt-pkg/CMakeLists.txt b/apt-pkg/CMakeLists.txt new file mode 100644 index 000000000..ec78f49c4 --- /dev/null +++ b/apt-pkg/CMakeLists.txt @@ -0,0 +1,46 @@ +# Include apt-pkg directly, as some files have #include <system.h> +include_directories(${PROJECT_BINARY_DIR}/include/apt-pkg) + +add_definitions("-DAPT_PKG_EXPOSE_STRING_VIEW") + +# Set the version of the library +execute_process(COMMAND awk -v ORS=. "/^\#define APT_PKG_M/ {print \$3}" + COMMAND sed "s/\\.\$//" + INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/macros.h + OUTPUT_VARIABLE MAJOR OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process(COMMAND grep "^#define APT_PKG_RELEASE" + COMMAND cut -d " " -f 3 + INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/macros.h + OUTPUT_VARIABLE MINOR OUTPUT_STRIP_TRAILING_WHITESPACE) + +message(STATUS "Building libapt-pkg ${MAJOR} (release ${MINOR})") +set(APT_PKG_MAJOR ${MAJOR} PARENT_SCOPE) # exporting for methods/CMakeLists.txt + +# Definition of the C++ files used to build the library +file(GLOB_RECURSE library "*.cc") +file(GLOB_RECURSE headers "*.h") + +# Create a library using the C++ files +add_library(apt-pkg SHARED ${library}) +add_dependencies(apt-pkg apt-pkg-versionscript) +# Link the library and set the SONAME +target_include_directories(apt-pkg + PRIVATE ${ZLIB_INCLUDE_DIRS} + ${BZIP2_INCLUDE_DIRS} + ${LZMA_INCLUDE_DIRS} + ${LZ4_INCLUDE_DIRS}) +target_link_libraries(apt-pkg + PRIVATE -lutil -ldl -lresolv + ${CMAKE_THREAD_LIBS_INIT} + ${ZLIB_LIBRARIES} + ${BZIP2_LIBRARIES} + ${LZMA_LIBRARIES} + ${LZ4_LIBRARIES}) +set_target_properties(apt-pkg PROPERTIES VERSION ${MAJOR}.${MINOR}) +set_target_properties(apt-pkg PROPERTIES SOVERSION ${MAJOR}) +add_version_script(apt-pkg) + +# Install the library and the header files +install(TARGETS apt-pkg LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/apt-pkg) +flatify(${PROJECT_BINARY_DIR}/include/apt-pkg/ "${headers}") diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 6aa1ce426..3d0fd622c 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1094,7 +1094,7 @@ void pkgDPkgPM::StartPtyMagic() /*{{{*/ _error->Errno("unlockpt", "Unlocking the slave of master fd %d failed!", d->master); else { -#ifdef HAVE_PTS_NAME_R +#ifdef HAVE_PTSNAME_R char slave_name[64]; // 64 is used by bionic if (ptsname_r(d->master, slave_name, sizeof(slave_name)) != 0) #else diff --git a/apt-pkg/makefile b/apt-pkg/makefile deleted file mode 100644 index 789d3f2fd..000000000 --- a/apt-pkg/makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -*- make -*- -BASE=.. -SUBDIR=apt-pkg - -# Header location -SUBDIRS = deb edsp contrib -HEADER_TARGETDIRS = apt-pkg - -# Bring in the default rules -include ../buildlib/defaults.mak - -# The library name and version (indirectly used from init.h) -include ../buildlib/libversion.mak - -CPPFLAGS+=-DAPT_PKG_EXPOSE_STRING_VIEW -LIBRARY=apt-pkg -MAJOR=$(LIBAPTPKG_MAJOR) -MINOR=$(LIBAPTPKG_RELEASE) -SLIBS=$(PTHREADLIB) $(INTLLIBS) -lutil -ldl -lresolv -ifeq ($(HAVE_ZLIB),yes) -SLIBS+= -lz -endif -ifeq ($(HAVE_BZ2),yes) -SLIBS+= -lbz2 -endif -ifeq ($(HAVE_LZMA),yes) -SLIBS+= -llzma -endif -ifeq ($(HAVE_LZ4),yes) -SLIBS+= -llz4 -endif -APT_DOMAIN:=libapt-pkg$(LIBAPTPKG_MAJOR) - -SOURCE = $(sort $(wildcard *.cc */*.cc)) -HEADERS = $(addprefix apt-pkg/,$(notdir $(sort $(wildcard *.h */*.h)))) - -include $(LIBRARY_H) |