From 1aaf633b284efc728282574b32fe7b5fbebedd37 Mon Sep 17 00:00:00 2001 From: Guilherme Brondani Torri Date: Mon, 28 Mar 2016 17:17:19 +0200 Subject: [PATCH 1/4] Fix qucs-lib fail to locate libraries on windows With the portable/relocatable .zip packages for windows the QUCSDIR variable is not set. The .exe installer sets it thou. This patch fixes qucs-lib allowing for the libraries to be located relative to the executable location. --- qucs/qucs-lib/main.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qucs/qucs-lib/main.cpp b/qucs/qucs-lib/main.cpp index c78181db34..499ca379b9 100644 --- a/qucs/qucs-lib/main.cpp +++ b/qucs/qucs-lib/main.cpp @@ -100,8 +100,15 @@ int main(int argc, char *argv[]) QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; QucsSettings.LibDir = QucsDir.canonicalPath() + "/share/qucs/library/"; } else { - QucsSettings.LangDir = LANGUAGEDIR; - QucsSettings.LibDir = LIBRARYDIR; + QString QucsApplicationPath = QCoreApplication::applicationDirPath(); +#ifdef __APPLE__ + QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); +#else + QucsDir = QDir(QucsApplicationPath); + QucsDir.cdUp(); +#endif + QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; + QucsSettings.LibDir = QucsDir.canonicalPath() + "/share/qucs/library/"; } loadSettings(); From b7b8e9ea021d0a7eba427f6e5a58d91870adafa0 Mon Sep 17 00:00:00 2001 From: Guilherme Brondani Torri Date: Mon, 28 Mar 2016 17:28:30 +0200 Subject: [PATCH 2/4] Remove LIBRARYDIR definition. The qucs-lib/library/[Makefile.am | CMakeLists.txt] are installing the libraries into [prefix]/share/quscs/library/ regardless of the definition of LIBRARYDIR. --- qucs/config.h.cmake | 1 - qucs/configure.ac | 4 ---- qucs/qucs-lib/CMakeLists.txt | 1 - 3 files changed, 6 deletions(-) diff --git a/qucs/config.h.cmake b/qucs/config.h.cmake index 567ddb1e4a..866a269085 100755 --- a/qucs/config.h.cmake +++ b/qucs/config.h.cmake @@ -1,5 +1,4 @@ #cmakedefine LANGUAGEDIR "@LANGUAGEDIR@" -#cmakedefine LIBRARYDIR "@LIBRARYDIR@" #define PACKAGE_VERSION "@PROJECT_VERSION@" #define PACKAGE_STRING "qucs @PROJECT_VERSION@" diff --git a/qucs/configure.ac b/qucs/configure.ac index 99d045cb51..fca69cbe8c 100644 --- a/qucs/configure.ac +++ b/qucs/configure.ac @@ -769,10 +769,6 @@ LANG_PATH="$prefix/share/qucs/lang/" AC_DEFINE_UNQUOTED([LANGUAGEDIR], ["$LANG_PATH"], [Where the language files go.]) unset LANG_PATH -LIBRARY_PATH="$prefix/share/qucs/library/" -AC_DEFINE_UNQUOTED([LIBRARYDIR], ["$LIBRARY_PATH"], - [Where the component library files go.]) -unset LIBRARY_PATH dnl Definitions at top of . AH_TOP([ diff --git a/qucs/qucs-lib/CMakeLists.txt b/qucs/qucs-lib/CMakeLists.txt index 583b32b4c7..49615739cd 100644 --- a/qucs/qucs-lib/CMakeLists.txt +++ b/qucs/qucs-lib/CMakeLists.txt @@ -19,7 +19,6 @@ ADD_DEFINITIONS( -DHAVE_CONFIG_H ) # define variables SET(LANGUAGEDIR "${CMAKE_INSTALL_PREFIX}/share/qucs/lang/") -SET(LIBRARYDIR "${CMAKE_INSTALL_PREFIX}/share/qucs/library/") # configure the header config.h CONFIGURE_FILE ( From 82a0459f936e087dbf6c2f211df4d12c6151fbc1 Mon Sep 17 00:00:00 2001 From: Guilherme Brondani Torri Date: Mon, 28 Mar 2016 18:23:14 +0200 Subject: [PATCH 3/4] Avoid using LANGUAGEDIR definition. To have qucs in a relocatable directory (in Windows) it cannot rely the prefix given at build time. This is actually a bug. This patch let each tool find the language files at runtime, relative to the location of the executable. --- qucs/qucs-activefilter/main.cpp | 14 +++++++++++--- qucs/qucs-attenuator/main.cpp | 12 ++++++++++-- qucs/qucs-edit/main.cpp | 12 ++++++++++-- qucs/qucs-filter-v2/qf_main.cpp | 12 ++++++++++-- qucs/qucs-filter/main.cpp | 12 ++++++++++-- qucs/qucs-rescodes/main.cpp | 9 ++++++++- qucs/qucs-transcalc/main.cpp | 12 ++++++++++-- 7 files changed, 69 insertions(+), 14 deletions(-) diff --git a/qucs/qucs-activefilter/main.cpp b/qucs/qucs-activefilter/main.cpp index 73bd67da87..6f81a2e1aa 100644 --- a/qucs/qucs-activefilter/main.cpp +++ b/qucs/qucs-activefilter/main.cpp @@ -63,7 +63,7 @@ bool saveApplSettings(QucsActiveFilter *qucs) int main(int argc, char *argv[]) { - QString LangDir; + QString LangDir; // apply default settings QucsSettings.x = 200; QucsSettings.y = 100; @@ -72,13 +72,21 @@ int main(int argc, char *argv[]) // is application relocated? char * var = getenv ("QUCSDIR"); + QDir QucsDir; if (var != NULL) { - QDir QucsDir = QDir (var); + QucsDir = QDir (var); QString QucsDirStr = QucsDir.canonicalPath (); LangDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/"); } else { - LangDir = LANGUAGEDIR; + QString QucsApplicationPath = QCoreApplication::applicationDirPath(); +#ifdef __APPLE__ + QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); +#else + QucsDir = QDir(QucsApplicationPath); + QucsDir.cdUp(); +#endif + LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; } loadSettings(); diff --git a/qucs/qucs-attenuator/main.cpp b/qucs/qucs-attenuator/main.cpp index c431107a6e..bec266af82 100644 --- a/qucs/qucs-attenuator/main.cpp +++ b/qucs/qucs-attenuator/main.cpp @@ -71,13 +71,21 @@ int main( int argc, char ** argv ) // is application relocated? char * var = getenv ("QUCSDIR"); + QDir QucsDir; if (var != NULL) { - QDir QucsDir = QDir (var); + QucsDir = QDir (var); QString QucsDirStr = QucsDir.canonicalPath (); QucsSettings.LangDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/"); } else { - QucsSettings.LangDir = LANGUAGEDIR; + QString QucsApplicationPath = QCoreApplication::applicationDirPath(); +#ifdef __APPLE__ + QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); +#else + QucsDir = QDir(QucsApplicationPath); + QucsDir.cdUp(); +#endif + QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; } loadSettings(); diff --git a/qucs/qucs-edit/main.cpp b/qucs/qucs-edit/main.cpp index 7d5ed91219..a441d318ae 100644 --- a/qucs/qucs-edit/main.cpp +++ b/qucs/qucs-edit/main.cpp @@ -99,13 +99,21 @@ int main(int argc, char *argv[]) // is application relocated? char * var = getenv ("QUCSDIR"); + QDir QucsDir; if (var != NULL) { - QDir QucsDir = QDir (var); + QucsDir = QDir (var); QString QucsDirStr = QucsDir.canonicalPath (); QucsSettings.LangDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/"); } else { - QucsSettings.LangDir = LANGUAGEDIR; + QString QucsApplicationPath = QCoreApplication::applicationDirPath(); +#ifdef __APPLE__ + QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); +#else + QucsDir = QDir(QucsApplicationPath); + QucsDir.cdUp(); +#endif + QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; } loadSettings(); diff --git a/qucs/qucs-filter-v2/qf_main.cpp b/qucs/qucs-filter-v2/qf_main.cpp index cd035d9f74..a7bcf4e989 100644 --- a/qucs/qucs-filter-v2/qf_main.cpp +++ b/qucs/qucs-filter-v2/qf_main.cpp @@ -41,13 +41,21 @@ int main (int argc, char * argv []) { // is application relocated? char * var = getenv ("QUCSDIR"); + QDir QucsDir; if (var != NULL) { - QDir QucsDir = QDir (var); + QucsDir = QDir (var); QString QucsDirStr = QucsDir.canonicalPath (); QucsSettings.LangDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/"); } else { - QucsSettings.LangDir = LANGUAGEDIR; + QString QucsApplicationPath = QCoreApplication::applicationDirPath(); +#ifdef __APPLE__ + QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); +#else + QucsDir = QDir(QucsApplicationPath); + QucsDir.cdUp(); +#endif + QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; } loadSettings(); diff --git a/qucs/qucs-filter/main.cpp b/qucs/qucs-filter/main.cpp index a8748b960a..69847e35e2 100644 --- a/qucs/qucs-filter/main.cpp +++ b/qucs/qucs-filter/main.cpp @@ -84,13 +84,21 @@ int main(int argc, char *argv[]) // is application relocated? char * var = getenv ("QUCSDIR"); + QDir QucsDir; if (var != NULL) { - QDir QucsDir = QDir (var); + QucsDir = QDir (var); QString QucsDirStr = QucsDir.canonicalPath (); QucsSettings.LangDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/"); } else { - QucsSettings.LangDir = LANGUAGEDIR; + QString QucsApplicationPath = QCoreApplication::applicationDirPath(); +#ifdef __APPLE__ + QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); +#else + QucsDir = QDir(QucsApplicationPath); + QucsDir.cdUp(); +#endif + QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; } loadSettings(); diff --git a/qucs/qucs-rescodes/main.cpp b/qucs/qucs-rescodes/main.cpp index 87a36327bd..a5fd6b29c6 100644 --- a/qucs/qucs-rescodes/main.cpp +++ b/qucs/qucs-rescodes/main.cpp @@ -235,7 +235,14 @@ int main( int argc, char **argv ) QucsDir = QDir(QString(var)); QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; } else { - QucsSettings.LangDir = LANGUAGEDIR; + QString QucsApplicationPath = QCoreApplication::applicationDirPath(); +#ifdef __APPLE__ + QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); +#else + QucsDir = QDir(QucsApplicationPath); + QucsDir.cdUp(); +#endif + QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; } loadSettings(); diff --git a/qucs/qucs-transcalc/main.cpp b/qucs/qucs-transcalc/main.cpp index 52479579cb..cbe2138939 100644 --- a/qucs/qucs-transcalc/main.cpp +++ b/qucs/qucs-transcalc/main.cpp @@ -105,13 +105,21 @@ int main(int argc, char *argv[]) // is application relocated? char * var = getenv ("QUCSDIR"); + QDir QucsDir; if (var != NULL) { - QDir QucsDir = QDir (var); + QucsDir = QDir (var); QString QucsDirStr = QucsDir.canonicalPath (); QucsSettings.LangDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/"); } else { - QucsSettings.LangDir = LANGUAGEDIR; + QString QucsApplicationPath = QCoreApplication::applicationDirPath(); +#ifdef __APPLE__ + QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); +#else + QucsDir = QDir(QucsApplicationPath); + QucsDir.cdUp(); +#endif + QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; } QucsSettings.QucsWorkDir.setPath (QDir::homePath()+QDir::convertSeparators ("/.qucs")); loadSettings(); From aac603b847eeb71f12e351419b6d6d4f321a5ba4 Mon Sep 17 00:00:00 2001 From: Guilherme Brondani Torri Date: Mon, 28 Mar 2016 18:39:54 +0200 Subject: [PATCH 4/4] Remove LANGUAGEDIR definition. The language files are installed into [prefix]/share/qucs/lang regardless of the definition of LANGUAGEDIR. --- qucs/config.h.cmake | 1 - qucs/configure.ac | 6 ------ qucs/qucs-activefilter/CMakeLists.txt | 3 --- qucs/qucs-attenuator/CMakeLists.txt | 3 --- qucs/qucs-edit/CMakeLists.txt | 3 --- qucs/qucs-filter-v2/CMakeLists.txt | 2 -- qucs/qucs-filter/CMakeLists.txt | 3 --- qucs/qucs-help/CMakeLists.txt | 3 --- qucs/qucs-lib/CMakeLists.txt | 3 --- qucs/qucs-rescodes/CMakeLists.txt | 3 --- qucs/qucs-transcalc/CMakeLists.txt | 3 --- qucs/qucs/CMakeLists.txt | 4 ---- qucs/translations/CMakeLists.txt | 6 +----- 13 files changed, 1 insertion(+), 42 deletions(-) diff --git a/qucs/config.h.cmake b/qucs/config.h.cmake index 866a269085..cab35aebfb 100755 --- a/qucs/config.h.cmake +++ b/qucs/config.h.cmake @@ -1,4 +1,3 @@ -#cmakedefine LANGUAGEDIR "@LANGUAGEDIR@" #define PACKAGE_VERSION "@PROJECT_VERSION@" #define PACKAGE_STRING "qucs @PROJECT_VERSION@" diff --git a/qucs/configure.ac b/qucs/configure.ac index fca69cbe8c..3f6c8265e0 100644 --- a/qucs/configure.ac +++ b/qucs/configure.ac @@ -764,12 +764,6 @@ mingw* | *msys* | cygwin*) esac AC_SUBST(PATHXFORM) -dnl Create path info. -LANG_PATH="$prefix/share/qucs/lang/" -AC_DEFINE_UNQUOTED([LANGUAGEDIR], ["$LANG_PATH"], - [Where the language files go.]) -unset LANG_PATH - dnl Definitions at top of . AH_TOP([ /* __BEGIN_DECLS should be used at the beginning of your declarations, diff --git a/qucs/qucs-activefilter/CMakeLists.txt b/qucs/qucs-activefilter/CMakeLists.txt index 913cb9ecde..12a06494a1 100644 --- a/qucs/qucs-activefilter/CMakeLists.txt +++ b/qucs/qucs-activefilter/CMakeLists.txt @@ -25,9 +25,6 @@ IF(NOT WIN32) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register ") ENDIF() -# define variables -SET(LANGUAGEDIR "${CMAKE_INSTALL_PREFIX}/share/qucs/lang/") - #configure the header config.h CONFIGURE_FILE ( "${PROJECT_SOURCE_DIR}/../config.h.cmake" diff --git a/qucs/qucs-attenuator/CMakeLists.txt b/qucs/qucs-attenuator/CMakeLists.txt index 49b56bee1e..3466ebacf5 100644 --- a/qucs/qucs-attenuator/CMakeLists.txt +++ b/qucs/qucs-attenuator/CMakeLists.txt @@ -17,9 +17,6 @@ SET(CMAKE_BUILD_TYPE Debug) ADD_DEFINITIONS( -DHAVE_CONFIG_H ) -# define variables -SET(LANGUAGEDIR "${CMAKE_INSTALL_PREFIX}/share/qucs/lang/") - # configure the header config.h CONFIGURE_FILE ( "${PROJECT_SOURCE_DIR}/../config.h.cmake" diff --git a/qucs/qucs-edit/CMakeLists.txt b/qucs/qucs-edit/CMakeLists.txt index b5bdddcb0e..4d24714dda 100644 --- a/qucs/qucs-edit/CMakeLists.txt +++ b/qucs/qucs-edit/CMakeLists.txt @@ -17,9 +17,6 @@ SET(CMAKE_BUILD_TYPE Debug) ADD_DEFINITIONS( -DHAVE_CONFIG_H ) -# define variables -SET(LANGUAGEDIR "${CMAKE_INSTALL_PREFIX}/share/qucs/lang/") - # configure the header config.h CONFIGURE_FILE ( "${PROJECT_SOURCE_DIR}/../config.h.cmake" diff --git a/qucs/qucs-filter-v2/CMakeLists.txt b/qucs/qucs-filter-v2/CMakeLists.txt index efdb441434..9f90cb4bba 100644 --- a/qucs/qucs-filter-v2/CMakeLists.txt +++ b/qucs/qucs-filter-v2/CMakeLists.txt @@ -2,8 +2,6 @@ PROJECT(qucsfilter-v2 CXX C) CMAKE_MINIMUM_REQUIRED(VERSION 2.6) cmake_policy(VERSION 2.6) -SET(LANGUAGEDIR TRUE) - SET(CMAKE_BUILD_TYPE Debug) # The incomplete filter-v2 only builds withs -stdlib=libstc++ diff --git a/qucs/qucs-filter/CMakeLists.txt b/qucs/qucs-filter/CMakeLists.txt index d8fe16cacf..c725fcc57e 100644 --- a/qucs/qucs-filter/CMakeLists.txt +++ b/qucs/qucs-filter/CMakeLists.txt @@ -17,9 +17,6 @@ SET(CMAKE_BUILD_TYPE Debug) ADD_DEFINITIONS( -DHAVE_CONFIG_H ) -# define variables -SET(LANGUAGEDIR "${CMAKE_INSTALL_PREFIX}/share/qucs/lang/") - # configure the header config.h CONFIGURE_FILE ( "${PROJECT_SOURCE_DIR}/../config.h.cmake" diff --git a/qucs/qucs-help/CMakeLists.txt b/qucs/qucs-help/CMakeLists.txt index cf6fcca7c0..92fc529294 100644 --- a/qucs/qucs-help/CMakeLists.txt +++ b/qucs/qucs-help/CMakeLists.txt @@ -17,9 +17,6 @@ SET(CMAKE_BUILD_TYPE Debug) ADD_DEFINITIONS( -DHAVE_CONFIG_H ) -# define variables -SET(LANGUAGEDIR "${CMAKE_INSTALL_PREFIX}/share/qucs/lang/") - # configure the header config.h CONFIGURE_FILE ( "${PROJECT_SOURCE_DIR}/../config.h.cmake" diff --git a/qucs/qucs-lib/CMakeLists.txt b/qucs/qucs-lib/CMakeLists.txt index 49615739cd..98101feb9b 100644 --- a/qucs/qucs-lib/CMakeLists.txt +++ b/qucs/qucs-lib/CMakeLists.txt @@ -17,9 +17,6 @@ SET(CMAKE_BUILD_TYPE Debug) ADD_DEFINITIONS( -DHAVE_CONFIG_H ) -# define variables -SET(LANGUAGEDIR "${CMAKE_INSTALL_PREFIX}/share/qucs/lang/") - # configure the header config.h CONFIGURE_FILE ( "${PROJECT_SOURCE_DIR}/../config.h.cmake" diff --git a/qucs/qucs-rescodes/CMakeLists.txt b/qucs/qucs-rescodes/CMakeLists.txt index c508590ef6..e62d21f3f4 100644 --- a/qucs/qucs-rescodes/CMakeLists.txt +++ b/qucs/qucs-rescodes/CMakeLists.txt @@ -17,9 +17,6 @@ SET(CMAKE_BUILD_TYPE Debug) ADD_DEFINITIONS( -DHAVE_CONFIG_H ) -# define variables -SET(LANGUAGEDIR "${CMAKE_INSTALL_PREFIX}/share/qucs/lang/") - # configure the header config.h CONFIGURE_FILE ( "${PROJECT_SOURCE_DIR}/../config.h.cmake" diff --git a/qucs/qucs-transcalc/CMakeLists.txt b/qucs/qucs-transcalc/CMakeLists.txt index c306077163..b3410c942a 100644 --- a/qucs/qucs-transcalc/CMakeLists.txt +++ b/qucs/qucs-transcalc/CMakeLists.txt @@ -17,9 +17,6 @@ SET(CMAKE_BUILD_TYPE Debug) ADD_DEFINITIONS( -DHAVE_CONFIG_H ) -# define variables -SET(LANGUAGEDIR "${CMAKE_INSTALL_PREFIX}/share/qucs/lang/") - # configure the header config.h CONFIGURE_FILE ( "${PROJECT_SOURCE_DIR}/../config.h.cmake" diff --git a/qucs/qucs/CMakeLists.txt b/qucs/qucs/CMakeLists.txt index 2bb0e859c3..58cb5fec7e 100755 --- a/qucs/qucs/CMakeLists.txt +++ b/qucs/qucs/CMakeLists.txt @@ -54,10 +54,6 @@ endif() # ADD_DEFINITIONS( -DHAVE_CONFIG_H ) -# define variables -SET(LANGUAGEDIR "${CMAKE_INSTALL_PREFIX}/share/qucs/lang/") - - FIND_PACKAGE( Qt4 4.6.3 REQUIRED QtCore QtGui Qt3Support QtSvg QtXml QtScript) INCLUDE( ${QT_USE_FILE} ) diff --git a/qucs/translations/CMakeLists.txt b/qucs/translations/CMakeLists.txt index 6be103eb56..3c5396e52a 100644 --- a/qucs/translations/CMakeLists.txt +++ b/qucs/translations/CMakeLists.txt @@ -31,13 +31,9 @@ ENDIF (UPDATE_TRANSLATIONS) # #FILE(GLOB QtTRANSLATIONS qtgeneric_*.ts) -# -# location for translations -SET(LANGUAGEDIR "${CMAKE_INSTALL_PREFIX}/share/qucs/lang/") - # # install tranlations -INSTALL( FILES ${QM_FILES} DESTINATION ${LANGUAGEDIR}) +INSTALL( FILES ${QM_FILES} DESTINATION share/qucs/lang) # prevent the generated files from being deleted during make clean #set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM true)