Description: build static libs and remove ebl dependency
 
 Build static libraries instead of shared libaries so that we have a single
 package.
 
 Do not try to find and link with libebl.so as it is no longer provided by
 elfutils.

Origin: Thomas Girard <thomas.g.girard@free.fr>
Forwarded: no
Last-Update: 2012-06-07

--- dwarves-dfsg-1.10.orig/CMakeLists.txt
+++ dwarves-dfsg-1.10/CMakeLists.txt
@@ -36,19 +36,15 @@ _set_fancy(LIB_INSTALL_DIR "${EXEC_INSTA
 set(dwarves_LIB_SRCS dwarves.c dwarves_fprintf.c gobuffer strings
 		     ctf_encoder.c ctf_loader.c libctf.c dwarf_loader.c
 		     dutil.c elf_symtab.c rbtree.c)
-add_library(dwarves SHARED ${dwarves_LIB_SRCS})
-set_target_properties(dwarves PROPERTIES VERSION 1.0.0 SOVERSION 1)
-set_target_properties(dwarves PROPERTIES LINK_INTERFACE_LIBRARIES "")
+add_library(dwarves STATIC ${dwarves_LIB_SRCS})
 target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES})
 
 set(dwarves_emit_LIB_SRCS dwarves_emit.c)
-add_library(dwarves_emit SHARED ${dwarves_emit_LIB_SRCS})
-set_target_properties(dwarves_emit PROPERTIES VERSION 1.0.0 SOVERSION 1)
+add_library(dwarves_emit STATIC ${dwarves_emit_LIB_SRCS})
 target_link_libraries(dwarves_emit dwarves)
 
 set(dwarves_reorganize_LIB_SRCS dwarves_reorganize.c)
-add_library(dwarves_reorganize SHARED ${dwarves_reorganize_LIB_SRCS})
-set_target_properties(dwarves_reorganize PROPERTIES VERSION 1.0.0 SOVERSION 1)
+add_library(dwarves_reorganize STATIC ${dwarves_reorganize_LIB_SRCS})
 target_link_libraries(dwarves_reorganize dwarves)
 
 set(codiff_SRCS codiff.c)
@@ -94,11 +90,6 @@ target_link_libraries(syscse dwarves)
 install(TARGETS codiff ctracer dtagnames pahole pdwtags
 		pfunct pglobal prefcnt scncopy syscse RUNTIME DESTINATION
 		${CMAKE_INSTALL_PREFIX}/bin)
-install(TARGETS dwarves LIBRARY DESTINATION ${LIB_INSTALL_DIR})
-install(TARGETS dwarves dwarves_emit dwarves_reorganize LIBRARY DESTINATION ${LIB_INSTALL_DIR})
-install(FILES dwarves.h dwarves_emit.h dwarves_reorganize.h
-	      dutil.h gobuffer.h list.h rbtree.h strings.h
-	DESTINATION ${CMAKE_INSTALL_PREFIX}/include/dwarves/)
 install(FILES man-pages/pahole.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1/)
 install(PROGRAMS ostra/ostra-cg DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
 install(FILES ostra/python/ostra.py DESTINATION ${CMAKE_INSTALL_PREFIX}/share/dwarves/runtime/python)
--- dwarves-dfsg-1.10.orig/cmake/modules/FindDWARF.cmake
+++ dwarves-dfsg-1.10/cmake/modules/FindDWARF.cmake
@@ -29,22 +29,19 @@ find_path(LIBDW_INCLUDE_DIR elfutils/lib
 
 find_library(DWARF_LIBRARY
 	NAMES dw dwarf
-	PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 ~/usr/local/lib ~/usr/local/lib64
+	PATHS /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} /usr/lib
+	NO_DEFAULT_PATH
 )
 
 find_library(ELF_LIBRARY
 	NAMES elf
-	PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 ~/usr/local/lib ~/usr/local/lib64
+	PATHS /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} /usr/lib
+	NO_DEFAULT_PATH
 )
 
-find_library(EBL_LIBRARY
-	NAMES ebl
-	PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 ~/usr/local/lib ~/usr/local/lib64
-)
-
-if (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY AND EBL_LIBRARY)
+if (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY)
 	set(DWARF_FOUND TRUE)
-	set(DWARF_LIBRARIES ${DWARF_LIBRARY} ${ELF_LIBRARY} ${EBL_LIBRARY})
+	set(DWARF_LIBRARIES ${DWARF_LIBRARY} ${ELF_LIBRARY})
 
 	set(CMAKE_REQUIRED_LIBRARIES ${DWARF_LIBRARIES})
 	# check if libdw have the dwfl_module_build_id routine, i.e. if it supports the buildid
@@ -52,10 +49,10 @@ if (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_
 	# in distributions such as fedora). We do it against libelf because, IIRC, some distros
 	# include libdw linked statically into libelf.
 	check_library_exists(elf dwfl_module_build_id "" HAVE_DWFL_MODULE_BUILD_ID)
-else (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY AND EBL_LIBRARY)
+else (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY)
 	set(DWARF_FOUND FALSE)
 	set(DWARF_LIBRARIES)
-endif (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY AND EBL_LIBRARY)
+endif (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY)
 
 if (DWARF_FOUND)
 	if (NOT DWARF_FIND_QUIETLY)
@@ -63,7 +60,6 @@ if (DWARF_FOUND)
 		message(STATUS "Found elfutils/libdw.h header: ${LIBDW_INCLUDE_DIR}")
 		message(STATUS "Found libdw library: ${DWARF_LIBRARY}")
 		message(STATUS "Found libelf library: ${ELF_LIBRARY}")
-		message(STATUS "Found libebl library: ${EBL_LIBRARY}")
 	endif (NOT DWARF_FIND_QUIETLY)
 else (DWARF_FOUND)
 	if (DWARF_FIND_REQUIRED)
@@ -73,9 +69,9 @@ else (DWARF_FOUND)
 		find_path(FEDORA fedora-release /etc)
 		find_path(REDHAT redhat-release /etc)
 		if (FEDORA OR REDHAT)
-			if (NOT DWARF_INCLUDE_DIR OR NOT LIBDW_INCLUDE_DIR OR NOT EBL_LIBRARY)
+			if (NOT DWARF_INCLUDE_DIR OR NOT LIBDW_INCLUDE_DIR)
 				message(STATUS "Please install the elfutils-devel package")
-			endif (NOT DWARF_INCLUDE_DIR OR NOT LIBDW_INCLUDE_DIR OR NOT EBL_LIBRARY)
+			endif (NOT DWARF_INCLUDE_DIR OR NOT LIBDW_INCLUDE_DIR)
 			if (NOT DWARF_LIBRARY)
 				message(STATUS "Please install the elfutils-libs package")
 			endif (NOT DWARF_LIBRARY)
@@ -89,9 +85,6 @@ else (DWARF_FOUND)
 			if (NOT LIBDW_INCLUDE_DIR)
 				message(STATUS "Could NOT find libdw include dir")
 			endif (NOT LIBDW_INCLUDE_DIR)
-			if (NOT EBL_LIBRARY)
-				message(STATUS "Could NOT find libebl library")
-			endif (NOT EBL_LIBRARY)
 			if (NOT DWARF_LIBRARY)
 				message(STATUS "Could NOT find libdw library")
 			endif (NOT DWARF_LIBRARY)
@@ -103,7 +96,7 @@ else (DWARF_FOUND)
 	endif (DWARF_FIND_REQUIRED)
 endif (DWARF_FOUND)
 
-mark_as_advanced(DWARF_INCLUDE_DIR LIBDW_INCLUDE_DIR DWARF_LIBRARY ELF_LIBRARY EBL_LIBRARY)
+mark_as_advanced(DWARF_INCLUDE_DIR LIBDW_INCLUDE_DIR DWARF_LIBRARY ELF_LIBRARY)
 include_directories(${DWARF_INCLUDE_DIR} ${LIBDW_INCLUDE_DIR})
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
 
