mirror of https://github.com/c-ares/c-ares.git
Reorganize source tree (#349)
Originally started by Daniel Stenberg (@bagder) with #123, this patch reorganizes the c-ares source tree to have a more modern layout. It also fixes out of tree builds for autotools, and automatically builds the tests if tests are enabled. All tests are passing which tests each of the supported build systems (autotools, cmake, nmake, mingw gmake). There may be some edge cases that will have to be caught later on for things I'm not aware of. Fix By: Brad House (@bradh352)pull/354/head
parent
abe1ff1ff3
commit
0bf721cdd7
185 changed files with 646 additions and 1641 deletions
@ -0,0 +1,17 @@ |
||||
# Headers and Man Pages installation target |
||||
IF (CARES_INSTALL) |
||||
# ManPages |
||||
FILE (GLOB DevelManPages "." "*.3") |
||||
INSTALL (FILES ${DevelManPages} |
||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 |
||||
COMPONENT Devel |
||||
) |
||||
|
||||
IF (CARES_BUILD_TOOLS) |
||||
FILE (GLOB ToolManPages "." "*.1") |
||||
INSTALL (FILES ${ToolManPages} |
||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 |
||||
COMPONENT Tools |
||||
) |
||||
ENDIF () |
||||
ENDIF () |
@ -0,0 +1,51 @@ |
||||
#***************************************************************************
|
||||
|
||||
###########################################################################
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign subdir-objects no-dependencies
|
||||
|
||||
include Makefile.inc |
||||
|
||||
man_MANS = $(MANPAGES)
|
||||
|
||||
EXTRA_DIST = $(MANPAGES) ahost.1 adig.1 acountry.1 Makefile.inc CMakeLists.txt
|
||||
|
||||
SOURCEDMANDIR = man3
|
||||
SOURCEDMANPAGES = ares_init.3
|
||||
|
||||
clean-local: clean-sourced-manpages |
||||
|
||||
clean-sourced-manpages: |
||||
@srcdmandir='$(SOURCEDMANDIR)'; \
|
||||
echo "rm -rf $(top_builddir)/$$srcdmandir"; \
|
||||
rm -rf $(top_builddir)/$$srcdmandir
|
||||
|
||||
sourced-manpages: clean-sourced-manpages |
||||
@srcdmandir='$(SOURCEDMANDIR)'; \
|
||||
srcdmanfiles='$(SOURCEDMANPAGES)'; \
|
||||
mkdir $(top_builddir)/$$srcdmandir; \
|
||||
for file in $$srcdmanfiles; do \
|
||||
if test -f $(top_srcdir)/$$file; then \
|
||||
echo "cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file"; \
|
||||
cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
MAN2HTML = roffit --mandir=. < $< >$@
|
||||
|
||||
SUFFIXES = .3 .html
|
||||
|
||||
html: sourced-manpages $(HTMLPAGES) |
||||
|
||||
.3.html: |
||||
$(MAN2HTML)
|
||||
|
||||
pdf: sourced-manpages $(PDFPAGES) |
||||
|
||||
|
||||
.3.pdf: |
||||
@(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \
|
||||
groff -Tps -man $< >$$foo.ps; \
|
||||
ps2pdf $$foo.ps $@; \
|
||||
rm $$foo.ps; \
|
||||
echo "converted $< to $@")
|
@ -0,0 +1,8 @@ |
||||
# Write ares_build.h configuration file. This is an installed file. |
||||
CONFIGURE_FILE (ares_build.h.cmake ${PROJECT_BINARY_DIR}/ares_build.h) |
||||
|
||||
# Headers installation target |
||||
IF (CARES_INSTALL) |
||||
SET (CARES_HEADERS ares.h ares_version.h "${PROJECT_BINARY_DIR}/ares_build.h" ares_rules.h) |
||||
INSTALL (FILES ${CARES_HEADERS} COMPONENT Devel DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
||||
ENDIF () |
@ -0,0 +1,7 @@ |
||||
AUTOMAKE_OPTIONS = foreign nostdinc 1.9.6
|
||||
ACLOCAL_AMFLAGS = -I m4 --install
|
||||
|
||||
# what headers to install on 'make install':
|
||||
include_HEADERS = ares.h ares_version.h ares_build.h ares_rules.h
|
||||
|
||||
EXTRA_DIST = ares_build.h.cmake ares_build.h.in ares_build.h.dist CMakeLists.txt
|
@ -0,0 +1,2 @@ |
||||
ADD_SUBDIRECTORY (lib) |
||||
ADD_SUBDIRECTORY (tools) |
@ -0,0 +1,2 @@ |
||||
EXTRA_DIST=CMakeLists.txt
|
||||
SUBDIRS=lib tools
|
@ -0,0 +1,115 @@ |
||||
|
||||
# Transform Makefile.inc |
||||
transform_makefile_inc("Makefile.inc" "${PROJECT_BINARY_DIR}/src/lib/Makefile.inc.cmake") |
||||
include(${PROJECT_BINARY_DIR}/src/lib/Makefile.inc.cmake) |
||||
|
||||
# Write ares_config.h configuration file. This is used only for the build. |
||||
CONFIGURE_FILE (ares_config.h.cmake ${PROJECT_BINARY_DIR}/ares_config.h) |
||||
|
||||
# Build the dynamic/shared library |
||||
IF (CARES_SHARED) |
||||
ADD_LIBRARY (${PROJECT_NAME} SHARED ${CSOURCES}) |
||||
|
||||
# Convert CARES_LIB_VERSIONINFO libtool version format into VERSION and SOVERSION |
||||
# Convert from ":" separated into CMake list format using ";" |
||||
STRING (REPLACE ":" ";" CARES_LIB_VERSIONINFO ${CARES_LIB_VERSIONINFO}) |
||||
LIST (GET CARES_LIB_VERSIONINFO 0 CARES_LIB_VERSION_CURRENT) |
||||
LIST (GET CARES_LIB_VERSIONINFO 1 CARES_LIB_VERSION_REVISION) |
||||
LIST (GET CARES_LIB_VERSIONINFO 2 CARES_LIB_VERSION_AGE) |
||||
MATH (EXPR CARES_LIB_VERSION_MAJOR "${CARES_LIB_VERSION_CURRENT} - ${CARES_LIB_VERSION_AGE}") |
||||
SET (CARES_LIB_VERSION_MINOR "${CARES_LIB_VERSION_AGE}") |
||||
SET (CARES_LIB_VERSION_RELEASE "${CARES_LIB_VERSION_REVISION}") |
||||
|
||||
SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES |
||||
EXPORT_NAME cares |
||||
OUTPUT_NAME cares |
||||
COMPILE_PDB_NAME cares |
||||
COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} |
||||
SOVERSION ${CARES_LIB_VERSION_MAJOR} |
||||
VERSION "${CARES_LIB_VERSION_MAJOR}.${CARES_LIB_VERSION_MINOR}.${CARES_LIB_VERSION_RELEASE}" |
||||
) |
||||
|
||||
TARGET_INCLUDE_DIRECTORIES (${PROJECT_NAME} |
||||
PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>" |
||||
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>" |
||||
"$<BUILD_INTERFACE:${CARES_TOPLEVEL_DIR}/include>" |
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" |
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" |
||||
) |
||||
|
||||
TARGET_COMPILE_DEFINITIONS (${PROJECT_NAME} PRIVATE HAVE_CONFIG_H=1 CARES_BUILDING_LIBRARY) |
||||
|
||||
TARGET_LINK_LIBRARIES (${PROJECT_NAME} PUBLIC ${CARES_DEPENDENT_LIBS}) |
||||
|
||||
IF (CARES_INSTALL) |
||||
INSTALL (TARGETS ${PROJECT_NAME} |
||||
EXPORT ${PROJECT_NAME}-targets |
||||
COMPONENT Library |
||||
${TARGETS_INST_DEST} |
||||
) |
||||
INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cares.pdb |
||||
DESTINATION ${CMAKE_INSTALL_BINDIR} |
||||
COMPONENT Library |
||||
OPTIONAL |
||||
) |
||||
ENDIF () |
||||
SET (STATIC_SUFFIX "_static") |
||||
|
||||
# For chain building: add alias targets that look like import libs that would be returned by find_package(c-ares). |
||||
ADD_LIBRARY (${PROJECT_NAME}::cares_shared ALIAS ${PROJECT_NAME}) |
||||
ADD_LIBRARY (${PROJECT_NAME}::cares ALIAS ${PROJECT_NAME}) |
||||
ENDIF () |
||||
|
||||
# Build the static library |
||||
IF (CARES_STATIC) |
||||
SET (LIBNAME ${PROJECT_NAME}${STATIC_SUFFIX}) |
||||
|
||||
ADD_LIBRARY (${LIBNAME} STATIC ${CSOURCES}) |
||||
|
||||
SET_TARGET_PROPERTIES (${LIBNAME} PROPERTIES |
||||
EXPORT_NAME cares${STATIC_SUFFIX} |
||||
OUTPUT_NAME cares${STATIC_SUFFIX} |
||||
COMPILE_PDB_NAME cares${STATIC_SUFFIX} |
||||
COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} |
||||
) |
||||
|
||||
IF (CARES_STATIC_PIC) |
||||
SET_TARGET_PROPERTIES (${LIBNAME} PROPERTIES POSITION_INDEPENDENT_CODE True) |
||||
ENDIF () |
||||
|
||||
TARGET_INCLUDE_DIRECTORIES (${LIBNAME} |
||||
PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>" |
||||
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>" |
||||
"$<BUILD_INTERFACE:${CARES_TOPLEVEL_DIR}/include>" |
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" |
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" |
||||
) |
||||
|
||||
TARGET_COMPILE_DEFINITIONS (${LIBNAME} |
||||
PUBLIC CARES_STATICLIB |
||||
PRIVATE HAVE_CONFIG_H=1 |
||||
) |
||||
|
||||
TARGET_LINK_LIBRARIES (${LIBNAME} PUBLIC ${CARES_DEPENDENT_LIBS}) |
||||
IF (CARES_INSTALL) |
||||
INSTALL (TARGETS ${LIBNAME} EXPORT ${PROJECT_NAME}-targets COMPONENT Devel |
||||
${TARGETS_INST_DEST} |
||||
) |
||||
INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cares${STATIC_SUFFIX}.pdb |
||||
DESTINATION ${CMAKE_INSTALL_BINDIR} |
||||
COMPONENT Library |
||||
OPTIONAL |
||||
) |
||||
ENDIF () |
||||
|
||||
# For chain building: add alias targets that look like import libs that would be returned by find_package(c-ares). |
||||
ADD_LIBRARY (${PROJECT_NAME}::cares_static ALIAS ${LIBNAME}) |
||||
IF (NOT TARGET ${PROJECT_NAME}::cares) |
||||
# Only use static for the generic alias if shared lib wasn't built. |
||||
ADD_LIBRARY (${PROJECT_NAME}::cares ALIAS ${LIBNAME}) |
||||
ENDIF () |
||||
ENDIF () |
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,72 @@ |
||||
AUTOMAKE_OPTIONS = foreign subdir-objects nostdinc 1.9.6
|
||||
ACLOCAL_AMFLAGS = -I m4 --install
|
||||
|
||||
# Specify our include paths here, and do it relative to $(top_srcdir) and
|
||||
# $(top_builddir), to ensure that these paths which belong to the library
|
||||
# being currently built and tested are searched before the library which
|
||||
# might possibly already be installed in the system.
|
||||
|
||||
AM_CPPFLAGS = -I$(top_builddir)/include \
|
||||
-I$(top_builddir)/src/lib \
|
||||
-I$(top_srcdir)/include
|
||||
|
||||
lib_LTLIBRARIES = libcares.la
|
||||
|
||||
man_MANS = $(MANPAGES)
|
||||
|
||||
# adig and ahost are just sample programs and thus not mentioned with the
|
||||
# regular sources and headers
|
||||
EXTRA_DIST = Makefile.inc config-win32.h CMakeLists.txt \
|
||||
ares_config.h.in ares_config.h.cmake cares.rc \
|
||||
$(CSOURCES) $(HHEADERS) config-dos.h
|
||||
|
||||
DISTCLEANFILES = ares_config.h
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
AM_LDFLAGS =
|
||||
|
||||
libcares_la_LDFLAGS_EXTRA =
|
||||
|
||||
if CARES_LT_SHLIB_USE_VERSION_INFO |
||||
libcares_la_LDFLAGS_EXTRA += $(CARES_VERSION_INFO)
|
||||
endif |
||||
|
||||
if CARES_LT_SHLIB_USE_NO_UNDEFINED |
||||
libcares_la_LDFLAGS_EXTRA += -no-undefined
|
||||
endif |
||||
|
||||
if CARES_LT_SHLIB_USE_MIMPURE_TEXT |
||||
libcares_la_LDFLAGS_EXTRA += -mimpure-text
|
||||
endif |
||||
|
||||
libcares_la_LDFLAGS = $(AM_LDFLAGS) $(libcares_la_LDFLAGS_EXTRA)
|
||||
|
||||
# Add -Werror if defined
|
||||
CFLAGS += @CARES_CFLAG_EXTRAS@
|
||||
|
||||
if USE_CPPFLAG_CARES_STATICLIB |
||||
AM_CPPFLAGS += $(CPPFLAG_CARES_STATICLIB)
|
||||
endif |
||||
|
||||
libcares_la_CFLAGS_EXTRA =
|
||||
|
||||
libcares_la_CPPFLAGS_EXTRA = -DCARES_BUILDING_LIBRARY
|
||||
|
||||
if DOING_CARES_SYMBOL_HIDING |
||||
libcares_la_CFLAGS_EXTRA += $(CFLAG_CARES_SYMBOL_HIDING)
|
||||
libcares_la_CPPFLAGS_EXTRA += -DCARES_SYMBOL_HIDING
|
||||
endif |
||||
|
||||
@CODE_COVERAGE_RULES@ |
||||
libcares_la_LDFLAGS += $(CODE_COVERAGE_LDFLAGS)
|
||||
libcares_la_CFLAGS_EXTRA += $(CODE_COVERAGE_CFLAGS)
|
||||
|
||||
libcares_la_CFLAGS = $(AM_CFLAGS) $(libcares_la_CFLAGS_EXTRA)
|
||||
|
||||
libcares_la_CPPFLAGS = $(AM_CPPFLAGS) $(libcares_la_CPPFLAGS_EXTRA)
|
||||
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
include Makefile.inc |
||||
|
||||
libcares_la_SOURCES = $(CSOURCES) $(HHEADERS)
|
@ -0,0 +1,79 @@ |
||||
|
||||
CSOURCES = ares__close_sockets.c \ |
||||
ares__get_hostent.c \ |
||||
ares__parse_into_addrinfo.c \ |
||||
ares__readaddrinfo.c \ |
||||
ares__sortaddrinfo.c \ |
||||
ares__read_line.c \ |
||||
ares__timeval.c \ |
||||
ares_android.c \ |
||||
ares_cancel.c \ |
||||
ares_data.c \ |
||||
ares_destroy.c \ |
||||
ares_expand_name.c \ |
||||
ares_expand_string.c \ |
||||
ares_fds.c \ |
||||
ares_free_hostent.c \ |
||||
ares_free_string.c \ |
||||
ares_freeaddrinfo.c \ |
||||
ares_getaddrinfo.c \ |
||||
ares_getenv.c \ |
||||
ares_gethostbyaddr.c \ |
||||
ares_gethostbyname.c \ |
||||
ares_getnameinfo.c \ |
||||
ares_getsock.c \ |
||||
ares_init.c \ |
||||
ares_library_init.c \ |
||||
ares_llist.c \ |
||||
ares_mkquery.c \ |
||||
ares_create_query.c \ |
||||
ares_nowarn.c \ |
||||
ares_options.c \ |
||||
ares_parse_a_reply.c \ |
||||
ares_parse_aaaa_reply.c \ |
||||
ares_parse_mx_reply.c \ |
||||
ares_parse_naptr_reply.c \ |
||||
ares_parse_ns_reply.c \ |
||||
ares_parse_ptr_reply.c \ |
||||
ares_parse_soa_reply.c \ |
||||
ares_parse_srv_reply.c \ |
||||
ares_parse_txt_reply.c \ |
||||
ares_platform.c \ |
||||
ares_process.c \ |
||||
ares_query.c \ |
||||
ares_search.c \ |
||||
ares_send.c \ |
||||
ares_strcasecmp.c \ |
||||
ares_strdup.c \ |
||||
ares_strerror.c \ |
||||
ares_strsplit.c \ |
||||
ares_timeout.c \ |
||||
ares_version.c \ |
||||
ares_writev.c \ |
||||
bitncmp.c \ |
||||
inet_net_pton.c \ |
||||
inet_ntop.c \ |
||||
windows_port.c |
||||
|
||||
HHEADERS = ares_android.h \ |
||||
ares_data.h \ |
||||
ares_dns.h \ |
||||
ares_getenv.h \ |
||||
ares_inet_net_pton.h \ |
||||
ares_iphlpapi.h \ |
||||
ares_ipv6.h \ |
||||
ares_library_init.h \ |
||||
ares_llist.h \ |
||||
ares_nowarn.h \ |
||||
ares_platform.h \ |
||||
ares_private.h \ |
||||
ares_strcasecmp.h \ |
||||
ares_strdup.h \ |
||||
ares_strsplit.h \ |
||||
ares_writev.h \ |
||||
bitncmp.h \ |
||||
nameser.h \ |
||||
ares_setup.h \ |
||||
setup_once.h |
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue