-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Basic telemetry for the Audacity #835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c1756dd
ea9bb00
2dfae48
5938ee7
4b403a6
e420e0f
7b7565d
85cd79b
2c14a12
5563b06
18dc655
dc7c736
d54cf6f
df67a7a
0af77de
6a8065a
ba83cb1
5f54e4d
434fa25
cb91c67
4d0eaab
ac88a4f
0f608d1
07ca990
fefeb2a
28f8016
111ae79
d477605
c9264d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,3 +206,5 @@ win/xaudacity.ico | |
| #other files that get in the way | ||
| */not-for-git/* | ||
| *.dll | ||
|
|
||
| .idea/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,8 @@ function( execute ) | |
| set( ${outlist} ${cmd_out} PARENT_SCOPE ) | ||
| endfunction() | ||
|
|
||
| get_filename_component(SRC_DIR ${SRC} DIRECTORY) | ||
|
|
||
| function( gather_libs src ) | ||
| if( CMAKE_HOST_SYSTEM_NAME MATCHES "Windows" ) | ||
| execute( output cmd /k dumpbin /dependents ${src} ) | ||
|
|
@@ -45,6 +47,14 @@ function( gather_libs src ) | |
| list( APPEND libs ${lib} ) | ||
|
|
||
| gather_libs( ${lib} ) | ||
| elseif (line MATCHES "^ *libcurl.*\\.dll") | ||
| set( lib ${CURL_PATH}/${line} ) | ||
|
|
||
| list( APPEND libs ${lib} ) | ||
|
|
||
| gather_libs( ${lib} ) | ||
| elseif (line MATCHES "^ *lib-.*\\.dll") | ||
| gather_libs( "${SRC_DIR}/${line}" ) | ||
| endif() | ||
| endforeach() | ||
| elseif( CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin" ) | ||
|
|
@@ -59,7 +69,18 @@ function( gather_libs src ) | |
| endif() | ||
|
|
||
| foreach( line ${output} ) | ||
| if( line MATCHES "^.*libwx.*\\.dylib " ) | ||
| if( line MATCHES "@rpath/libcurl.*\\.dylib ") | ||
| message(STATUS "Matched ${line}") | ||
|
|
||
| string( REGEX REPLACE "dylib .*" "dylib" line "${line}" ) | ||
|
|
||
| get_filename_component( refname "${line}" NAME ) | ||
|
|
||
| set (lib "${CURL_PATH}/${refname}") | ||
| list( APPEND libs ${lib} ) | ||
|
|
||
| list( APPEND postcmds "sh -c 'install_name_tool -change @rpath/${refname} @executable_path/../Frameworks/${refname} ${libname}'" ) | ||
| elseif( line MATCHES "^.*(libwx|lib-).*\\.dylib " ) | ||
| string( REGEX REPLACE "dylib .*" "dylib" line "${line}" ) | ||
| if( NOT line STREQUAL "${src}" AND NOT line MATCHES "@executable" ) | ||
| set( lib ${line} ) | ||
|
|
@@ -74,12 +95,12 @@ function( gather_libs src ) | |
| endif() | ||
| endforeach() | ||
| elseif( CMAKE_HOST_SYSTEM_NAME MATCHES "Linux" ) | ||
| execute( output sh -c "LD_LIBRARY_PATH='${WXWIN}' ldd ${src}" ) | ||
| execute( output sh -c "LD_LIBRARY_PATH='${WXWIN}:${CURL_PATH}' ldd ${src}" ) | ||
|
|
||
| get_filename_component( libname "${src}" NAME ) | ||
|
|
||
| foreach( line ${output} ) | ||
| if( line MATCHES ".*libwx.*" ) | ||
| if( line MATCHES ".*lib(wx|lib-).*" ) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Over 9000! |
||
| string( REGEX REPLACE ".* => (.*) \\(.*$" "\\1" line "${line}" ) | ||
|
|
||
| set( lib ${line} ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| include(ExternalProject) | ||
|
|
||
| def_vars() | ||
|
|
||
| set( CURL_DIR "${_INTDIR}/libcurl" ) | ||
| set( CURL_TAG "curl-7_76_0") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean you will now create a release of audacity whenever curl has another CVE? Have you considered the security implications that you open the door for in this scenario? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Vendoring curl?! Of all dependencies? 😱 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the original curl release is used, why not simply take the one installed on the system? |
||
|
|
||
| set(CURL_CMAKE_ARGS | ||
| -DCMAKE_INSTALL_PREFIX:STRING=${CURL_DIR} | ||
| -DHTTP_ONLY:BOOL=On | ||
| -DBUILD_CURL_EXE:BOOL=Off | ||
| -DCMAKE_USE_LIBSSH2:BOOL=Off | ||
| ) | ||
|
|
||
| if( CMAKE_SYSTEM_NAME MATCHES "Windows" ) | ||
| set(CURL_CMAKE_ARGS ${CURL_CMAKE_ARGS} | ||
| -DCMAKE_USE_SCHANNEL:BOOL=On | ||
| ) | ||
| elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) | ||
| set(CURL_CMAKE_ARGS ${CURL_CMAKE_ARGS} | ||
| -DCMAKE_USE_SECTRANSP:BOOL=On | ||
| -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9 | ||
| -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64 | ||
| ) | ||
| elseif( CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD" ) | ||
|
|
||
| endif() | ||
|
|
||
| ExternalProject_Add(curl | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will not work on some Linux distributions as it downloads sources during build (build systems do not allow internet connection during build). Apart from that, this suffers from the same issue as the custom wxwidgets fork: Including custom sources where in reality you should build against a system provided version of the library There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, my. This story gets weirder the deeper one crawls.
I am very, very disappointed, Muse Group. And sad. Very sad, too. In other recognition, thanks @dvzrv for pointing it out! It's pretty telling of the whole thing, I'd say.... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be fair, Audacity had a problematic practice of vendoring dependencies long before Muse Group got invovled. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A NixOS package maintainer here: side effects like downloading sources during build are problematic indeed for many build systems. I'd kindly ask you to reconsider this, otherwise several distributions need to patch this downstream. |
||
| PREFIX "${CURL_DIR}" | ||
| INSTALL_DIR "${CURL_DIR}" | ||
| GIT_REPOSITORY https://github.com/curl/curl | ||
| GIT_TAG ${CURL_TAG} | ||
| GIT_SHALLOW Yes | ||
| CMAKE_CACHE_ARGS ${CURL_CMAKE_ARGS} | ||
| ) | ||
|
|
||
| add_library(AUDACITY::libcurl SHARED IMPORTED GLOBAL) | ||
|
|
||
| file(MAKE_DIRECTORY "${CURL_DIR}/include") | ||
|
|
||
| set_target_properties(AUDACITY::libcurl PROPERTIES | ||
| INTERFACE_INCLUDE_DIRECTORIES "${CURL_DIR}/include" | ||
| ) | ||
|
|
||
| if (WIN32) | ||
| set_target_properties(AUDACITY::libcurl PROPERTIES | ||
| INTERFACE_LINK_LIBRARIES "winmm;ws2_32;advapi32;crypt32" | ||
| ) | ||
|
|
||
| set_property(TARGET AUDACITY::libcurl APPEND PROPERTY IMPORTED_CONFIGURATIONS "Debug;Release") | ||
|
|
||
| set_target_properties(AUDACITY::libcurl PROPERTIES | ||
| IMPORTED_IMPLIB_DEBUG "${CURL_DIR}/lib/libcurl-d_imp.lib" | ||
| IMPORTED_LOCATION_DEBUG "${CURL_DIR}/bin/libcurl-d.dll" | ||
|
|
||
| IMPORTED_IMPLIB_RELEASE "${CURL_DIR}/lib/libcurl_imp.lib" | ||
| IMPORTED_LOCATION_RELEASE "${CURL_DIR}/bin/libcurl.dll" | ||
| ) | ||
| elseif(APPLE) | ||
| if(XCODE) | ||
| set_property(TARGET AUDACITY::libcurl APPEND PROPERTY IMPORTED_CONFIGURATIONS "Debug;Release") | ||
|
|
||
| set_target_properties(AUDACITY::libcurl PROPERTIES | ||
| IMPORTED_LOCATION_RELEASE "${CURL_DIR}/lib/libcurl.dylib" | ||
| IMPORTED_LOCATION_DEBUG "${CURL_DIR}/lib/libcurl-d.dylib" | ||
| ) | ||
| else() | ||
| set_property(TARGET AUDACITY::libcurl APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) | ||
|
|
||
| set_target_properties(AUDACITY::libcurl PROPERTIES | ||
| IMPORTED_LOCATION_NOCONFIG "${CURL_DIR}/lib/libcurl.dylib" | ||
| ) | ||
| endif() | ||
| elseif(UNIX) | ||
| set_property(TARGET AUDACITY::libcurl APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) | ||
|
|
||
| set_target_properties(AUDACITY::libcurl PROPERTIES | ||
| IMPORTED_LOCATION_NOCONFIG "${CURL_DIR}/lib/libcurl.so" | ||
| IMPORTED_SONAME_NOCONFIG "libcurl.so" | ||
| ) | ||
| endif() | ||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| Copyright (c) 2012 Jakob Progsch, Václav Zeman | ||
|
|
||
| This software is provided 'as-is', without any express or implied | ||
| warranty. In no event will the authors be held liable for any damages | ||
| arising from the use of this software. | ||
|
|
||
| Permission is granted to anyone to use this software for any purpose, | ||
| including commercial applications, and to alter it and redistribute it | ||
| freely, subject to the following restrictions: | ||
|
|
||
| 1. The origin of this software must not be misrepresented; you must not | ||
| claim that you wrote the original software. If you use this software | ||
| in a product, an acknowledgment in the product documentation would be | ||
| appreciated but is not required. | ||
|
|
||
| 2. Altered source versions must be plainly marked as such, and must not be | ||
| misrepresented as being the original software. | ||
|
|
||
| 3. This notice may not be removed or altered from any source | ||
| distribution. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| ThreadPool | ||
| ========== | ||
|
|
||
| A simple C++11 Thread Pool implementation. | ||
|
|
||
| Basic usage: | ||
| ```c++ | ||
| // create thread pool with 4 worker threads | ||
| ThreadPool pool(4); | ||
|
|
||
| // enqueue and store future | ||
| auto result = pool.enqueue([](int answer) { return answer; }, 42); | ||
|
|
||
| // get result from future | ||
| std::cout << result.get() << std::endl; | ||
|
|
||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| #ifndef THREAD_POOL_H | ||
| #define THREAD_POOL_H | ||
|
|
||
| #include <vector> | ||
| #include <queue> | ||
| #include <memory> | ||
| #include <thread> | ||
| #include <mutex> | ||
| #include <condition_variable> | ||
| #include <future> | ||
| #include <functional> | ||
| #include <stdexcept> | ||
|
|
||
| class ThreadPool { | ||
| public: | ||
| ThreadPool(size_t); | ||
| template<class F, class... Args> | ||
| auto enqueue(F&& f, Args&&... args) | ||
| -> std::future<typename std::result_of<F(Args...)>::type>; | ||
| ~ThreadPool(); | ||
| private: | ||
| // need to keep track of threads so we can join them | ||
| std::vector< std::thread > workers; | ||
| // the task queue | ||
| std::queue< std::function<void()> > tasks; | ||
|
|
||
| // synchronization | ||
| std::mutex queue_mutex; | ||
| std::condition_variable condition; | ||
| bool stop; | ||
| }; | ||
|
|
||
| // the constructor just launches some amount of workers | ||
| inline ThreadPool::ThreadPool(size_t threads) | ||
| : stop(false) | ||
| { | ||
| for(size_t i = 0;i<threads;++i) | ||
| workers.emplace_back( | ||
| [this] | ||
| { | ||
| for(;;) | ||
| { | ||
| std::function<void()> task; | ||
|
|
||
| { | ||
| std::unique_lock<std::mutex> lock(this->queue_mutex); | ||
| this->condition.wait(lock, | ||
| [this]{ return this->stop || !this->tasks.empty(); }); | ||
| if(this->stop && this->tasks.empty()) | ||
| return; | ||
| task = std::move(this->tasks.front()); | ||
| this->tasks.pop(); | ||
| } | ||
|
|
||
| task(); | ||
| } | ||
| } | ||
| ); | ||
| } | ||
|
|
||
| // add new work item to the pool | ||
| template<class F, class... Args> | ||
| auto ThreadPool::enqueue(F&& f, Args&&... args) | ||
| -> std::future<typename std::result_of<F(Args...)>::type> | ||
| { | ||
| using return_type = typename std::result_of<F(Args...)>::type; | ||
|
|
||
| auto task = std::make_shared< std::packaged_task<return_type()> >( | ||
| std::bind(std::forward<F>(f), std::forward<Args>(args)...) | ||
| ); | ||
|
|
||
| std::future<return_type> res = task->get_future(); | ||
| { | ||
| std::unique_lock<std::mutex> lock(queue_mutex); | ||
|
|
||
| // don't allow enqueueing after stopping the pool | ||
| if(stop) | ||
| throw std::runtime_error("enqueue on stopped ThreadPool"); | ||
|
|
||
| tasks.emplace([task](){ (*task)(); }); | ||
| } | ||
| condition.notify_one(); | ||
| return res; | ||
| } | ||
|
|
||
| // the destructor joins all threads | ||
| inline ThreadPool::~ThreadPool() | ||
| { | ||
| { | ||
| std::unique_lock<std::mutex> lock(queue_mutex); | ||
| stop = true; | ||
| } | ||
| condition.notify_all(); | ||
| for(std::thread &worker: workers) | ||
| worker.join(); | ||
| } | ||
|
|
||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
liblib-foo?