Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Sep 2015 11:12:33 +0000 (UTC)
From:      Raphael Kubo da Costa <rakuco@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r396259 - in head/audio/hydrogen: . files
Message-ID:  <201509071112.t87BCXXK097428@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rakuco
Date: Mon Sep  7 11:12:32 2015
New Revision: 396259
URL: https://svnweb.freebsd.org/changeset/ports/396259

Log:
  Add USES=libarchive, stop setting LDFLAGS.
  
  1. Import a pull request I've just sent upstream that makes FindHelper.cmake
     behave better and stop using pkg-config's output directly as include and
     library paths. The consequence is that libraries like libarchive,
     libsndfile, jack etc are now found with their full path and we can stop
     setting LDFLAGS in Makefile.
  
  2. Set USES=libarchive. Even though the port does not require any
     functionality that is only present in libarchive from ports, explicitly
     depending on a certain version makes things more consistent.
     Additionally, before this patch there would be no dependency on
     libarchive from ports but since the linker was previously called like
     this:
        c++ ... -o hydrogen -L/usr/local/lib -larchive -lsndfile ...
     so the port would end up linking against libarchive from ports when it
     was present (which is always, since devel/cmake depends on it). And with
     this patch we have
        c++ ... -o hydrogen -larchive /usr/local/lib/libsndfile.so ...
     which does link against libarchive from base, but then fails `make
     stage-qa', which expects all ports to link against ports libarchive.
  
  PR:		202905
  Approved by:	FreeBSD@ShaneWare.Biz (maintainer)

Added:
  head/audio/hydrogen/files/patch-cmake__FindHelper.cmake   (contents, props changed)
Modified:
  head/audio/hydrogen/Makefile

Modified: head/audio/hydrogen/Makefile
==============================================================================
--- head/audio/hydrogen/Makefile	Mon Sep  7 09:45:14 2015	(r396258)
+++ head/audio/hydrogen/Makefile	Mon Sep  7 11:12:32 2015	(r396259)
@@ -3,7 +3,7 @@
 
 PORTNAME=	hydrogen
 PORTVERSION=	0.9.6.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	audio
 
 MAINTAINER=	FreeBSD@ShaneWare.Biz
@@ -20,12 +20,11 @@ GH_ACCOUNT=	hydrogen-music
 
 USE_QT4=	corelib gui qmake_build linguist_build moc_build network \
 		qt3support rcc_build sql uic_build xml
-USES=		cmake:outsource desktop-file-utils pkgconfig
+USES=		cmake:outsource desktop-file-utils libarchive pkgconfig
 CMAKE_ARGS+=	-DTHREADS_HAVE_PTHREAD_ARG:BOOL=ON -DWANT_DEBUG:BOOL=OFF \
 		-DLIBSNDFILE_INCLUDE_DIR:STRING=${LOCALBASE}/include \
 		-DWANT_OSS:BOOL=ON
 USE_LDCONFIG=	yes
-LDFLAGS+=	-L${LOCALBASE}/lib
 
 OPTIONS_DEFINE=		ALSA JACK LADSPA LASH PORTAUDIO PULSEAUDIO RDF
 OPTIONS_DEFAULT=	JACK LADSPA RDF

Added: head/audio/hydrogen/files/patch-cmake__FindHelper.cmake
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/audio/hydrogen/files/patch-cmake__FindHelper.cmake	Mon Sep  7 11:12:32 2015	(r396259)
@@ -0,0 +1,54 @@
+Sent upstream: https://github.com/hydrogen-music/hydrogen/pull/290
+
+cmake: Call find_path and find_library even if pkg-config calls work.
+
+Instead of calling pkg_check_modules() with the same prefix as the calls
+to find_library() and find_path(), pass PC_${prefix} to the former.
+
+This way, we are able to use the paths that might have been found by
+pkg-config as hints to the find_library and find_path calls. Doing so
+helps systems where the dependent libraries (libarchive, libsndfile etc)
+are not in the default linker path, as the linker is now called with the
+libraries' absolute path:
+
+c++ file1.o file2.o [...] -o hydrogen /usr/lib/libsndfile.so ...
+
+instead of
+
+c++ file1.o file2.o [...] -o hydrogen -lsndfile ...
+
+as the latter requires one to manually pass "-L/usr/local/lib" to CMake
+when configuring Hydrogen.
+
+While here, use HINTS instead of PATHS when calling the find_*()
+functions, as CMake's documentation says that "paths computed by system
+introspection" should use HINTS, not PATHS, which is for hardcoded
+paths.
+--- cmake/FindHelper.cmake.orig	2014-09-09 18:39:33 UTC
++++ cmake/FindHelper.cmake
+@@ -23,7 +23,7 @@ macro(FIND_HELPER prefix pkg_name header
+             FIND_PACKAGE(PkgConfig)
+         endif()
+         if(PKG_CONFIG_FOUND)
+-            pkg_check_modules(${prefix} ${pkg_name})
++            pkg_check_modules(PC_${prefix} ${pkg_name})
+             #MESSAGE(STATUS  " LDFLAGS       ${${prefix}_LDFLAGS}" )
+             #MESSAGE(STATUS  " CFLAGS        ${${prefix}_CFLAGS}" )
+             #MESSAGE(STATUS  " INCLUDEDIRS   ${${prefix}_INCLUDE_DIRS}" )
+@@ -36,12 +36,14 @@ macro(FIND_HELPER prefix pkg_name header
+ 
+         find_path(${prefix}_INCLUDE_DIR
+             NAMES ${header}
+-            PATHS ${${prefix}_INCLUDE_DIRS} ${${prefix}_INCLUDEDIR} ${${prefix}_INCLUDE_PATHS} ENV ${prefix}_INCLUDE
++            HINTS ${PC_${prefix}_INCLUDE_DIRS} ${PC_${prefix}_INCLUDEDIR} ${PC_${prefix}_INCLUDE_PATHS}
++            ENV ${prefix}_INCLUDE
+         )
+ 
+         find_library(${prefix}_LIBRARIES
+             NAMES ${lib}
+-            PATHS ${${prefix}_LIBDIR} ${${prefix}_LIBRARY_DIRS} ${${prefix}_LIB_PATHS} ENV ${prefix}_PATH
++            HINTS ${PC_${prefix}_LIBDIR} ${PC_${prefix}_LIBRARY_DIRS} ${PC_${prefix}_LIB_PATHS}
++            ENV ${prefix}_PATH
+         )
+     endif()
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509071112.t87BCXXK097428>