From efbe9c94c0f02395f796cdecd42ecbcdda065ed2 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Thu, 12 Mar 2009 19:35:49 +0100 Subject: [PATCH] Various fixes for better OpenBSD compatibility (thanks to Jacob Meuser) (cherry picked from commit 46097b72d7d707db3f8e8b2ec9ab7965c52753a6) Conflicts: src/core/main.cpp --- CMakeLists.txt | 5 +++++ include/remote_plugin.h | 6 +++++- src/core/audio/audio_oss.cpp | 4 ++-- src/core/main.cpp | 6 ++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dafdfbc4a..06f3ee1ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -434,6 +434,7 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/lmms.1.gz COMMAND gzip -c ${CMAKE_ ADD_EXECUTABLE(lmms ${lmms_SOURCES} ${lmms_INCLUDES} ${LIBSAMPLERATE_SOURCES} ${LMMS_ER_H} ${lmms_UI_out} lmmsconfig.h ${WINRC} ${CMAKE_BINARY_DIR}/lmms.1.gz) IF(LMMS_BUILD_WIN32) + SET_TARGET_PROPERTIES(lmms PROPERTIES LINK_FLAGS "${LINK_FLAGS} -mwindows") ADD_CUSTOM_COMMAND(TARGET lmms POST_BUILD COMMAND ${STRIP} ${CMAKE_BINARY_DIR}/lmms.exe) @@ -443,9 +444,13 @@ IF(LMMS_BUILD_WIN32) ELSE(LMMS_BUILD_WIN64) INSTALL(FILES /opt/mingw32/bin/QtCore4.dll /opt/mingw32/bin/QtGui4.dll /opt/mingw32/bin/QtXml4.dll /opt/mingw32/bin/libz.dll /opt/mingw32/bin/libsndfile-1.dll /opt/mingw32/bin/libvorbis-0.dll /opt/mingw32/bin/libvorbisenc-2.dll /opt/mingw32/bin/libvorbisfile-3.dll /opt/mingw32/bin/libogg-0.dll /opt/mingw32/bin/libfluidsynth-1.dll /opt/mingw32/bin/libfftw3f-3.dll /opt/mingw32/bin/SDL.dll /opt/mingw32/i586-pc-mingw32/bin/mingwm10.dll DESTINATION .) ENDIF(LMMS_BUILD_WIN64) + ELSE(LMMS_BUILD_WIN32) + SET_TARGET_PROPERTIES(lmms PROPERTIES LINK_FLAGS "${LINK_FLAGS} -Wl,-E") + INSTALL(TARGETS lmms RUNTIME DESTINATION bin) INSTALL(FILES ${CMAKE_BINARY_DIR}/lmms.1.gz DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1/ PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) + ENDIF(LMMS_BUILD_WIN32) # diff --git a/include/remote_plugin.h b/include/remote_plugin.h index 560705a28..39f75caf5 100644 --- a/include/remote_plugin.h +++ b/include/remote_plugin.h @@ -1,7 +1,7 @@ /* * remote_plugin.h - base class providing RPC like mechanisms * - * Copyright (c) 2008 Tobias Doerffel + * Copyright (c) 2008-2009 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -64,6 +64,10 @@ typedef int32_t key_t; #include #endif +#ifdef LMMS_HAVE_UNISTD_H +#include +#endif + #endif diff --git a/src/core/audio/audio_oss.cpp b/src/core/audio/audio_oss.cpp index a3be7fb43..52bd8f77c 100644 --- a/src/core/audio/audio_oss.cpp +++ b/src/core/audio/audio_oss.cpp @@ -3,7 +3,7 @@ /* * audio_oss.cpp - device-class that implements OSS-PCM-output * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -56,7 +56,7 @@ #ifdef LMMS_HAVE_SYS_SOUNDCARD_H // This is recommended by OSS #include -#elif LMMS_HAVE_SOUNDCARD_H +#elif defined(LMMS_HAVE_SOUNDCARD_H) // This is installed on some systems #include #endif diff --git a/src/core/main.cpp b/src/core/main.cpp index a7d8c638c..5e43f0c9c 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -50,6 +50,10 @@ #include #endif +#ifdef LMMS_HAVE_UNISTD_H +#include +#endif + #include "config_mgr.h" #include "embed.h" #include "engine.h" @@ -345,6 +349,7 @@ int main( int argc, char * * argv ) // try to set realtime priority #ifdef LMMS_BUILD_LINUX #ifdef LMMS_HAVE_SCHED_H +#ifndef __OpenBSD__ struct sched_param sparam; sparam.sched_priority = ( sched_get_priority_max( SCHED_FIFO ) + sched_get_priority_min( SCHED_FIFO ) ) / 2; @@ -353,6 +358,7 @@ int main( int argc, char * * argv ) printf( "Notice: could not set realtime priority.\n" ); } #endif +#endif #endif configManager::inst()->loadConfigFile();