From 8ac0b9532a34383d22b76ff7e274e32780891dc1 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 11 Jun 2010 19:36:06 +0200 Subject: Switching build system again Now it's plain make. --- .gitignore | 7 +-- CMakeLists.txt | 9 --- INSTALL | 32 ++++++++--- Makefile | 125 +++++++++++++++++++++++++++++++++++++++++ libezxml/CMakeLists.txt | 7 --- libezxml/src/CMakeLists.txt | 4 -- libpiano/CMakeLists.txt | 6 -- libpiano/src/CMakeLists.txt | 12 ---- libwaitress/CMakeLists.txt | 6 -- libwaitress/src/CMakeLists.txt | 23 -------- src/CMakeLists.txt | 73 ------------------------ src/FindFaad.cmake | 35 ------------ src/FindLibAo.cmake | 37 ------------ src/FindMad.cmake | 35 ------------ src/config.h.in | 11 ---- 15 files changed, 150 insertions(+), 272 deletions(-) delete mode 100644 CMakeLists.txt create mode 100644 Makefile delete mode 100644 libezxml/CMakeLists.txt delete mode 100644 libezxml/src/CMakeLists.txt delete mode 100644 libpiano/CMakeLists.txt delete mode 100644 libpiano/src/CMakeLists.txt delete mode 100644 libwaitress/CMakeLists.txt delete mode 100644 libwaitress/src/CMakeLists.txt delete mode 100644 src/CMakeLists.txt delete mode 100644 src/FindFaad.cmake delete mode 100644 src/FindLibAo.cmake delete mode 100644 src/FindMad.cmake delete mode 100644 src/config.h.in diff --git a/.gitignore b/.gitignore index 4c105f4..28c74fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,5 @@ *.o +*.lo # vim swap files .*.sw* -Makefile config.h -CMakeCache.txt -CMakeFiles/ -cmake_install.cmake -*.a -install_manifest.txt diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index fa6fcde..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required (VERSION 2.4) - -set (PACKAGE pianobar) -project (${PACKAGE} C) - -add_subdirectory (libpiano) -add_subdirectory (libwaitress) -add_subdirectory (libezxml) -add_subdirectory (src) diff --git a/INSTALL b/INSTALL index 50d7cbd..60f2a80 100644 --- a/INSTALL +++ b/INSTALL @@ -4,9 +4,7 @@ Install Dependencies ------------ -Versions may vary :) Just get the newest one: - -cmake +make libao http://www.xiph.org/ao/ libfaad2 http://www.audiocoding.com/downloads.html AND/OR libmad http://www.underbit.com/products/mad/ @@ -16,10 +14,28 @@ UTF-8 console/locale! Building -------- -cmake . -make -make install +If you have all of the dependencies listed above just type -You can run the client directly from the source directory: + make clean && make + +You can run the client directly from the source directory now -./src/pianobar + ./pianobar + +Or install it by issuing + + make install + +In case you don't want to install libmad OR libfaad you probably want to +disable one of them: + + make clean && make DISABLE_FAAD=1 + +or + + make clean && make DISABLE_MAD=1 + +libpiano can be built and installed by running + + make clean && make libpiano && make install-libpiano + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ebf23fb --- /dev/null +++ b/Makefile @@ -0,0 +1,125 @@ +# makefile of pianobar + +PREFIX:=/usr/local +BINDIR:=${PREFIX}/bin +LIBDIR:=${PREFIX}/lib +MANDIR:=${PREFIX}/share/man +CFLAGS:=-Wall -g -std=c99 -pedantic + +PIANOBAR_DIR=src +PIANOBAR_SRC=\ + ${PIANOBAR_DIR}/main.c \ + ${PIANOBAR_DIR}/player.c \ + ${PIANOBAR_DIR}/settings.c \ + ${PIANOBAR_DIR}/terminal.c \ + ${PIANOBAR_DIR}/ui_act.c \ + ${PIANOBAR_DIR}/ui.c \ + ${PIANOBAR_DIR}/ui_readline.c +PIANOBAR_HDR=\ + ${PIANOBAR_DIR}/player.h \ + ${PIANOBAR_DIR}/settings.h \ + ${PIANOBAR_DIR}/terminal.h \ + ${PIANOBAR_DIR}/ui_act.h \ + ${PIANOBAR_DIR}/ui.h \ + ${PIANOBAR_DIR}/ui_readline.h +PIANOBAR_OBJ=${PIANOBAR_SRC:.c=.o} + +LIBPIANO_DIR=libpiano/src +LIBPIANO_SRC=\ + ${LIBPIANO_DIR}/crypt.c \ + ${LIBPIANO_DIR}/piano.c \ + ${LIBPIANO_DIR}/xml.c +LIBPIANO_HDR=\ + ${LIBPIANO_DIR}/config.h \ + ${LIBPIANO_DIR}/crypt_key_output.h \ + ${LIBPIANO_DIR}/xml.h \ + ${LIBPIANO_DIR}/crypt.h \ + ${LIBPIANO_DIR}/piano.h \ + ${LIBPIANO_DIR}/crypt_key_input.h \ + ${LIBPIANO_DIR}/piano_private.h +LIBPIANO_OBJ=${LIBPIANO_SRC:.c=.o} +LIBPIANO_RELOBJ=${LIBPIANO_SRC:.c=.lo} +LIBPIANO_INCLUDE=${LIBPIANO_DIR} + +LIBWAITRESS_DIR=libwaitress/src +LIBWAITRESS_SRC=${LIBWAITRESS_DIR}/waitress.c +LIBWAITRESS_HDR=\ + ${LIBWAITRESS_DIR}/config.h \ + ${LIBWAITRESS_DIR}/waitress.h +LIBWAITRESS_OBJ=${LIBWAITRESS_SRC:.c=.o} +LIBWAITRESS_RELOBJ=${LIBWAITRESS_SRC:.c=.lo} +LIBWAITRESS_INCLUDE=${LIBWAITRESS_DIR} + +LIBEZXML_SRC=libezxml/src/ezxml.c +LIBEZXML_HDR=libezxml/src/ezxml.h +LIBEZXML_OBJ=${LIBEZXML_SRC:.c=.o} +LIBEZXML_RELOBJ=${LIBEZXML_SRC:.c=.lo} +LIBEZXML_INCLUDE=libezxml/src + +LIBAO_INCLUDE=/usr/include +LIBAO_LIB=-lao + +LIBM_LIB=-lm + +ifeq (${DISABLE_FAAD}, 1) + LIBFAAD_INCLUDE= + LIBFAAD_LIB= + LIBFAAD_SWITCH= +else + LIBFAAD_INCLUDE:=/usr/include + LIBFAAD_LIB:=-lfaad + LIBFAAD_SWITCH=-DENABLE_FAAD +endif + +ifeq (${DISABLE_MAD}, 1) + LIBMAD_INCLUDE= + LIBMAD_LIB= + LIBMAD_SWITCH= +else + LIBMAD_INCLUDE:=/usr/include + LIBMAD_LIB:=-lmad + LIBMAD_SWITCH=-DENABLE_MAD +endif + +PTHREAD_LIB=-pthread + +# build pianobar +pianobar: ${PIANOBAR_OBJ} ${PIANOBAR_HDR} ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} \ + ${LIBWAITRESS_HDR} ${LIBEZXML_OBJ} ${LIBEZXML_HDR} + ${CC} ${CFLAGS} ${PIANOBAR_OBJ} ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} \ + ${LIBEZXML_OBJ} ${LIBAO_LIB} ${LIBFAAD_LIB} ${LIBMAD_LIB} \ + ${PTHREAD_LIB} ${LIBM_LIB} -o $@ + +# build shared libpiano +libpiano: ${LIBPIANO_RELOBJ} ${LIBPIANO_HDR} ${LIBWAITRESS_RELOBJ} \ + ${LIBWAITRESS_HDR} ${LIBEZXML_RELOBJ} ${LIBEZXML_HDR} + ${CC} -shared ${CFLAGS} ${LIBPIANO_RELOBJ} ${LIBWAITRESS_RELOBJ} \ + ${LIBEZXML_RELOBJ} -o $@.so.0.0.0 + +%.o: %.c + ${CC} ${CFLAGS} -I ${LIBPIANO_INCLUDE} -I ${LIBWAITRESS_INCLUDE} \ + -I ${LIBEZXML_INCLUDE} ${LIBFAAD_SWITCH} ${LIBMAD_SWITCH} -c \ + -o $@ $< + +# create position independent code (for shared libraries) +%.lo: %.c + ${CC} ${CFLAGS} -I ${LIBPIANO_INCLUDE} -I ${LIBWAITRESS_INCLUDE} \ + -I ${LIBEZXML_INCLUDE} -c -fPIC -o $@ $< + +clean: + ${RM} ${PIANOBAR_OBJ} ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} ${LIBEZXML_OBJ} \ + ${LIBPIANO_RELOBJ} ${LIBWAITRESS_RELOBJ} ${LIBEZXML_RELOBJ} pianobar \ + libpiano.so.0.0.0 + +all: pianobar libpiano + +install: pianobar + install -d ${DESTDIR}/${BINDIR}/ + install -m755 pianobar ${DESTDIR}/${BINDIR}/ + install -d ${DESTDIR}/${MANDIR}/man1/ + install -m644 src/pianobar.1 ${DESTDIR}/${MANDIR}/man1/ + +install-libpiano: libpiano + install -d ${DESTDIR}/${LIBDIR}/ + install -m755 libpiano.so.0.0.0 ${DESTDIR}/${LIBDIR}/ + diff --git a/libezxml/CMakeLists.txt b/libezxml/CMakeLists.txt deleted file mode 100644 index edf52c7..0000000 --- a/libezxml/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required (VERSION 2.4) - -set (PACKAGE "libezxml") -project (${PACKAGE} C) - -add_subdirectory (src) - diff --git a/libezxml/src/CMakeLists.txt b/libezxml/src/CMakeLists.txt deleted file mode 100644 index d1cf76d..0000000 --- a/libezxml/src/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set (CMAKE_C_FLAGS -Wall) - -add_library (ezxml STATIC ezxml.c) -target_link_libraries (ezxml) diff --git a/libpiano/CMakeLists.txt b/libpiano/CMakeLists.txt deleted file mode 100644 index 822ca0f..0000000 --- a/libpiano/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -cmake_minimum_required (VERSION 2.4) - -set (PACKAGE "libpiano") -project (${PACKAGE} C) - -add_subdirectory (src) diff --git a/libpiano/src/CMakeLists.txt b/libpiano/src/CMakeLists.txt deleted file mode 100644 index 4aaeb5b..0000000 --- a/libpiano/src/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -set (CMAKE_C_FLAGS -Wall) - -configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/config.h) - -include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../libwaitress/src - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../../libezxml/src) - -add_library (piano STATIC crypt.c piano.c xml.c) -target_link_libraries (piano waitress ezxml) - diff --git a/libwaitress/CMakeLists.txt b/libwaitress/CMakeLists.txt deleted file mode 100644 index c160521..0000000 --- a/libwaitress/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -cmake_minimum_required (VERSION 2.4) - -set (PACKAGE "libwaitress") -project (${PACKAGE} C) - -add_subdirectory (src) diff --git a/libwaitress/src/CMakeLists.txt b/libwaitress/src/CMakeLists.txt deleted file mode 100644 index 1985815..0000000 --- a/libwaitress/src/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -INCLUDE (CheckFunctionExists) -INCLUDE (CheckLibraryExists) - -set (CMAKE_C_FLAGS -Wall) -set (EXTRA_LIBS "") - -# required on sunos -CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT) - IF(NOT CMAKE_HAVE_CONNECT) - CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT) - IF (CMAKE_LIB_SOCKET_HAS_CONNECT) - SET (EXTRA_LIBS -lsocket) - ENDIF (CMAKE_LIB_SOCKET_HAS_CONNECT) -ENDIF(NOT CMAKE_HAVE_CONNECT) - -configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/config.h) - -include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) - -add_library (waitress STATIC waitress.c) -target_link_libraries (waitress ${EXTRA_LIBS}) - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 1357510..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,73 +0,0 @@ -set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) -set (CMAKE_C_FLAGS -Wall) -set (ENABLE_MAD 0) -set (ENABLE_FAAD 0) -set (BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin CACHE PATH "bin path") -set (MAN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/man CACHE PATH "man path") - -# This removes a warning on newer versions of cmake -if(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) -endif(COMMAND cmake_policy) - -option (USE_FAAD "Use libfaad for aac decoding (if available)" on) -option (USE_MAD "Use libmad for mp3 decoding (if available)" on) - -find_package (LibAo REQUIRED) - -# find threading implementation -find_package (Threads REQUIRED) -if (NOT CMAKE_USE_PTHREADS_INIT) - message (FATAL_ERROR "pthread is currently required") -endif (NOT CMAKE_USE_PTHREADS_INIT) - -# check for libm -find_library (LIBM m) -if (NOT LIBM) - message (FATAL_ERROR "libm is required") -endif (NOT LIBM) - -# check for audio decoding library -find_package (Faad) -find_package (Mad) - -if (FAAD_FOUND AND USE_FAAD) - message (STATUS "Found libfaad, enabling aac decoding") - set (ENABLE_FAAD 1) -elseif (FAAD_FOUND AND NOT USE_FAAD) - message (STATUS "Found libfaad, but disabling aac decoding by request") -elseif (NOT FAAD_FOUND AND USE_FAAD) - message (STATUS "libfaad not found but requested") -endif (FAAD_FOUND AND USE_FAAD) - -if (MAD_FOUND AND USE_MAD) - message (STATUS "Found libmad, enabling mp3 decoding") - set (ENABLE_MAD 1) -elseif (MAD_FOUND AND NOT USE_MAD) - message (STATUS "Found libmad, but disabling mp3 decoding by request") -elseif (NOT MAD_FOUND AND USE_MAD) - message (STATUS "libmad not found but requested") -endif (MAD_FOUND AND USE_MAD) - -# check whether faad and/or mad are available and enabled -if (NOT ENABLE_FAAD AND NOT ENABLE_MAD) - message (FATAL_ERROR "libmad and/or libfaad are required.") -endif (NOT ENABLE_FAAD AND NOT ENABLE_MAD) - -configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/config.h) - -include_directories ( - ${pianobar_SOURCE_DIR}/libpiano/src - ${pianobar_SOURCE_DIR}/libwaitress/src - ${CMAKE_CURRENT_BINARY_DIR} - ${FAAD_INCLUDE_DIRS} ${LIBAO_INCLUDE_DIRS} - ${MAD_INCLUDE_DIRS}) - -add_executable (pianobar main.c terminal.c settings.c player.c ui.c ui_act.c - ui_readline.c) -target_link_libraries (pianobar piano waitress ${FAAD_LIBRARIES} - ${LIBAO_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${MAD_LIBRARIES} ${LIBM}) - -install (TARGETS pianobar RUNTIME DESTINATION ${BIN_INSTALL_DIR}) -install (FILES pianobar.1 DESTINATION ${MAN_INSTALL_DIR}/man1) diff --git a/src/FindFaad.cmake b/src/FindFaad.cmake deleted file mode 100644 index 7e3fe99..0000000 --- a/src/FindFaad.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# FAAD_INCLUDE_DIRS - where to find neaacdec.h, etc. -# FAAD_LIBRARIES - List of libraries when using libfaad. -# FAAD_FOUND - True if libfaad found. - -# Look for the header file. -FIND_PATH(FAAD_INCLUDE_DIR NAMES neaacdec.h) -MARK_AS_ADVANCED(FAAD_INCLUDE_DIR) - -# Look for the library. -FIND_LIBRARY(FAAD_LIBRARY NAMES faad) -MARK_AS_ADVANCED(FAAD_LIBRARY) - -# Copy the results to the output variables. -IF(FAAD_INCLUDE_DIR AND FAAD_LIBRARY) - SET(FAAD_FOUND 1) - SET(FAAD_LIBRARIES ${FAAD_LIBRARY}) - SET(FAAD_INCLUDE_DIRS ${FAAD_INCLUDE_DIR}) -ELSE(FAAD_INCLUDE_DIR AND FAAD_LIBRARY) - SET(FAAD_FOUND 0) - SET(FAAD_LIBRARIES) - SET(FAAD_INCLUDE_DIRS) -ENDIF(FAAD_INCLUDE_DIR AND FAAD_LIBRARY) - -# Report the results. -IF(NOT FAAD_FOUND) - SET(FAAD_DIR_MESSAGE - "FAAD was not found. Make sure FAAD_LIBRARY and FAAD_INCLUDE_DIR are set.") - IF(NOT FAAD_FIND_QUIETLY) - MESSAGE(STATUS "${FAAD_DIR_MESSAGE}") - ELSE(NOT FAAD_FIND_QUIETLY) - IF(FAAD_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "${FAAD_DIR_MESSAGE}") - ENDIF(FAAD_FIND_REQUIRED) - ENDIF(NOT FAAD_FIND_QUIETLY) -ENDIF(NOT FAAD_FOUND) diff --git a/src/FindLibAo.cmake b/src/FindLibAo.cmake deleted file mode 100644 index f026548..0000000 --- a/src/FindLibAo.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# - Find libao -# -# LIBAO_INCLUDE_DIRS - where to find ao/ao.h, etc. -# LIBAO_LIBRARIES - List of libraries when using libao. -# LIBAO_FOUND - True if libao found. - -# Look for the header file. -FIND_PATH(LIBAO_INCLUDE_DIR NAMES ao/ao.h) -MARK_AS_ADVANCED(LIBAO_INCLUDE_DIR) - -# Look for the library. -FIND_LIBRARY(LIBAO_LIBRARY NAMES ao) -MARK_AS_ADVANCED(LIBAO_LIBRARY) - -# Copy the results to the output variables. -IF(LIBAO_INCLUDE_DIR AND LIBAO_LIBRARY) - SET(LIBAO_FOUND 1) - SET(LIBAO_LIBRARIES ${LIBAO_LIBRARY}) - SET(LIBAO_INCLUDE_DIRS ${LIBAO_INCLUDE_DIR}) -ELSE(LIBAO_INCLUDE_DIR AND LIBAO_LIBRARY) - SET(LIBAO_FOUND 0) - SET(LIBAO_LIBRARIES) - SET(LIBAO_INCLUDE_DIRS) -ENDIF(LIBAO_INCLUDE_DIR AND LIBAO_LIBRARY) - -# Report the results. -IF(NOT LIBAO_FOUND) - SET(LIBAO_DIR_MESSAGE - "LIBAO was not found. Make sure LIBAO_LIBRARY and LIBAO_INCLUDE_DIR are set.") - IF(NOT LIBAO_FIND_QUIETLY) - MESSAGE(STATUS "${LIBAO_DIR_MESSAGE}") - ELSE(NOT LIBAO_FIND_QUIETLY) - IF(LIBAO_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "${LIBAO_DIR_MESSAGE}") - ENDIF(LIBAO_FIND_REQUIRED) - ENDIF(NOT LIBAO_FIND_QUIETLY) -ENDIF(NOT LIBAO_FOUND) diff --git a/src/FindMad.cmake b/src/FindMad.cmake deleted file mode 100644 index 1917cd4..0000000 --- a/src/FindMad.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# MAD_INCLUDE_DIRS - where to find mad.h, etc. -# MAD_LIBRARIES - List of libraries when using libmad. -# MAD_FOUND - True if libmad found. - -# Look for the header file. -FIND_PATH(MAD_INCLUDE_DIR NAMES mad.h) -MARK_AS_ADVANCED(MAD_INCLUDE_DIR) - -# Look for the library. -FIND_LIBRARY(MAD_LIBRARY NAMES mad) -MARK_AS_ADVANCED(MAD_LIBRARY) - -# Copy the results to the output variables. -IF(MAD_INCLUDE_DIR AND MAD_LIBRARY) - SET(MAD_FOUND 1) - SET(MAD_LIBRARIES ${MAD_LIBRARY}) - SET(MAD_INCLUDE_DIRS ${MAD_INCLUDE_DIR}) -ELSE(MAD_INCLUDE_DIR AND MAD_LIBRARY) - SET(MAD_FOUND 0) - SET(MAD_LIBRARIES) - SET(MAD_INCLUDE_DIRS) -ENDIF(MAD_INCLUDE_DIR AND MAD_LIBRARY) - -# Report the results. -IF(NOT MAD_FOUND) - SET(MAD_DIR_MESSAGE - "libmad was not found. Make sure MAD_LIBRARY and MAD_INCLUDE_DIR are set.") - IF(NOT MAD_FIND_QUIETLY) - MESSAGE(STATUS "${MAD_DIR_MESSAGE}") - ELSE(NOT MAD_FIND_QUIETLY) - IF(MAD_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "${MAD_DIR_MESSAGE}") - ENDIF(MAD_FIND_REQUIRED) - ENDIF(NOT MAD_FIND_QUIETLY) -ENDIF(NOT MAD_FOUND) diff --git a/src/config.h.in b/src/config.h.in deleted file mode 100644 index a75a43f..0000000 --- a/src/config.h.in +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _CONFIG_H -#define _CONFIG_H - -/* package name */ -#define PACKAGE "${PACKAGE}" - -/* used libraries */ -#cmakedefine ENABLE_FAAD -#cmakedefine ENABLE_MAD - -#endif /* _CONFIG_H */ -- cgit v1.2.3