From owner-svn-ports-head@FreeBSD.ORG Tue Sep 10 15:31:49 2013 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8CC45866; Tue, 10 Sep 2013 15:31:49 +0000 (UTC) (envelope-from rakuco@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6B0B923E5; Tue, 10 Sep 2013 15:31:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8AFVn0o002620; Tue, 10 Sep 2013 15:31:49 GMT (envelope-from rakuco@svn.freebsd.org) Received: (from rakuco@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8AFVn84002617; Tue, 10 Sep 2013 15:31:49 GMT (envelope-from rakuco@svn.freebsd.org) Message-Id: <201309101531.r8AFVn84002617@svn.freebsd.org> From: Raphael Kubo da Costa Date: Tue, 10 Sep 2013 15:31:49 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r326911 - head/audio/kmix/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Sep 2013 15:31:49 -0000 Author: rakuco Date: Tue Sep 10 15:31:48 2013 New Revision: 326911 URL: http://svnweb.freebsd.org/changeset/ports/326911 Log: Add my upstream commits to fix the build with libc++. Added: head/audio/kmix/files/patch-libcxx (contents, props changed) Added: head/audio/kmix/files/patch-libcxx ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/audio/kmix/files/patch-libcxx Tue Sep 10 15:31:48 2013 (r326911) @@ -0,0 +1,245 @@ +commit f184967a01381ca43a02d44edf3158e6cc0be376 +Author: Raphael Kubo da Costa +Date: Tue Sep 3 12:55:39 2013 +0300 + + Properly detect the location of STL's shared_ptr. + + std::shared_ptr is a C++11 feature, whose location (and existence) in STL + implementations of previous C++ standards varied -- one widespread example + is GCC's libstdc++, which has a shared_ptr implementation in + that was shipped long before C++11. + + However, including it unconditionally breaks the build if any other STL + implementation (such as libc++) is used instead. + + We now check if std::shared_ptr is present in the header and then + try std::tr1::shared_ptr as a fallback. + + REVIEW: 112434 + +commit 111de2e86a3a79d43744e7d76a5a0be1d6e8fe0d +Author: Raphael Kubo da Costa +Date: Tue Sep 3 12:54:48 2013 +0300 + + Use operator bool() instead of != and == for shared_ptr. + + (This is part 1 of 2 of the shared_ptr changes) + + In preparation for supporting C++11's version of shared_ptr, convert + some + comparisons to operator bool(), that is + + if (foo != 0) becomes if (foo) + if (foo == 0) becomes if (!foo) + + as otherwise the build (with clang and libc++) would fail because there is + no overload for operator==(shared_ptr, int) and operator!=(shared_ptr, int). + + REVIEW: 112433 + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a442972..1f75530 100644 +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -26,6 +26,17 @@ if(MSVC) + endif(MSVC) + + ++include(CheckCXXSourceCompiles) ++check_cxx_source_compiles(" ++ #include ++ int main() { std::shared_ptr p; return 0; } ++" HAVE_STD_SHARED_PTR) ++check_cxx_source_compiles(" ++ #include ++ int main() { std::tr1::shared_ptr p; return 0; } ++" HAVE_STD_TR1_SHARED_PTR) ++ ++ + configure_file (config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) + + +diff --git a/apps/kmixd.cpp b/apps/kmixd.cpp +index 442abaf..9385a6a 100644 +--- apps/kmixd.cpp ++++ apps/kmixd.cpp +@@ -156,7 +156,7 @@ void KMixD::saveBaseConfig() + config.writeEntry( "MasterMixer", mixerMasterCard->id() ); + } + shared_ptr mdMaster = Mixer::getGlobalMasterMD(); +- if ( mdMaster != 0 ) { ++ if ( mdMaster ) { + config.writeEntry( "MasterMixerDevice", mdMaster->id() ); + } + QString mixerIgnoreExpression = MixerToolBox::instance()->mixerIgnoreExpression(); +diff --git a/backends/mixer_backend.cpp b/backends/mixer_backend.cpp +index 2e2e901..2105d2a 100644 +--- backends/mixer_backend.cpp ++++ backends/mixer_backend.cpp +@@ -241,7 +241,7 @@ void Mixer_Backend::readSetFromHW() + */ + shared_ptr Mixer_Backend::recommendedMaster() + { +- if ( m_recommendedMaster != 0 ) ++ if ( m_recommendedMaster ) + { + // Backend has set a recommended master. Thats fine. Using it. + return m_recommendedMaster; +diff --git a/backends/mixer_mpris2.cpp b/backends/mixer_mpris2.cpp +index 6ebcd8f..75ef129 100644 +--- backends/mixer_mpris2.cpp ++++ backends/mixer_mpris2.cpp +@@ -535,7 +535,7 @@ void Mixer_MPRIS2::newMediaPlayer(QString name, QString oldOwner, QString newOwn + } + + shared_ptr md = m_mixDevices.get(id); +- if (md != 0) ++ if (md) + { + // We know about the player that is unregistering => remove internally + md->close(); +diff --git a/config.h.cmake b/config.h.cmake +index 032f8c1..acd9a9c 100644 +--- config.h.cmake ++++ config.h.cmake +@@ -15,3 +15,9 @@ + + /* Define to 1 if you have the header file. */ + #cmakedefine HAVE_UNISTD_H 1 ++ ++/* Define to 1 if exists and defines std::tr1::shared_ptr. */ ++#cmakedefine HAVE_STD_TR1_SHARED_PTR 1 ++ ++/* Define to 1 if exists and defines std::shared_ptr. */ ++#cmakedefine HAVE_STD_SHARED_PTR 1 +diff --git a/core/ControlPool.h b/core/ControlPool.h +index 4cb2222..b045ce0 100644 +--- core/ControlPool.h ++++ core/ControlPool.h +@@ -22,12 +22,15 @@ + #ifndef CONTROL_POOL_H + #define CONTROL_POOL_H + ++#include "config.h" + +-// std::shared_ptr ++#if defined(HAVE_STD_SHARED_PTR) + #include ++using std::shared_ptr; ++#elif defined(HAVE_STD_TR1_SHARED_PTR) + #include +- +-using namespace ::std::tr1; ++using std::tr1::shared_ptr; ++#endif + + #include "core/mixdevice.h" + +diff --git a/core/MasterControl.h b/core/MasterControl.h +index dff9e95..16472ff 100644 +--- core/MasterControl.h ++++ core/MasterControl.h +@@ -8,12 +8,17 @@ + #ifndef MASTERCONTROL_H_ + #define MASTERCONTROL_H_ + +-#include ++#include "config.h" + +-// std::shared_ptr ++#if defined(HAVE_STD_SHARED_PTR) + #include ++using std::shared_ptr; ++#elif defined(HAVE_STD_TR1_SHARED_PTR) + #include +-using namespace ::std::tr1; ++using std::tr1::shared_ptr; ++#endif ++ ++#include + + class MasterControl + { +diff --git a/core/mixdevice.h b/core/mixdevice.h +index f5ca782..fb554a2 100644 +--- core/mixdevice.h ++++ core/mixdevice.h +@@ -21,10 +21,15 @@ + #ifndef MixDevice_h + #define MixDevice_h + +-// std::shared_ptr ++#include "config.h" ++ ++#if defined(HAVE_STD_SHARED_PTR) + #include ++using std::shared_ptr; ++#elif defined(HAVE_STD_TR1_SHARED_PTR) + #include +-using namespace ::std::tr1; ++using std::tr1::shared_ptr; ++#endif + + //KMix + class Mixer; +diff --git a/core/mixertoolbox.cpp b/core/mixertoolbox.cpp +index 60c9fc8..41386d4 100644 +--- core/mixertoolbox.cpp ++++ core/mixertoolbox.cpp +@@ -248,13 +248,13 @@ void MixerToolBox::initMixerInternal(MultiDriverMode multiDriverMode, QList 0 ) { + shared_ptr master = Mixer::mixers().first()->getLocalMasterMD(); +- if ( master != 0 ) { ++ if ( master ) { + QString controlId = master->id(); + Mixer::setGlobalMaster( Mixer::mixers().first()->id(), controlId, true); + } +diff --git a/gui/kmixdockwidget.cpp b/gui/kmixdockwidget.cpp +index 47e8073..e84338e 100644 +--- gui/kmixdockwidget.cpp ++++ gui/kmixdockwidget.cpp +@@ -215,7 +215,7 @@ void KMixDockWidget::updatePixmap() + shared_ptr md = Mixer::getGlobalMasterMD(); + + char newPixmapType; +- if ( md == 0 ) ++ if ( !md ) + { + newPixmapType = 'e'; + } +@@ -405,7 +405,7 @@ void KMixDockWidget::contextMenuAboutToShow() + void KMixDockWidget::updateDockMuteAction ( KToggleAction* dockMuteAction ) + { + shared_ptr md = Mixer::getGlobalMasterMD(); +- if ( md != 0 && dockMuteAction != 0 ) ++ if ( md && dockMuteAction != 0 ) + { + Volume& vol = md->playbackVolume().hasVolume() ? md->playbackVolume() : md->captureVolume(); + bool isInactive = vol.isCapture() ? !md->isRecSource() : md->isMuted(); +diff --git a/gui/viewdockareapopup.cpp b/gui/viewdockareapopup.cpp +index 48411bd..45edc32 100644 +--- gui/viewdockareapopup.cpp ++++ gui/viewdockareapopup.cpp +@@ -248,12 +248,12 @@ Application: KMix (kmix), signal: Segmentation fault + { + // kDebug() << "ADD? mixerId=" << mixer->id(); + shared_ptrdockMD = mixer->getLocalMasterMD(); +- if ( dockMD == 0 && mixer->size() > 0 ) ++ if ( !dockMD && mixer->size() > 0 ) + { + // If we have no dock device yet, we will take the first available mixer device. + dockMD = (*mixer)[0]; + } +- if ( dockMD != 0 ) ++ if ( dockMD ) + { + // kDebug() << "ADD? mixerId=" << mixer->id() << ", md=" << dockMD->id(); + if ( !dockMD->isApplicationStream() && dockMD->playbackVolume().hasVolume())