[PATCH] Remove patches from the tree

25 views
Skip to first unread message

Mélanie Bats

unread,
Jan 6, 2013, 2:14:10 PM1/6/13
to pkg-config-suppor...@googlegroups.com, petri.t...@gmail.com, cdt...@gmail.com, melani...@obeo.fr
Signed-off-by: Mélanie Bats <melani...@obeo.fr>
---
.../0001-Use-List-instead-of-ArrayList.patch | 208 ---
...ference-to-set-the-pkg-config-binary-path.patch | 339 ----
...onment-variable-on-the-pkg-config-command.patch | 339 ----
...pkg-config-configuration-to-project-level.patch | 1867 --------------------
4 files changed, 2753 deletions(-)
delete mode 100644 org.eclipse.cdt.managedbuilder.pkgconfig/patches/0001-Use-List-instead-of-ArrayList.patch
delete mode 100644 org.eclipse.cdt.managedbuilder.pkgconfig/patches/0002-Add-preference-to-set-the-pkg-config-binary-path.patch
delete mode 100644 org.eclipse.cdt.managedbuilder.pkgconfig/patches/0003-Use-environment-variable-on-the-pkg-config-command.patch
delete mode 100644 org.eclipse.cdt.managedbuilder.pkgconfig/patches/0004-Move-pkg-config-configuration-to-project-level.patch

diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/patches/0001-Use-List-instead-of-ArrayList.patch b/org.eclipse.cdt.managedbuilder.pkgconfig/patches/0001-Use-List-instead-of-ArrayList.patch
deleted file mode 100644
index 1142d97..0000000
--- a/org.eclipse.cdt.managedbuilder.pkgconfig/patches/0001-Use-List-instead-of-ArrayList.patch
+++ /dev/null
@@ -1,208 +0,0 @@
-From a0f15bfbd9133d1bc5eca7377f19cad5c83ab4cd Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?M=C3=A9lanie=20Bats?= <melani...@obeo.fr>
-Date: Fri, 9 Nov 2012 19:34:15 +0100
-Subject: [PATCH 1/4] Use List instead of ArrayList
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Usually, the way to declare a list is to use the java.lang.List
-interface and not to use the specific ArrayList implementation.
-
-Signed-off-by: Mélanie Bats <melani...@obeo.fr>
----
- .../pkgconfig/properties/DataModelProvider.java | 8 ++++----
- .../settings/PkgConfigExternalSettingProvider.java | 17 +++++++++--------
- .../cdt/managedbuilder/pkgconfig/util/Parser.java | 13 +++++++------
- .../pkgconfig/util/PkgConfigUtil.java | 5 +++--
- 4 files changed, 23 insertions(+), 20 deletions(-)
-
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/properties/DataModelProvider.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/properties/DataModelProvider.java
-index b36ee7f..0ffe7bf 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/properties/DataModelProvider.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/properties/DataModelProvider.java
-@@ -30,9 +30,9 @@ public enum DataModelProvider {
- private DataModelProvider() {
- this.dms = new ArrayList<DataModel>();
-
-- ArrayList<String> packages = PkgConfigUtil.getAllPackages();
-- ArrayList<String> pkgList = Parser.parsePackageList(packages);
-- ArrayList<String> nonSortedPkgList = Parser.parsePackageList(packages);
-+ List<String> packages = PkgConfigUtil.getAllPackages();
-+ List<String> pkgList = Parser.parsePackageList(packages);
-+ List<String> nonSortedPkgList = Parser.parsePackageList(packages);
- HashMap<Integer, Integer> origSortedIdx = new HashMap<Integer, Integer>();
- Collections.sort(pkgList, String.CASE_INSENSITIVE_ORDER);
- int sortedIdx;
-@@ -43,7 +43,7 @@ public enum DataModelProvider {
- }
-
- //get descriptions and sort according to package names
-- ArrayList<String> descs = Parser.parseDescription(packages);
-+ List<String> descs = Parser.parseDescription(packages);
- int cellPlace;
- String[] sortedArray = new String[descs.size()];
- for (int i=0; i<descs.size(); i++) {
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/settings/PkgConfigExternalSettingProvider.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/settings/PkgConfigExternalSettingProvider.java
-index 37975c5..6f1f5fa 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/settings/PkgConfigExternalSettingProvider.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/settings/PkgConfigExternalSettingProvider.java
-@@ -12,6 +12,7 @@ package org.eclipse.cdt.managedbuilder.pkgconfig.settings;
-
- import java.util.ArrayList;
- import java.util.Collections;
-+import java.util.List;
-
- import org.eclipse.cdt.core.model.CoreModel;
- import org.eclipse.cdt.core.settings.model.CExternalSetting;
-@@ -157,7 +158,7 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- * @return
- */
- private static ICLanguageSettingEntry[] formIncludePathEntries(String[] includes) {
-- ArrayList<ICLanguageSettingEntry> incPathEntries = new ArrayList<ICLanguageSettingEntry>();
-+ List<ICLanguageSettingEntry> incPathEntries = new ArrayList<ICLanguageSettingEntry>();
- for(String inc : includes) {
- ICIncludePathEntry incPathEntry = new CIncludePathEntry(new Path(inc),
- ICSettingEntry.INCLUDE_PATH);
-@@ -172,7 +173,7 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- * @return
- */
- private static ICLanguageSettingEntry[] formLibraryFileEntries(String[] libs) {
-- ArrayList<ICLanguageSettingEntry> libEntries = new ArrayList<ICLanguageSettingEntry>();
-+ List<ICLanguageSettingEntry> libEntries = new ArrayList<ICLanguageSettingEntry>();
- for(String lib : libs) {
- CLibraryFileEntry libFileEntry = new CLibraryFileEntry(lib,
- ICSettingEntry.LIBRARY_FILE);
-@@ -187,7 +188,7 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- * @return
- */
- private static ICLanguageSettingEntry[] formLibraryPathEntries(String[] libPaths) {
-- ArrayList<ICLanguageSettingEntry> libPathEntries = new ArrayList<ICLanguageSettingEntry>();
-+ List<ICLanguageSettingEntry> libPathEntries = new ArrayList<ICLanguageSettingEntry>();
- for(String libPath : libPaths) {
- CLibraryPathEntry libPathEntry = new CLibraryPathEntry(new Path(libPath),
- ICSettingEntry.LIBRARY_PATH);
-@@ -202,7 +203,7 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- * @return
- */
- private static String[] getIncludePathsFromCheckedPackages(IProject proj) {
-- ArrayList<String> includeList = new ArrayList<String>();
-+ List<String> includeList = new ArrayList<String>();
- String[] pkgs = getCheckedPackageNames(proj);
- String cflags = null;
- String[] includeArray = null;
-@@ -222,7 +223,7 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- * @return
- */
- private static String[] getLibraryFilesFromCheckedPackages(IProject proj) {
-- ArrayList<String> libList = new ArrayList<String>();
-+ List<String> libList = new ArrayList<String>();
- String[] pkgs = getCheckedPackageNames(proj);
- String libs = null;
- String[] libArray = null;
-@@ -242,7 +243,7 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- * @return
- */
- private static String[] getLibraryPathsFromCheckedPackages(IProject proj) {
-- ArrayList<String> libPathList = new ArrayList<String>();
-+ List<String> libPathList = new ArrayList<String>();
- String[] pkgs = getCheckedPackageNames(proj);
- String libPaths = null;
- String[] libPathArray = null;
-@@ -262,7 +263,7 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- * @return
- */
- static String[] getOtherFlagsFromCheckedPackages(IProject proj) {
-- ArrayList<String> otherFlagList = new ArrayList<String>();
-+ List<String> otherFlagList = new ArrayList<String>();
- String[] pkgs = getCheckedPackageNames(proj);
- String cflags = null;
- String[] otherFlagArray = null;
-@@ -326,7 +327,7 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- private static String[] getCheckedPackageNames(IProject proj) {
- ICStorageElement pkgStorage = getPackageStorage(proj);
- String[] pkgNames = pkgStorage.getAttributeNames();
-- ArrayList<String> pkgs = new ArrayList<String>();
-+ List<String> pkgs = new ArrayList<String>();
- String value = null;
- for(String pkgName : pkgNames) {
- value = pkgStorage.getAttribute(pkgName);
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/Parser.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/Parser.java
-index 72b2e40..316a88f 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/Parser.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/Parser.java
-@@ -11,6 +11,7 @@
- package org.eclipse.cdt.managedbuilder.pkgconfig.util;
-
- import java.util.ArrayList;
-+import java.util.List;
-
- /**
- * Parses pkg-config utility output.
-@@ -172,13 +173,13 @@ public class Parser {
- }
-
- /**
-- * Parse package list so that only package names are added to ArrayList.
-+ * Parse package list so that only package names are added to List.
- *
- * @param packages
- * @return
- */
-- public static ArrayList<String> parsePackageList(ArrayList<String> packages) {
-- ArrayList<String> operated = new ArrayList<String>();
-+ public static List<String> parsePackageList(List<String> packages) {
-+ List<String> operated = new ArrayList<String>();
- for (String s : packages) {
- //cut the string after the first white space
- int end = s.indexOf(" "); //$NON-NLS-1$
-@@ -188,13 +189,13 @@ public class Parser {
- }
-
- /**
-- * Parse package list that only package descriptions are added to ArrayList.
-+ * Parse package list that only package descriptions are added to List.
- *
- * @param packages
- * @return
- */
-- public static ArrayList<String> parseDescription(ArrayList<String> packages) {
-- ArrayList<String> operated = new ArrayList<String>();
-+ public static List<String> parseDescription(List<String> packages) {
-+ List<String> operated = new ArrayList<String>();
- int ws, start = 0;
- for (String s : packages) {
- ws = s.indexOf(" "); //$NON-NLS-1$
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java
-index 3b3e71e..3517733 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java
-@@ -14,6 +14,7 @@ import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.ArrayList;
-+import java.util.List;
-
- import org.eclipse.cdt.managedbuilder.pkgconfig.Activator;
- import org.eclipse.cdt.managedbuilder.pkgconfig.preferences.PreferenceStore;
-@@ -141,7 +142,7 @@ public class PkgConfigUtil {
- *
- * @return
- */
-- public static ArrayList<String> getAllPackages() {
-+ public static List<String> getAllPackages() {
- ProcessBuilder pb = null;
- String confPath = PreferenceStore.getPkgConfigPath();
- if (OSDetector.isUnix() || OSDetector.isMac()) {
-@@ -166,7 +167,7 @@ public class PkgConfigUtil {
- String line;
- BufferedReader input = new BufferedReader
- (new InputStreamReader(p.getInputStream()));
-- ArrayList<String> packageList = new ArrayList<String>();
-+ List<String> packageList = new ArrayList<String>();
- do {
- line = input.readLine();
- if (line != null) {
---
-1.7.9.5
-
diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/patches/0002-Add-preference-to-set-the-pkg-config-binary-path.patch b/org.eclipse.cdt.managedbuilder.pkgconfig/patches/0002-Add-preference-to-set-the-pkg-config-binary-path.patch
deleted file mode 100644
index fec48a8..0000000
--- a/org.eclipse.cdt.managedbuilder.pkgconfig/patches/0002-Add-preference-to-set-the-pkg-config-binary-path.patch
+++ /dev/null
@@ -1,339 +0,0 @@
-From 8092c6393a3f0d065169ab4129ca4c1b526c3935 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?M=C3=A9lanie=20Bats?= <melani...@obeo.fr>
-Date: Fri, 9 Nov 2012 21:07:22 +0100
-Subject: [PATCH 2/4] Add preference to set the pkg-config binary path
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-There was a confusion in the code between the PKG_CONFIG_PATH
-variable and the path to the pkg-config binary. The former was used
-as the location for the pkg-config binary which is wrong.
-
-This commit creates an additional preference to set the location of
-the pkg-config binary and uses it to call the pkg-config binary.
-
-Signed-off-by: Mélanie Bats <melani...@obeo.fr>
----
- .../pkgconfig/preferences/Messages.java | 1 +
- .../preferences/PkgConfigBinPathFieldEditor.java | 125 ++++++++++++++++++++
- .../pkgconfig/preferences/PreferenceConstants.java | 5 +-
- .../pkgconfig/preferences/PreferencePage.java | 11 ++
- .../pkgconfig/preferences/PreferenceStore.java | 19 +++
- .../pkgconfig/preferences/messages.properties | 1 +
- .../pkgconfig/util/PkgConfigUtil.java | 51 ++++----
- 7 files changed, 183 insertions(+), 30 deletions(-)
- create mode 100644 org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PkgConfigBinPathFieldEditor.java
-
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/Messages.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/Messages.java
-index 87f740b..31986b9 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/Messages.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/Messages.java
-@@ -20,6 +20,7 @@ public class Messages extends NLS {
- public static String PreferencePage_0;
- public static String PreferencePage_1;
- public static String PreferencePage_2;
-+ public static String PreferencePage_3;
-
- static {
- // initialize resource bundle
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PkgConfigBinPathFieldEditor.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PkgConfigBinPathFieldEditor.java
-new file mode 100644
-index 0000000..2eff9a0
---- /dev/null
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PkgConfigBinPathFieldEditor.java
-@@ -0,0 +1,125 @@
-+/*******************************************************************************
-+ * Copyright (c) 2012 Melanie Bats and others.
-+ * All rights reserved. This program and the accompanying materials
-+ * are made available under the terms of the Eclipse Public License v1.0
-+ * which accompanies this distribution, and is available at
-+ * http://www.eclipse.org/legal/epl-v10.html
-+ *
-+ * Contributors:
-+ * Melanie Bats - Initial implementation
-+ *******************************************************************************/
-+package org.eclipse.cdt.managedbuilder.pkgconfig.preferences;
-+
-+import java.io.File;
-+
-+import org.eclipse.jface.preference.StringButtonFieldEditor;
-+import org.eclipse.jface.resource.JFaceResources;
-+import org.eclipse.swt.SWT;
-+import org.eclipse.swt.widgets.Composite;
-+import org.eclipse.swt.widgets.FileDialog;
-+
-+public class PkgConfigBinPathFieldEditor extends StringButtonFieldEditor {
-+
-+ /**
-+ * Initial path for the Browse dialog.
-+ */
-+ private File filterPath = null;
-+
-+ /**
-+ * Creates a pkg-config bin editor
-+ */
-+ protected PkgConfigBinPathFieldEditor() {
-+ }
-+
-+ /**
-+ * Creates a pkg-config bin editor.
-+ *
-+ * @param name
-+ * the name of the preference this field editor works on
-+ * @param labelText
-+ * the label text of the field editor
-+ * @param parent
-+ * the parent of the field editor's control
-+ */
-+ public PkgConfigBinPathFieldEditor(String name, String labelText,
-+ Composite parent) {
-+ init(name, labelText);
-+ setErrorMessage(JFaceResources
-+ .getString("FileFieldEditor.errorMessage"));//$NON-NLS-1$
-+ setChangeButtonText(JFaceResources.getString("openBrowse"));//$NON-NLS-1$
-+ setValidateStrategy(VALIDATE_ON_FOCUS_LOST);
-+ createControl(parent);
-+ }
-+
-+ /**
-+ * Helper that opens the directory chooser dialog.
-+ *
-+ * @param startingDirectory
-+ * The directory the dialog will open in.
-+ * @return File File or <code>null</code>.
-+ *
-+ */
-+ private File getFile(File startingDirectory) {
-+ FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN | SWT.SHEET);
-+
-+ if (startingDirectory != null) {
-+ fileDialog.setFilterPath(startingDirectory.getPath());
-+ } else if (this.filterPath != null) {
-+ fileDialog.setFilterPath(this.filterPath.getPath());
-+ }
-+
-+ String dir = fileDialog.open();
-+ if (dir != null) {
-+ dir = dir.trim();
-+ if (dir.length() > 0) {
-+ return new File(dir);
-+ }
-+ }
-+ return null;
-+ }
-+
-+ @Override
-+ /*
-+ * (non-Javadoc) Method declared on StringButtonFieldEditor. Opens the
-+ * directory chooser dialog and returns the selected directory.
-+ */
-+ protected String changePressed() {
-+ File f = new File(getTextControl().getText());
-+ if (!f.exists()) {
-+ f = null;
-+ }
-+ File d = getFile(f);
-+ if (d == null) {
-+ return null;
-+ }
-+
-+ return d.getAbsolutePath();
-+ }
-+
-+ @Override
-+ /*
-+ * (non-Javadoc) Method declared on StringFieldEditor. Checks whether the
-+ * text input field contains a valid directory.
-+ */
-+ protected boolean doCheckState() {
-+ String fileName = getTextControl().getText();
-+ fileName = fileName.trim();
-+ if (fileName.length() == 0 && isEmptyStringAllowed()) {
-+ return true;
-+ }
-+ File file = new File(fileName);
-+ return !file.isDirectory() && file.getName().contains("pkg-config"); //$NON-NLS-1$
-+ }
-+
-+ /**
-+ * Sets the initial path for the Browse dialog.
-+ *
-+ * @param path
-+ * initial path for the Browse dialog
-+ * @since 3.6
-+ */
-+ public void setFilterPath(File path) {
-+ this.filterPath = path;
-+ }
-+
-+}
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferenceConstants.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferenceConstants.java
-index ec1d31b..1a7617e 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferenceConstants.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferenceConstants.java
-@@ -18,5 +18,6 @@ public class PreferenceConstants {
-
- public static final String PKG_CONFIG_LIBDIR = "Replaces the" + //$NON-NLS-1$
- " default pkg-config search directory."; //$NON-NLS-1$
--
--}
-+
-+ public static final String PKG_CONFIG_BIN = "Path to the pkg-config executable"; //$NON-NLS-1$
-+}
-\ No newline at end of file
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferencePage.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferencePage.java
-index 184484a..7faf7aa 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferencePage.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferencePage.java
-@@ -33,6 +33,7 @@ import org.eclipse.ui.PlatformUI;
- public class PreferencePage extends FieldEditorPreferencePage
- implements IWorkbenchPreferencePage {
-
-+ private PkgConfigBinPathFieldEditor pkgConfigBinEditor;
- private PkgConfigPathListEditor configPathListEditor;
- private LibDirFieldEditor libDirEditor;
-
-@@ -80,6 +81,11 @@ implements IWorkbenchPreferencePage {
- vars.createVariable("PKG_CONFIG_PATH", PreferenceStore.getPkgConfigPath()); //$NON-NLS-1$
- fUserSupplier.setWorkspaceEnvironment(vars);
-
-+ // create PKG_CONFIG_BIN environment variable
-+ String pkgConfigBinEditorValue = this.pkgConfigBinEditor
-+ .getStringValue();
-+ PreferenceStore.setPkgConfigBin(pkgConfigBinEditorValue);
-+
- restartWorkspaceDialog();
-
- return true;
-@@ -119,6 +125,11 @@ implements IWorkbenchPreferencePage {
- * Creates field editors for the preference page.
- */
- protected void createFieldEditors() {
-+ // field PKG_CONFIG_BIN
-+ this.pkgConfigBinEditor = new PkgConfigBinPathFieldEditor(
-+ PreferenceConstants.PKG_CONFIG_BIN, Messages.PreferencePage_3,
-+ getFieldEditorParent());
-+ addField(this.pkgConfigBinEditor);
- //list editor for PKG_CONFIG_PATH values
- this.configPathListEditor = new PkgConfigPathListEditor(
- PreferenceConstants.PKG_CONFIG_PATH, Messages.PreferencePage_1,
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferenceStore.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferenceStore.java
-index ed2ee96..3829e8b 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferenceStore.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferenceStore.java
-@@ -54,6 +54,25 @@ public class PreferenceStore {
- }
-
- /**
-+ * Set pkg-config bin to the preference store.
-+ *
-+ * @param path
-+ * The pkg-config bin.
-+ */
-+ public static void setPkgConfigBin(String path) {
-+ setPreferenceStoreValue(PreferenceConstants.PKG_CONFIG_BIN, path);
-+ }
-+
-+ /**
-+ * Get pkg-config bin path from the preference store.
-+ *
-+ * @return pkg-config bin path.
-+ */
-+ public static String getPkgConfigBinPath() {
-+ return getPreferenceStoreValue(PreferenceConstants.PKG_CONFIG_BIN);
-+ }
-+
-+ /**
- * Get pkg-config path from the preference store.
- *
- * @return pkg-config path.
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/messages.properties b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/messages.properties
-index 41f54bd..cee06c7 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/messages.properties
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/messages.properties
-@@ -1,5 +1,6 @@
- PreferencePage_0=Preferences for Pkg-config
- PreferencePage_1=PKG_CONFIG_PATH:
- PreferencePage_2=PKG_CONFIG_LIBDIR (replaces default):
-+PreferencePage_3=Path to pkg-config executable:
- PkgConfigPathListEditor_0=Browse a directory path
- PkgConfigPathListEditor_1=Select a directory
-\ No newline at end of file
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java
-index 3517733..5601645 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java
-@@ -45,23 +45,21 @@ public class PkgConfigUtil {
- */
- private static String getPkgOutput(String command, String pkg) {
- ProcessBuilder pb = null;
-- String confPath = PreferenceStore.getPkgConfigPath();
-+ String pkgConfigBinPath = PreferenceStore.getPkgConfigBinPath();
-+ if (pkgConfigBinPath.isEmpty()) {
-+ if (OSDetector.isWindows())
-+ pkgConfigBinPath = PKG_CONFIG + ".exe"; //$NON-NLS-1$
-+ else
-+ pkgConfigBinPath = PKG_CONFIG;
-+ }
-+
- if (OSDetector.isUnix() || OSDetector.isMac()) {
-- if (confPath!=null && !confPath.equals("")) { //$NON-NLS-1$
-- confPath = confPath.replace(" ", "\\ "); //$NON-NLS-1$ //$NON-NLS-2$
-- pb = new ProcessBuilder("bash", "-c", confPath+ //$NON-NLS-1$ //$NON-NLS-2$
-- Separators.getFileSeparator()+PKG_CONFIG+" "+command+" "+pkg); //$NON-NLS-1$ //$NON-NLS-2$
-- } else {
-- pb = new ProcessBuilder("bash", "-c", PKG_CONFIG+" "+command+" "+pkg); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-- }
-+ pb = new ProcessBuilder(
-+ "bash", "-c", pkgConfigBinPath + " " + command + " " + pkg); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- } else if (OSDetector.isWindows()) {
-- if (confPath!=null && !confPath.equals("")) { //$NON-NLS-1$
-- pb = new ProcessBuilder("cmd", "/c", "\""+confPath+ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-- Separators.getFileSeparator()+PKG_CONFIG+"\"", command, pkg); //$NON-NLS-1$
-- } else {
-- pb = new ProcessBuilder("cmd", "/c", PKG_CONFIG, command, pkg); //$NON-NLS-1$ //$NON-NLS-2$
-- }
-+ pb = new ProcessBuilder("cmd", "/c", pkgConfigBinPath, command, pkg); //$NON-NLS-1$ //$NON-NLS-2$
- }
-+
- Process p = null;
- try {
- if (pb != null) {
-@@ -144,22 +142,19 @@ public class PkgConfigUtil {
- */
- public static List<String> getAllPackages() {
- ProcessBuilder pb = null;
-- String confPath = PreferenceStore.getPkgConfigPath();
-+ String pkgConfigBinPath = PreferenceStore.getPkgConfigBinPath();
-+ if (pkgConfigBinPath.isEmpty()) {
-+ if (OSDetector.isWindows())
-+ pkgConfigBinPath = PKG_CONFIG + ".exe"; //$NON-NLS-1$
-+ else
-+ pkgConfigBinPath = PKG_CONFIG;
-+ }
- if (OSDetector.isUnix() || OSDetector.isMac()) {
-- if (confPath!=null && !confPath.equals("")) { //$NON-NLS-1$
-- confPath = confPath.replace(" ", "\\ "); //$NON-NLS-1$ //$NON-NLS-2$
-- pb = new ProcessBuilder("bash", "-c", confPath+ //$NON-NLS-1$ //$NON-NLS-2$
-- Separators.getFileSeparator()+PKG_CONFIG+" "+LIST_PACKAGES); //$NON-NLS-1$
-- } else {
-- pb = new ProcessBuilder("bash", "-c", PKG_CONFIG+" "+LIST_PACKAGES); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-- }
-+ pkgConfigBinPath = pkgConfigBinPath.replace(" ", "\\ "); //$NON-NLS-1$ //$NON-NLS-2$
-+ pb = new ProcessBuilder("bash", "-c", pkgConfigBinPath + " " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-+ + LIST_PACKAGES);
- } else if (OSDetector.isWindows()) {
-- if (confPath!=null && !confPath.equals("")) { //$NON-NLS-1$
-- pb = new ProcessBuilder("cmd", "/c", "\""+confPath+ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-- Separators.getFileSeparator()+PKG_CONFIG+"\"", LIST_PACKAGES); //$NON-NLS-1$
-- } else {
-- pb = new ProcessBuilder("cmd", "/c", PKG_CONFIG, LIST_PACKAGES); //$NON-NLS-1$ //$NON-NLS-2$
-- }
-+ pb = new ProcessBuilder("cmd", "/c", pkgConfigBinPath, LIST_PACKAGES); //$NON-NLS-1$ //$NON-NLS-2$
- }
- try {
- if (pb !=null) {
---
-1.7.9.5
-
diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/patches/0003-Use-environment-variable-on-the-pkg-config-command.patch b/org.eclipse.cdt.managedbuilder.pkgconfig/patches/0003-Use-environment-variable-on-the-pkg-config-command.patch
deleted file mode 100644
index 2074dd7..0000000
--- a/org.eclipse.cdt.managedbuilder.pkgconfig/patches/0003-Use-environment-variable-on-the-pkg-config-command.patch
+++ /dev/null
@@ -1,339 +0,0 @@
-From bf05d03f5bdf7c733c42fab4b1db4392ae09fcb8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?M=C3=A9lanie=20Bats?= <melani...@obeo.fr>
-Date: Sun, 11 Nov 2012 20:53:26 +0100
-Subject: [PATCH 3/4] Use environment variable on the pkg-config command
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The code was modified to use the pkg-config environment variables
-PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR directly on the pkg-config
-command and consequently do not use anymore the workspace
-environment variables. This avoid the needs to restart Eclipse
-after the change of those variables in the preference page.
-
-Signed-off-by: Mélanie Bats <melani...@obeo.fr>
----
- .../pkgconfig/preferences/PreferencePage.java | 44 +-----
- .../pkgconfig/util/PkgConfigUtil.java | 161 ++++++++++++--------
- 2 files changed, 98 insertions(+), 107 deletions(-)
-
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferencePage.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferencePage.java
-index 7faf7aa..7a2bb4e 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferencePage.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferencePage.java
-@@ -10,16 +10,10 @@
- *******************************************************************************/
- package org.eclipse.cdt.managedbuilder.pkgconfig.preferences;
-
--import org.eclipse.cdt.internal.core.envvar.EnvironmentVariableManager;
--import org.eclipse.cdt.internal.core.envvar.UserDefinedEnvironmentSupplier;
- import org.eclipse.cdt.managedbuilder.pkgconfig.Activator;
--import org.eclipse.cdt.utils.envvar.StorableEnvironment;
--import org.eclipse.jface.dialogs.MessageDialog;
- import org.eclipse.jface.preference.FieldEditorPreferencePage;
--import org.eclipse.swt.widgets.Display;
- import org.eclipse.ui.IWorkbench;
- import org.eclipse.ui.IWorkbenchPreferencePage;
--import org.eclipse.ui.PlatformUI;
-
- /**
- * This class represents a preference page that
-@@ -72,50 +66,16 @@ implements IWorkbenchPreferencePage {
- //create PKG_CONFIG_LIBDIR environment variable
- String libEditorValue = this.libDirEditor.getStringValue();
- PreferenceStore.setPkgConfigLibDir(libEditorValue);
-- UserDefinedEnvironmentSupplier fUserSupplier = EnvironmentVariableManager.fUserSupplier;
-- StorableEnvironment vars = fUserSupplier.getWorkspaceEnvironmentCopy();
-- vars.createVariable("PKG_CONFIG_LIBDIR", libEditorValue); //$NON-NLS-1$
-- fUserSupplier.setWorkspaceEnvironment(vars);
--
-- //create PKG_CONFIG_PATH environment variable
-- vars.createVariable("PKG_CONFIG_PATH", PreferenceStore.getPkgConfigPath()); //$NON-NLS-1$
-- fUserSupplier.setWorkspaceEnvironment(vars);
-
- // create PKG_CONFIG_BIN environment variable
- String pkgConfigBinEditorValue = this.pkgConfigBinEditor
- .getStringValue();
- PreferenceStore.setPkgConfigBin(pkgConfigBinEditorValue);
--
-- restartWorkspaceDialog();
-
- return true;
- }
--
-- /**
-- * Shows a dialog asking to restart workspace if pkg-config
-- * preferences have been changed.
-- */
-- private static void restartWorkspaceDialog() {
-- MessageDialog dialog = new MessageDialog(
-- null, "Restart workspace?", null, "Changes made to pkg-config" + //$NON-NLS-1$ //$NON-NLS-2$
-- " preferences need workspace restart in order to" + //$NON-NLS-1$
-- " take effect.\n\n" + //$NON-NLS-1$
-- "Would you like to restart the workspace now?", //$NON-NLS-1$
-- MessageDialog.QUESTION,
-- new String[] {"Yes", "No"}, //$NON-NLS-1$ //$NON-NLS-2$
-- 0);
-- int result = dialog.open();
-- if (result==0) {
-- Display.getDefault().asyncExec(new Runnable() {
-- @Override
-- public void run() {
-- PlatformUI.getWorkbench().restart();
-- }
-- });
-- }
-- }
--
-- @Override
-+
-+ @Override
- protected void performApply() {
- performOk();
- }
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java
-index 5601645..923753c 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java
-@@ -22,7 +22,7 @@ import org.eclipse.cdt.managedbuilder.pkgconfig.preferences.PreferenceStore;
- /**
- * Runs pkg-config utility in the command line and outputs necessary
- * options to build the given package.
-- *
-+ *
- */
- public class PkgConfigUtil {
-
-@@ -39,13 +39,33 @@ public class PkgConfigUtil {
- * Get options needed to build the given package.
- * Does not like spaces on paths except that getAllPackages seem to work.
- *
-- * @param command
-+ * @param pkgConfigOptions
-+ * Pkg-config options
- * @param pkg
- * @return
- */
-- private static String getPkgOutput(String command, String pkg) {
-+ private static String getPkgOutput(String pkgConfigOptions) {
-+ List<String> pkgOutputs = getPkgOutputs(pkgConfigOptions);
-+ if (pkgOutputs.isEmpty())
-+ return null;
-+ return pkgOutputs.get(0);
-+ }
-+
-+ /**
-+ * Get options needed to build the given package. Does not like spaces on
-+ * paths except that getAllPackages seem to work.
-+ *
-+ * @param pkgconfigOptions
-+ * Pkg-config options as --list-all, --libs...
-+ * @param pkg
-+ * Pkg-config library name. In case of --list-all option, it must
-+ * be set to null
-+ * @return pkg-config command results as a list of string
-+ */
-+ private static List<String> getPkgOutputs(String pkgconfigOptions) {
- ProcessBuilder pb = null;
- String pkgConfigBinPath = PreferenceStore.getPkgConfigBinPath();
-+
- if (pkgConfigBinPath.isEmpty()) {
- if (OSDetector.isWindows())
- pkgConfigBinPath = PKG_CONFIG + ".exe"; //$NON-NLS-1$
-@@ -53,36 +73,80 @@ public class PkgConfigUtil {
- pkgConfigBinPath = PKG_CONFIG;
- }
-
-- if (OSDetector.isUnix() || OSDetector.isMac()) {
-- pb = new ProcessBuilder(
-- "bash", "-c", pkgConfigBinPath + " " + command + " " + pkg); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-- } else if (OSDetector.isWindows()) {
-- pb = new ProcessBuilder("cmd", "/c", pkgConfigBinPath, command, pkg); //$NON-NLS-1$ //$NON-NLS-2$
-+ String pkgConfigPath = PreferenceStore.getPkgConfigPath();
-+ StringBuffer pkgConfigCmd = new StringBuffer();
-+
-+ if (pkgConfigPath != null && !pkgConfigPath.isEmpty()) {
-+ pkgConfigPath = pkgConfigPath.replace(" ", "\\ "); //$NON-NLS-1$ //$NON-NLS-2$
-+ if (OSDetector.isWindows()) {
-+ pkgConfigCmd
-+ .append(" set PKG_CONFIG_PATH=" + pkgConfigPath + " ");//$NON-NLS-1$ //$NON-NLS-2$
-+ } else {
-+ pkgConfigCmd.append(" PKG_CONFIG_PATH=" + pkgConfigPath + " ");//$NON-NLS-1$ //$NON-NLS-2$
-+ }
- }
-
-- Process p = null;
-- try {
-- if (pb != null) {
-- p = pb.start();
-+ String pkgConfigLibDirPath = PreferenceStore.getPkgConfigLibDir();
-+ if (pkgConfigLibDirPath != null && !pkgConfigLibDirPath.isEmpty()) {
-+ pkgConfigLibDirPath = pkgConfigLibDirPath.replace(" ", "\\ "); //$NON-NLS-1$ //$NON-NLS-2$
-+ if (OSDetector.isWindows()) {
-+ if (pkgConfigPath != null && !pkgConfigPath.isEmpty())
-+ pkgConfigCmd.append("&&"); //$NON-NLS-1$
-+ pkgConfigCmd
-+ .append(" set PKG_CONFIG_LIBDIR=" + pkgConfigLibDirPath + " ");//$NON-NLS-1$ //$NON-NLS-2$
-+ } else {
-+ pkgConfigCmd
-+ .append(" PKG_CONFIG_LIBDIR=" + pkgConfigLibDirPath + " ");//$NON-NLS-1$ //$NON-NLS-2$
- }
-- } catch (IOException e) {
-- Activator.getDefault().log(e, "Starting a process (executing a command line script) failed."); //$NON-NLS-1$
- }
-- if (p != null) {
-+ pkgConfigCmd.append(pkgConfigBinPath);
-+ if (pkgconfigOptions != null && !pkgconfigOptions.isEmpty())
-+ pkgConfigCmd.append(" " + pkgconfigOptions);//$NON-NLS-1$
-+
-+ if (OSDetector.isWindows()) {
-+ // For Windows the command should look like :
-+ // cmd /c 'PKG_CONFIG_PATH=/path/to/something pkg-config
-+ // --list-all'
-+ pb = new ProcessBuilder("cmd", "/c", pkgConfigCmd.toString()); //$NON-NLS-1$ //$NON-NLS-2$
-+ } else {
-+ // For Unix/Mac the command should look like :
-+ // bash -c 'PKG_CONFIG_PATH=/path/to/something pkg-config
-+ // --list-all'
-+ pb = new ProcessBuilder("bash", "-c", pkgConfigCmd.toString()); //$NON-NLS-1$ //$NON-NLS-2$
-+ }
-+
-+ return runCommand(pb);
-+ }
-+
-+ /**
-+ * Run the process and get the results as string array.
-+ *
-+ * @param pb
-+ * Process builder
-+ * @return Array of process results
-+ */
-+ private static List<String> runCommand(ProcessBuilder pb) {
-+ List<String> results = new ArrayList<String>();
-+
-+ try {
-+ Process p = pb.start();
- String line;
-- BufferedReader input = new BufferedReader
-- (new InputStreamReader(p.getInputStream()));
-- try {
-+ BufferedReader input = new BufferedReader(new InputStreamReader(
-+ p.getInputStream()));
-+ do {
- line = input.readLine();
- if (line != null) {
-- return line;
-+ results.add(line);
- }
-- input.close();
-- } catch (IOException e) {
-- Activator.getDefault().log(e, "Reading a line from the input failed."); //$NON-NLS-1$
-- }
-+ } while (line != null);
-+ input.close();
-+ } catch (IOException e) {
-+ Activator
-+ .getDefault()
-+ .log(e,
-+ "Starting a process (executing a command line script) failed."); //$NON-NLS-1$
- }
-- return null;
-+ return results;
- }
-
- /**
-@@ -92,7 +156,7 @@ public class PkgConfigUtil {
- * @return
- */
- public static String getAll(String pkg) {
-- return getPkgOutput(OUTPUT_ALL, pkg);
-+ return getPkgOutput(OUTPUT_ALL + " " + pkg); //$NON-NLS-1$
- }
-
- /**
-@@ -102,7 +166,7 @@ public class PkgConfigUtil {
- * @return
- */
- public static String getLibs(String pkg) {
-- return getPkgOutput(OUTPUT_LIBS, pkg);
-+ return getPkgOutput(OUTPUT_LIBS + " " + pkg); //$NON-NLS-1$
- }
-
- /**
-@@ -112,7 +176,7 @@ public class PkgConfigUtil {
- * @return
- */
- public static String getLibPathsOnly(String pkg) {
-- return getPkgOutput(OUTPUT_ONLY_LIB_PATHS, pkg);
-+ return getPkgOutput(OUTPUT_ONLY_LIB_PATHS + " " + pkg); //$NON-NLS-1$
- }
-
- /**
-@@ -122,7 +186,7 @@ public class PkgConfigUtil {
- * @return
- */
- public static String getLibFilesOnly(String pkg) {
-- return getPkgOutput(OUTPUT_ONLY_LIB_FILES, pkg);
-+ return getPkgOutput(OUTPUT_ONLY_LIB_FILES + " " + pkg); //$NON-NLS-1$
- }
-
- /**
-@@ -132,50 +196,17 @@ public class PkgConfigUtil {
- * @return
- */
- public static String getCflags(String pkg) {
-- return getPkgOutput(OUTPUT_CFLAGS, pkg);
-+ return getPkgOutput(OUTPUT_CFLAGS + " " + pkg); //$NON-NLS-1$
- }
-
- /**
-- * Get all packages that pkg-config utility finds (package name with description).
-+ * Get all packages that pkg-config utility finds (package name with
-+ * description).
- *
- * @return
- */
- public static List<String> getAllPackages() {
-- ProcessBuilder pb = null;
-- String pkgConfigBinPath = PreferenceStore.getPkgConfigBinPath();
-- if (pkgConfigBinPath.isEmpty()) {
-- if (OSDetector.isWindows())
-- pkgConfigBinPath = PKG_CONFIG + ".exe"; //$NON-NLS-1$
-- else
-- pkgConfigBinPath = PKG_CONFIG;
-- }
-- if (OSDetector.isUnix() || OSDetector.isMac()) {
-- pkgConfigBinPath = pkgConfigBinPath.replace(" ", "\\ "); //$NON-NLS-1$ //$NON-NLS-2$
-- pb = new ProcessBuilder("bash", "-c", pkgConfigBinPath + " " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-- + LIST_PACKAGES);
-- } else if (OSDetector.isWindows()) {
-- pb = new ProcessBuilder("cmd", "/c", pkgConfigBinPath, LIST_PACKAGES); //$NON-NLS-1$ //$NON-NLS-2$
-- }
-- try {
-- if (pb !=null) {
-- Process p = pb.start();
-- String line;
-- BufferedReader input = new BufferedReader
-- (new InputStreamReader(p.getInputStream()));
-- List<String> packageList = new ArrayList<String>();
-- do {
-- line = input.readLine();
-- if (line != null) {
-- packageList.add(line);
-- }
-- } while(line != null);
-- input.close();
-- return packageList;
-- }
-- } catch (IOException e) {
-- e.printStackTrace();
-- }
-- return null;
-+ return getPkgOutputs(LIST_PACKAGES);
- }
-
- }
---
-1.7.9.5
-
diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/patches/0004-Move-pkg-config-configuration-to-project-level.patch b/org.eclipse.cdt.managedbuilder.pkgconfig/patches/0004-Move-pkg-config-configuration-to-project-level.patch
deleted file mode 100644
index 94c7164..0000000
--- a/org.eclipse.cdt.managedbuilder.pkgconfig/patches/0004-Move-pkg-config-configuration-to-project-level.patch
+++ /dev/null
@@ -1,1867 +0,0 @@
-From 5695b27972c7c744bd4c3d65a1518ad5a0fc573b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?M=C3=A9lanie=20Bats?= <melani...@obeo.fr>
-Date: Wed, 5 Dec 2012 18:37:25 +0100
-Subject: [PATCH 4/4] Move pkg-config configuration to project-level
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Until now, the pkg-configuration (path to pkg-config binary, values of
-PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR) were set through global preferences.
-This is unfortunately too limited for people doing cross-compilation, as they
-may have different cross-compilation environments (for different platforms,
-different projects), each having its own set of libraries, and its own
-pkg-config binary and PKG_CONFIG_PATH/PKG_CONFIG_LIBDIR values.
-
-Therefore, this patch moves the configuration of all pkg-config settings to
-per-project preferences. The global pkg-config configuration UI is removed,
-and a per-project pkg-config UI is added. This per-project UI is also slightly
-improved compared to the original global UI:
-
- * Only the library list is visible by default, all other options are hidden
- behind an "Advanced" button
-
- * The dialog box that opens when the "Advanced" button is clicked allows to
- configure the path to the pkg-config binary, to enter a list of paths
- containing .pc files, and to select whether those paths are to be added to
- the default pkg-config search path (PKG_CONFIG_PATH) or replace the default
- pkg-config search path (PKG_CONFIG_LIBDIR)
-
-Signed-off-by: Mélanie Bats <melani...@obeo.fr>
----
- .../plugin.xml | 8 -
- .../pkgconfig/preferences/Messages.java | 4 +
- .../preferences/PkgConfigPathListEditor.java | 22 +-
- .../preferences/PkgConfigSettingsDialog.java | 173 +++++++++++++++
- .../pkgconfig/preferences/PreferencePage.java | 104 ---------
- .../pkgconfig/preferences/PreferenceStore.java | 227 ++++++++------------
- .../pkgconfig/preferences/messages.properties | 6 +-
- .../pkgconfig/properties/DataModelProvider.java | 10 +-
- .../pkgconfig/properties/PkgConfigPropertyTab.java | 214 +++++++++++-------
- .../settings/PkgConfigExternalSettingProvider.java | 173 +++++++++------
- .../pkgconfig/util/PkgConfigUtil.java | 149 ++++++++-----
- 11 files changed, 625 insertions(+), 465 deletions(-)
- create mode 100644 org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PkgConfigSettingsDialog.java
- delete mode 100644 org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferencePage.java
-
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/plugin.xml b/org.eclipse.cdt.managedbuilder.pkgconfig/plugin.xml
-index b1b58ef..85e1c23 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/plugin.xml
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/plugin.xml
-@@ -8,14 +8,6 @@
- </initializer>
- </extension>
- <extension
-- point="org.eclipse.ui.preferencePages">
-- <page
-- class="org.eclipse.cdt.managedbuilder.pkgconfig.preferences.PreferencePage"
-- id="org.eclipse.cdt.managedbuilder.pkgconfig.preferences.PreferencePage"
-- name="%page.name">
-- </page>
-- </extension>
-- <extension
- point="org.eclipse.cdt.ui.cPropertyTab">
- <tab
- class="org.eclipse.cdt.managedbuilder.pkgconfig.properties.PkgConfigPropertyTab"
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/Messages.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/Messages.java
-index 31986b9..91dc9f1 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/Messages.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/Messages.java
-@@ -15,6 +15,10 @@ import org.eclipse.osgi.util.NLS;
- public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.cdt.managedbuilder.pkgconfig.preferences.messages"; //$NON-NLS-1$
-+ public static String PkgConfigSettingsDialog_0;
-+ public static String PkgConfigSettingsDialog_1;
-+ public static String PkgConfigSettingsDialog_2;
-+ public static String PkgConfigPropertyTab_0;
- public static String PkgConfigPathListEditor_0;
- public static String PkgConfigPathListEditor_1;
- public static String PreferencePage_0;
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PkgConfigPathListEditor.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PkgConfigPathListEditor.java
-index 5f31e37..f52fc1c 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PkgConfigPathListEditor.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PkgConfigPathListEditor.java
-@@ -7,6 +7,7 @@
- *
- * Contributors:
- * Petri Tuononen - Initial implementation
-+ * Melanie Bats - Pkg-config variables can be set by project
- *******************************************************************************/
- package org.eclipse.cdt.managedbuilder.pkgconfig.preferences;
-
-@@ -19,7 +20,6 @@ import org.eclipse.swt.widgets.Text;
- /**
- * New implementation of PkgConfigListEditor.
- * Used to select PKG_CONFIG_PATH values from the dialog.
-- *
- */
- public class PkgConfigPathListEditor extends PkgConfigListEditor {
-
-@@ -30,7 +30,7 @@ public class PkgConfigPathListEditor extends PkgConfigListEditor {
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
-- PkgConfigPathListEditor(String name, String labelText, Composite parent) {
-+ public PkgConfigPathListEditor(String name, String labelText, Composite parent) {
- super(name, labelText, parent);
- }
-
-@@ -63,8 +63,6 @@ public class PkgConfigPathListEditor extends PkgConfigListEditor {
- }
- }
- }
-- //add a new PKG_CONFIG_PATH to the preference store
-- PreferenceStore.appendPkgConfigPath(dir);
- return dir;
- }
- return null;
-@@ -79,11 +77,21 @@ public class PkgConfigPathListEditor extends PkgConfigListEditor {
- setPresentsDefaultValue(false);
- String[] selected = incList.getSelection();
- for (String s : selected) {
-- //remove PKG_CONFIG_PATH from the preference store
-- PreferenceStore.removePkgConfigPath(s);
- incList.remove(s);
- selectionChanged();
- }
- }
--
-+
-+ /**
-+ * Get the pkg config paths.
-+ *
-+ * @return Array of pkg-config paths
-+ */
-+ public String[] getPkgConfigPaths() {
-+ return getList().getItems();
-+ }
-+
-+ public void setData(String[] pkgConfigs) {
-+ getList().setItems(pkgConfigs);
-+ }
- }
-\ No newline at end of file
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PkgConfigSettingsDialog.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PkgConfigSettingsDialog.java
-new file mode 100644
-index 0000000..cb1634f
---- /dev/null
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PkgConfigSettingsDialog.java
-@@ -0,0 +1,173 @@
-+/*******************************************************************************
-+ * Copyright (c) 2012 Melanie Bats and others.
-+ * All rights reserved. This program and the accompanying materials
-+ * are made available under the terms of the Eclipse Public License v1.0
-+ * which accompanies this distribution, and is available at
-+ * http://www.eclipse.org/legal/epl-v10.html
-+ *
-+ * Contributors:
-+ * Melanie Bats - Initial implementation
-+ *******************************************************************************/
-+
-+package org.eclipse.cdt.managedbuilder.pkgconfig.preferences;
-+
-+import org.eclipse.cdt.ui.newui.AbstractPropertyDialog;
-+import org.eclipse.jface.dialogs.IDialogConstants;
-+import org.eclipse.swt.SWT;
-+import org.eclipse.swt.events.SelectionAdapter;
-+import org.eclipse.swt.events.SelectionEvent;
-+import org.eclipse.swt.layout.GridData;
-+import org.eclipse.swt.layout.GridLayout;
-+import org.eclipse.swt.widgets.Button;
-+import org.eclipse.swt.widgets.Combo;
-+import org.eclipse.swt.widgets.Composite;
-+import org.eclipse.swt.widgets.Control;
-+import org.eclipse.swt.widgets.Label;
-+import org.eclipse.swt.widgets.Shell;
-+
-+public class PkgConfigSettingsDialog extends AbstractPropertyDialog {
-+ private static final String UNSET_PKG_CONFIG = ""; //$NON-NLS-1$
-+ private static final String PKG_CONFIG_PATH = Messages.PkgConfigSettingsDialog_0;
-+ private static final String PKG_CONFIG_LIBDIR = Messages.PkgConfigSettingsDialog_1;
-+
-+ private Combo pkgConfigPathKindCombo;
-+ private PkgConfigBinPathFieldEditor pkgconfigBinPathEditor;
-+ private PkgConfigPathListEditor configPathListEditor;
-+
-+ private Button buttonOk;
-+ private Button buttonCancel;
-+
-+ private String projectName;
-+
-+ public PkgConfigSettingsDialog(Shell _parent, String title,
-+ String projectName) {
-+ super(_parent, title);
-+ this.projectName = projectName;
-+ }
-+
-+ @Override
-+ public void buttonPressed(SelectionEvent e) {
-+ if (e.widget.equals(this.buttonOk)) {
-+ String pkgConfigBinEditorValue = this.pkgconfigBinPathEditor
-+ .getStringValue();
-+ PreferenceStore.setPkgConfigBinPath(pkgConfigBinEditorValue,
-+ this.projectName);
-+
-+ String pkgConfigPathKind = this.pkgConfigPathKindCombo.getText();
-+
-+ PreferenceStore.clearPkgConfigLibDir(this.projectName);
-+ PreferenceStore.clearPkgConfigPath(this.projectName);
-+ if (pkgConfigPathKind.length() != 0) {
-+ for (String pkgConfigPath : this.configPathListEditor
-+ .getPkgConfigPaths()) {
-+ if (PKG_CONFIG_PATH.equals(pkgConfigPathKind)) {
-+ PreferenceStore.setPkgConfigPath(pkgConfigPath,
-+ this.projectName);
-+ } else if (PKG_CONFIG_LIBDIR.equals(pkgConfigPathKind)) {
-+ PreferenceStore.setPkgConfigLibDir(pkgConfigPath,
-+ this.projectName);
-+ }
-+ }
-+ }
-+ }
-+
-+ this.shell.dispose();
-+ }
-+
-+ @Override
-+ protected Control createDialogArea(Composite parent) {
-+ this.shell.setSize(700, 250);
-+ GridLayout gridLayout = new GridLayout();
-+ parent.setLayout(gridLayout);
-+ Composite composite = new Composite(parent, SWT.None);
-+ GridData layoutData = new GridData(GridData.FILL_BOTH);
-+ composite.setLayoutData(layoutData);
-+ composite.setLayout(new GridLayout(3, false));
-+
-+ this.pkgconfigBinPathEditor = new PkgConfigBinPathFieldEditor(
-+ PreferenceConstants.PKG_CONFIG_BIN, Messages.PreferencePage_3,
-+ composite);
-+
-+ this.pkgconfigBinPathEditor.setStringValue(PreferenceStore
-+ .getPkgConfigBinPath(this.projectName));
-+
-+ Label comboLabel = new Label(composite, SWT.WRAP);
-+ GridData comboLabelLayout = new GridData();
-+ comboLabel.setLayoutData(comboLabelLayout);
-+ comboLabel.setText(Messages.PkgConfigSettingsDialog_2);
-+
-+ this.pkgConfigPathKindCombo = new Combo(composite, SWT.BORDER
-+ | SWT.READ_ONLY);
-+ GridData comboLayout = new GridData();
-+
-+ this.pkgConfigPathKindCombo.setItems(new String[] { UNSET_PKG_CONFIG,
-+ PKG_CONFIG_PATH, PKG_CONFIG_LIBDIR });
-+ this.pkgConfigPathKindCombo.setLayoutData(comboLayout);
-+
-+ // Get pkg-config path and pkg-config libdir for the current project
-+ String[] pkgConfigPath = PreferenceStore
-+ .getPkgConfigPath(this.projectName);
-+ String[] pkgConfigLibDir = PreferenceStore
-+ .getPkgConfigLibDir(this.projectName);
-+
-+ Composite composite2 = new Composite(composite, SWT.None);
-+ GridData layoutData2 = new GridData(GridData.FILL_BOTH);
-+ layoutData2.horizontalAlignment = SWT.FILL;
-+ layoutData2.horizontalSpan = 3;
-+
-+ composite2.setLayoutData(layoutData2);
-+ composite2.setLayout(new GridLayout(2, false));
-+ this.configPathListEditor = new PkgConfigPathListEditor(
-+ PreferenceConstants.PKG_CONFIG_PATH, "", composite2); //$NON-NLS-1$
-+
-+ // Initialize combo to current value
-+ if (pkgConfigLibDir != null) {
-+ // Select lib dir
-+ this.pkgConfigPathKindCombo.select(2);
-+ this.configPathListEditor.setData(pkgConfigLibDir);
-+ } else if (pkgConfigPath != null) {
-+ // Select config path
-+ this.pkgConfigPathKindCombo.select(1);
-+ this.configPathListEditor.setData(pkgConfigPath);
-+ } else {
-+ // None
-+ this.pkgConfigPathKindCombo.select(0);
-+ this.pkgConfigPathKindCombo.setData(UNSET_PKG_CONFIG);
-+ }
-+
-+ // Buttons
-+ Composite compButtons = new Composite(composite, SWT.FILL);
-+ GridData gd = new GridData(SWT.RIGHT, SWT.BOTTOM, true, false);
-+ gd.horizontalSpan = 4;
-+ // gd.grabExcessVerticalSpace = true;
-+ compButtons.setLayoutData(gd);
-+ compButtons.setLayout(new GridLayout(2, true));
-+
-+ // Button Cancel
-+ this.buttonCancel = new Button(compButtons, SWT.PUSH);
-+ this.buttonCancel.setText(IDialogConstants.CANCEL_LABEL);
-+ gd = new GridData(GridData.FILL_HORIZONTAL);
-+ this.buttonCancel.setLayoutData(gd);
-+ this.buttonCancel.addSelectionListener(new SelectionAdapter() {
-+ @Override
-+ public void widgetSelected(SelectionEvent event) {
-+ buttonPressed(event);
-+ }
-+ });
-+
-+ // Button OK
-+ this.buttonOk = new Button(compButtons, SWT.PUSH);
-+ this.buttonOk.setText(IDialogConstants.OK_LABEL);
-+ gd = new GridData(GridData.FILL_HORIZONTAL);
-+ this.buttonOk.setLayoutData(gd);
-+ this.buttonOk.addSelectionListener(new SelectionAdapter() {
-+ @Override
-+ public void widgetSelected(SelectionEvent event) {
-+ buttonPressed(event);
-+ }
-+ });
-+
-+ parent.getShell().setDefaultButton(this.buttonOk);
-+ return parent;
-+ }
-+}
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferencePage.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferencePage.java
-deleted file mode 100644
-index 7a2bb4e..0000000
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferencePage.java
-+++ /dev/null
-@@ -1,104 +0,0 @@
--/*******************************************************************************
-- * Copyright (c) 2011 Petri Tuononen and others.
-- * All rights reserved. This program and the accompanying materials
-- * are made available under the terms of the Eclipse Public License v1.0
-- * which accompanies this distribution, and is available at
-- * http://www.eclipse.org/legal/epl-v10.html
-- *
-- * Contributors:
-- * Petri Tuononen - Initial implementation
-- *******************************************************************************/
--package org.eclipse.cdt.managedbuilder.pkgconfig.preferences;
--
--import org.eclipse.cdt.managedbuilder.pkgconfig.Activator;
--import org.eclipse.jface.preference.FieldEditorPreferencePage;
--import org.eclipse.ui.IWorkbench;
--import org.eclipse.ui.IWorkbenchPreferencePage;
--
--/**
-- * This class represents a preference page that
-- * is contributed to the Preferences dialog.
-- *
-- * This page is used to modify preferences only. They
-- * are stored in the preference store that belongs to
-- * the main plug-in class.
-- *
-- */
--public class PreferencePage extends FieldEditorPreferencePage
--implements IWorkbenchPreferencePage {
--
-- private PkgConfigBinPathFieldEditor pkgConfigBinEditor;
-- private PkgConfigPathListEditor configPathListEditor;
-- private LibDirFieldEditor libDirEditor;
--
-- /**
-- * Constructor.
-- * Set preference page to use the pkg-config preference store.
-- */
-- public PreferencePage() {
-- setPreferenceStore(Activator.getDefault().getPreferenceStore());
-- setDescription(Messages.PreferencePage_0);
-- }
--
-- /* (non-Javadoc)
-- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
-- */
-- @Override
-- public void init(IWorkbench workbench) {
-- //nothing here
-- }
--
-- @Override
-- /**
-- * Get Description name.
-- *
-- * @param String Description
-- */
-- public String getDescription() {
-- return null;
-- }
--
-- /* (non-Javadoc)
-- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
-- */
-- @Override
-- public boolean performOk() {
-- //create PKG_CONFIG_LIBDIR environment variable
-- String libEditorValue = this.libDirEditor.getStringValue();
-- PreferenceStore.setPkgConfigLibDir(libEditorValue);
--
-- // create PKG_CONFIG_BIN environment variable
-- String pkgConfigBinEditorValue = this.pkgConfigBinEditor
-- .getStringValue();
-- PreferenceStore.setPkgConfigBin(pkgConfigBinEditorValue);
--
-- return true;
-- }
--
-- @Override
-- protected void performApply() {
-- performOk();
-- }
--
-- @Override
-- /**
-- * Creates field editors for the preference page.
-- */
-- protected void createFieldEditors() {
-- // field PKG_CONFIG_BIN
-- this.pkgConfigBinEditor = new PkgConfigBinPathFieldEditor(
-- PreferenceConstants.PKG_CONFIG_BIN, Messages.PreferencePage_3,
-- getFieldEditorParent());
-- addField(this.pkgConfigBinEditor);
-- //list editor for PKG_CONFIG_PATH values
-- this.configPathListEditor = new PkgConfigPathListEditor(
-- PreferenceConstants.PKG_CONFIG_PATH, Messages.PreferencePage_1,
-- getFieldEditorParent());
-- addField(this.configPathListEditor);
-- //field PKG_CONFIG_LIBDIR
-- this.libDirEditor = new LibDirFieldEditor(PreferenceConstants.PKG_CONFIG_LIBDIR,
-- Messages.PreferencePage_2, getFieldEditorParent());
-- addField(this.libDirEditor);
-- }
--
--}
-\ No newline at end of file
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferenceStore.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferenceStore.java
-index 3829e8b..542e735 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferenceStore.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/PreferenceStore.java
-@@ -12,7 +12,6 @@ package org.eclipse.cdt.managedbuilder.pkgconfig.preferences;
-
- import org.eclipse.cdt.managedbuilder.pkgconfig.Activator;
- import org.eclipse.cdt.managedbuilder.pkgconfig.util.ArrayUtil;
--import org.eclipse.cdt.managedbuilder.pkgconfig.util.Separators;
- import org.eclipse.core.runtime.preferences.IEclipsePreferences;
- import org.eclipse.core.runtime.preferences.InstanceScope;
-
-@@ -23,6 +22,11 @@ import org.eclipse.core.runtime.preferences.InstanceScope;
- */
- public class PreferenceStore {
-
-+ private static final String PATH_SEPARATOR = ";"; //$NON-NLS-1$
-+ private static final String PKG_CONFIG_BIN = "PKG_CONFIG_BIN"; //$NON-NLS-1$
-+ private static final String PKG_CONFIG_LIBDIR = "PKG_CONFIG_LIBDIR"; //$NON-NLS-1$
-+ private static final String PKG_CONFIG_PATH = "PKG_CONFIG_PATH"; //$NON-NLS-1$
-+
- /**
- * Get the Pkg-config preference store.
- *
-@@ -52,15 +56,26 @@ public class PreferenceStore {
- public static void setPreferenceStoreValue(String name, String value) {
- getPreferenceStore().put(name, value);
- }
--
-+
-+ /**
-+ * Clear preference store value.
-+ *
-+ * @param name
-+ * the name of the preference
-+ */
-+ public static void clearPreferenceStoreValue(String name) {
-+ getPreferenceStore().put(name, ""); //$NON-NLS-1$
-+ }
-+
- /**
- * Set pkg-config bin to the preference store.
- *
- * @param path
- * The pkg-config bin.
-+ * @param project
- */
-- public static void setPkgConfigBin(String path) {
-- setPreferenceStoreValue(PreferenceConstants.PKG_CONFIG_BIN, path);
-+ public static void setPkgConfigBinPath(String path, String project) {
-+ setPreferenceStoreValue(getPkgConfigBinKey(project), path);
- }
-
- /**
-@@ -68,8 +83,8 @@ public class PreferenceStore {
- *
- * @return pkg-config bin path.
- */
-- public static String getPkgConfigBinPath() {
-- return getPreferenceStoreValue(PreferenceConstants.PKG_CONFIG_BIN);
-+ public static String getPkgConfigBinPath(String project) {
-+ return getPreferenceStoreValue(getPkgConfigBinKey(project));
- }
-
- /**
-@@ -77,177 +92,121 @@ public class PreferenceStore {
- *
- * @return pkg-config path.
- */
-- public static String getPkgConfigPath() {
-- return getPreferenceStoreValue(PreferenceConstants.PKG_CONFIG_PATH);
-+ public static String[] getPkgConfigPath(String project) {
-+ String pkgConfigPathStringValue = getPreferenceStoreValue(getPkgConfigPathKey(project));
-+ if (pkgConfigPathStringValue.length() == 0)
-+ return null;
-+ return pkgConfigPathStringValue.split(PATH_SEPARATOR);
- }
-
- /**
- * Set pkg-config path to the preference store.
- *
-- * @param path The pkg-config path.
-+ * @param path The pkg-config path
-+ * @param project The project name
- */
-- public static void setPkgConfigPath(String path) {
-- setPreferenceStoreValue(PreferenceConstants.PKG_CONFIG_PATH, path);
-+ public static void setPkgConfigPath(String path, String project) {
-+ String pkgConfigPath = getPreferenceStoreValue(getPkgConfigPathKey(project));
-+ if (pkgConfigPath.length() != 0) {
-+ pkgConfigPath += PATH_SEPARATOR;
-+ }
-+ setPreferenceStoreValue(getPkgConfigPathKey(project), pkgConfigPath
-+ + path);
- }
--
-+
- /**
- * Get pkg-config libdir from the preference store.
- *
- * @return pkg-config libdir.
- */
-- public static String getPkgConfigLibDir() {
-- return getPreferenceStoreValue(PreferenceConstants.PKG_CONFIG_LIBDIR);
-+ public static String[] getPkgConfigLibDir(String project) {
-+ String pkgConfigLibDirStringValue = getPreferenceStoreValue(getPkgConfigLibDirKey(project));
-+ if (pkgConfigLibDirStringValue.length() == 0)
-+ return null;
-+ return pkgConfigLibDirStringValue.split(PATH_SEPARATOR);
- }
-
- /**
- * Set pkg-config libdir to the preference store.
- *
-- * @param path The pkg-config libdir.
-+ * @param path The pkg-config libdir
-+ * @param project The project name
- */
-- public static void setPkgConfigLibDir(String path) {
-- setPreferenceStoreValue(PreferenceConstants.PKG_CONFIG_LIBDIR, path);
-+ public static void setPkgConfigLibDir(String path, String project) {
-+ String pkgConfigPath = getPreferenceStoreValue(getPkgConfigLibDirKey(project));
-+ if (pkgConfigPath.length() != 0) {
-+ pkgConfigPath += PATH_SEPARATOR;
-+ }
-+ setPreferenceStoreValue(getPkgConfigLibDirKey(project), pkgConfigPath
-+ + path);
- }
--
-+
- /**
-- * Get values from the preference store as a String array.
-- * Used to get preference store values which consist of multiple paths
-- * separated by a path separator.
-+ * Clear pkg-config path to the preference store.
- *
-- * @param name the name of the preference
-- * @return A String array containing all preference store values
-+ * @param project
-+ * The project name
- */
-- public static String[] getPreferenceStoreValueAsArray(String name) {
-- return ArrayUtil.stringToArray(name);
-+ public static void clearPkgConfigPath(String project) {
-+ clearPreferenceStoreValue(getPkgConfigPathKey(project));
- }
-
- /**
-- * Get existing paths from the Preference store.
-+ * Clear pkg-config libdir path to the preference store.
- *
-- * @param name the name of the preference
-- * @return paths
-+ * @param project
-+ * The project name
- */
-- private static String getExistingValues(String name) {
-- String paths = ""; //$NON-NLS-1$
-- if (name.equals(PreferenceConstants.PKG_CONFIG_PATH)) {
-- paths = getPkgConfigPath();
-- } else if (name.equals(PreferenceConstants.PKG_CONFIG_LIBDIR)) {
-- paths = getPkgConfigLibDir();
-- }
-- return paths;
-+ public static void clearPkgConfigLibDir(String project) {
-+ clearPreferenceStoreValue(getPkgConfigLibDirKey(project));
- }
-
- /**
-- * Append a new value to the Preference store if it doesn't already exists.
-+ * Get values from the preference store as a String array. Used to get
-+ * preference store values which consist of multiple paths separated by a
-+ * path separator.
- *
-- * @param name the name of the preference
-- * @param value the string-valued preference
-+ * @param name
-+ * the name of the preference
-+ * @return A String array containing all preference store values
- */
-- public static void appendValue(String name, String value) {
-- StringBuffer sB = new StringBuffer();
-- String paths = null;
-- //get existing paths
-- paths = getExistingValues(name);
-- //if values exist
-- if (paths.length()!=0) {
-- //if the value is reasonable
-- if (!value.equalsIgnoreCase("") && value.length()!=0) { //$NON-NLS-1$
-- //if the paths doesn't contain the new value
-- if (!paths.contains(value)) {
-- //append existing paths to the string buffer
-- sB.append(paths);
-- //add a path separator in the end if it doesn't exists
-- if (paths.charAt(paths.length()-1) != Separators.getPathSeparator().charAt(0)) {
-- sB.append(Separators.getPathSeparator());
-- }
-- //append the new value to end of the list
-- sB.append(value);
-- }
-- }
-- } else { //no existing values
-- //if the value is reasonable
-- if (!value.equalsIgnoreCase("") && value.length()!=0) { //$NON-NLS-1$
-- //append a new path to the string buffer
-- sB.append(value);
-- }
-- }
-- String newValues = sB.toString();
-- if (newValues.length()!=0) {
-- //set the new preference store value
-- setPreferenceStoreValue(name, newValues);
-- }
-+ public static String[] getPreferenceStoreValueAsArray(String name) {
-+ return ArrayUtil.stringToArray(name);
- }
-
- /**
-- * Append pkg-config path to the preference store.
-- *
-- * @param path The pkg-config path.
-- */
-- public static void appendPkgConfigPath(String path) {
-- appendValue(PreferenceConstants.PKG_CONFIG_PATH, path);
-- }
--
-- /**
-- * Remove a value from the preference store.
-- *
-- * @param name Name of the preference
-- * @param value Value to be removed from the preference store
-- */
-- public static void removeValue(String name, String value) {
-- StringBuffer sB = new StringBuffer();
-- String existingValues = null;
-- String newValue = null;
-- //get existing values
-- existingValues = getExistingValues(name);
-- //if the String contains the value
-- if (existingValues.contains(value)) {
-- //if many values i.e. contains path separator
-- if (existingValues.contains(Separators.getPathSeparator())) {
-- //separate String of values to an array
-- String[] exValArray = existingValues.split(Separators.getPathSeparator());
-- //if more than one value
-- if (exValArray.length > 1) {
-- //remove the value from the array
-- exValArray = ArrayUtil.removePathFromExistingPathList(exValArray, value);
-- //if the array isn't empty
-- if (exValArray.length > 0) {
-- //append all values to the StringBuffer excluding the removed one
-- for (String val : exValArray) {
-- //append a value
-- sB.append(val);
-- //append a path separator
-- sB.append(Separators.getPathSeparator());
-- }
-- //form a String
-- newValue = sB.toString();
-- }
-- } else { //only one value with a path separator at the end
-- newValue = ""; //$NON-NLS-1$
-- }
--
-- } else { //only value without a path separator at the end
-- newValue = ""; //$NON-NLS-1$
-- }
-- //set the new preference store value
-- setPreferenceStoreValue(name, newValue);
-- }
-+ * Compute the key for the given pkg-config binary and the given project.
-+ *
-+ * @param project
-+ * Project name
-+ * @return Key
-+ */
-+ private static String getPkgConfigBinKey(String project) {
-+ return PKG_CONFIG_BIN + " - " //$NON-NLS-1$
-+ + project;
- }
-
- /**
-- * Remove pkg-config path from the preference store.
-+ * Compute the key for the given pkg-config lib dir and the given project.
- *
-- * @param path The include path to be removed from the preference store.
-+ * @param project
-+ * Project name
-+ * @return Key
- */
-- public static void removePkgConfigPath(String path) {
-- removeValue(PreferenceConstants.PKG_CONFIG_PATH, path);
-+ private static String getPkgConfigLibDirKey(String project) {
-+ return PKG_CONFIG_LIBDIR + " - " //$NON-NLS-1$
-+ + project;
- }
--
-+
- /**
-- * Remove pkg-config libdir from the preference store.
-+ * Compute the key for the given pkg-config path and the given project.
- *
-- * @param path The pkg-config libdir to be removed from the preference store.
-+ * @param project
-+ * Project name
-+ * @return Key
- */
-- public static void removeLibraryPath(String path) {
-- removeValue(PreferenceConstants.PKG_CONFIG_LIBDIR, path);
-+ private static String getPkgConfigPathKey(String project) {
-+ return PKG_CONFIG_PATH + " - " //$NON-NLS-1$
-+ + project;
- }
--
- }
-\ No newline at end of file
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/messages.properties b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/messages.properties
-index cee06c7..064627e 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/messages.properties
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/preferences/messages.properties
-@@ -3,4 +3,8 @@ PreferencePage_1=PKG_CONFIG_PATH:
- PreferencePage_2=PKG_CONFIG_LIBDIR (replaces default):
- PreferencePage_3=Path to pkg-config executable:
- PkgConfigPathListEditor_0=Browse a directory path
--PkgConfigPathListEditor_1=Select a directory
-\ No newline at end of file
-+PkgConfigPathListEditor_1=Select a directory
-+PkgConfigPropertyTab_0=Pkg-config project settings
-+PkgConfigSettingsDialog_0=Append to (PKG_CONFIG_PATH)
-+PkgConfigSettingsDialog_1=Replace (PKG_CONFIG_LIBDIR)
-+PkgConfigSettingsDialog_2=Adjust the default pkg-config search path :
-\ No newline at end of file
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/properties/DataModelProvider.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/properties/DataModelProvider.java
-index 0ffe7bf..55635f9 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/properties/DataModelProvider.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/properties/DataModelProvider.java
-@@ -19,18 +19,18 @@ import java.util.List;
- import org.eclipse.cdt.managedbuilder.pkgconfig.util.Parser;
- import org.eclipse.cdt.managedbuilder.pkgconfig.util.PkgConfigUtil;
-
--public enum DataModelProvider {
-- INSTANCE;
-+public class DataModelProvider {
-
-- private List<DataModel> dms;
-+ List<DataModel> dms;
-
- /**
- * Initialize.
-+ * @param project Project
- */
-- private DataModelProvider() {
-+ DataModelProvider(String project) {
- this.dms = new ArrayList<DataModel>();
-
-- List<String> packages = PkgConfigUtil.getAllPackages();
-+ List<String> packages = PkgConfigUtil.getAllPackages(project);
- List<String> pkgList = Parser.parsePackageList(packages);
- List<String> nonSortedPkgList = Parser.parsePackageList(packages);
- HashMap<Integer, Integer> origSortedIdx = new HashMap<Integer, Integer>();
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/properties/PkgConfigPropertyTab.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/properties/PkgConfigPropertyTab.java
-index 4c69057..ed91846 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/properties/PkgConfigPropertyTab.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/properties/PkgConfigPropertyTab.java
-@@ -25,6 +25,11 @@ import org.eclipse.cdt.core.settings.model.ICResourceDescription;
- import org.eclipse.cdt.core.settings.model.ICStorageElement;
- import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
- import org.eclipse.cdt.managedbuilder.pkgconfig.Activator;
-+import org.eclipse.cdt.managedbuilder.pkgconfig.preferences.LibDirFieldEditor;
-+import org.eclipse.cdt.managedbuilder.pkgconfig.preferences.Messages;
-+import org.eclipse.cdt.managedbuilder.pkgconfig.preferences.PkgConfigBinPathFieldEditor;
-+import org.eclipse.cdt.managedbuilder.pkgconfig.preferences.PkgConfigPathListEditor;
-+import org.eclipse.cdt.managedbuilder.pkgconfig.preferences.PkgConfigSettingsDialog;
- import org.eclipse.cdt.managedbuilder.pkgconfig.settings.PkgConfigExternalSettingProvider;
- import org.eclipse.cdt.managedbuilder.pkgconfig.util.Parser;
- import org.eclipse.cdt.managedbuilder.pkgconfig.util.PathToToolOption;
-@@ -55,29 +60,37 @@ import org.eclipse.swt.widgets.TableColumn;
- import org.eclipse.swt.widgets.TableItem;
-
- /**
-- * Property tab to select packages and add pkg-config output
-- * of checked packages to compiler and linker (MBS).
-+ * Property tab to select packages and add pkg-config output of checked packages
-+ * to compiler and linker (MBS).
- *
- */
- public class PkgConfigPropertyTab extends AbstractCPropertyTab {
-
-- private CheckboxTableViewer pkgCfgViewer;
-+ PkgConfigBinPathFieldEditor pkgConfigBinPathFieldEditor;
-+ PkgConfigPathListEditor configPathListEditor;
-+ LibDirFieldEditor libDirEditor;
-+ CheckboxTableViewer pkgCfgViewer;
- private Set<Object> previouslyChecked;
- private ArrayList<Object> newItems = new ArrayList<Object>();
- private static final int BUTTON_SELECT = 0;
- private static final int BUTTON_DESELECT = 1;
-+ private static final int BUTTON_ADVANCED = 2;
- private final String PACKAGES = "packages"; //$NON-NLS-1$
- private boolean reindexToggle = false;
-
- private SashForm sashForm;
-
-- private static final String[] BUTTONS = new String[] {
-- "Select", //$NON-NLS-1$
-- "Deselect" //$NON-NLS-1$
-+ private static final String[] BUTTONS = new String[] { "Select", //$NON-NLS-1$
-+ "Deselect", //$NON-NLS-1$
-+ "Advanced..." //$NON-NLS-1$
- };
-
-- /* (non-Javadoc)
-- * @see org.eclipse.cdt.ui.newui.AbstractCPropertyTab#createControls(org.eclipse.swt.widgets.Composite)
-+ /*
-+ * (non-Javadoc)
-+ *
-+ * @see
-+ * org.eclipse.cdt.ui.newui.AbstractCPropertyTab#createControls(org.eclipse
-+ * .swt.widgets.Composite)
- */
- @Override
- public void createControls(Composite parent) {
-@@ -85,19 +98,21 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- this.usercomp.setLayout(new GridLayout(1, false));
-
- this.sashForm = new SashForm(this.usercomp, SWT.NONE);
-- this.sashForm.setBackground(this.sashForm.getDisplay().getSystemColor(SWT.COLOR_GRAY));
-+ this.sashForm.setBackground(this.sashForm.getDisplay().getSystemColor(
-+ SWT.COLOR_GRAY));
- this.sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 5;
- this.sashForm.setLayout(layout);
-
-- Composite c1 = new Composite(this.sashForm, SWT.NONE);
-+ final Composite c1 = new Composite(this.sashForm, SWT.NONE);
- GridLayout layout2 = new GridLayout(3, false);
- c1.setLayout(layout2);
-
-- this.pkgCfgViewer = CheckboxTableViewer.newCheckList(c1, SWT.MULTI | SWT.H_SCROLL
-- | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
-+ this.pkgCfgViewer = CheckboxTableViewer
-+ .newCheckList(c1, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL
-+ | SWT.FULL_SELECTION | SWT.BORDER);
- final Table tbl = this.pkgCfgViewer.getTable();
- tbl.setHeaderVisible(true);
- tbl.setLinesVisible(true);
-@@ -108,7 +123,8 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
-
- createColumns(c1, this.pkgCfgViewer);
- this.pkgCfgViewer.setContentProvider(new ArrayContentProvider());
-- this.pkgCfgViewer.setInput(DataModelProvider.INSTANCE.getEntries());
-+ this.pkgCfgViewer.setInput(new DataModelProvider(this.page.getProject()
-+ .getName()).getEntries());
-
- this.pkgCfgViewer.addCheckStateListener(new PkgListener());
-
-@@ -125,16 +141,18 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- }
- });
-
-- //buttons
-+ // buttons
- Composite compositeButtons = new Composite(c1, SWT.NONE);
- initButtons(compositeButtons, BUTTONS);
-
- initializePackageStates();
-- this.previouslyChecked = new HashSet<Object>(Arrays.asList(getCheckedItems()));
-+ this.previouslyChecked = new HashSet<Object>(
-+ Arrays.asList(getCheckedItems()));
- }
-
- /**
- * Get checked items.
-+ *
- * @return
- */
- private Object[] getCheckedItems() {
-@@ -147,11 +165,11 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- void handleCheckStateChange() {
- Object[] checkedItems = getCheckedItems();
-
-- //check if new items checked
-- if(checkedItems.length > this.previouslyChecked.size()) {
-- //add checked items to an array list
-+ // check if new items checked
-+ if (checkedItems.length > this.previouslyChecked.size()) {
-+ // add checked items to an array list
- for (Object o : checkedItems) {
-- //if new item
-+ // if new item
- if (!this.previouslyChecked.contains(o)) {
- this.newItems.add(o);
- }
-@@ -162,23 +180,27 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
-
- saveChecked();
- updateData(getResDesc());
-- this.previouslyChecked = new HashSet<Object>(Arrays.asList(checkedItems));
-+ this.previouslyChecked = new HashSet<Object>(
-+ Arrays.asList(checkedItems));
- this.newItems.clear();
- }
-
- /**
-- * Add new flags that the packages need to Tools' Options.
-- * Only for other flags.
-+ * Add new flags that the packages need to Tools' Options. Only for other
-+ * flags.
- *
-- * @param addedItems Object[]
-- * @param proj IProject
-+ * @param addedItems
-+ * Object[]
-+ * @param proj
-+ * IProject
- */
- private static void addPackageValues(Object[] addedItems, IProject proj) {
- for (Object item : addedItems) {
-- //handle options
-- String cflags = PkgConfigUtil.getCflags(item.toString());
-+ // handle options
-+ String cflags = PkgConfigUtil.getCflags(
-+ item.toString(), proj.getName());
- String[] optionsArray = Parser.parseCflagOptions(cflags);
-- if (optionsArray!=null) {
-+ if (optionsArray != null) {
- for (String option : optionsArray) {
- PathToToolOption.addOtherFlag(option, proj);
- }
-@@ -197,10 +219,10 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- strgElem = desc.getStorage(this.PACKAGES, true);
- TableItem[] items = this.pkgCfgViewer.getTable().getItems();
- String value = null;
-- for(TableItem item : items) {
-+ for (TableItem item : items) {
- /*
-- * The package names with + symbols were converted so that
-- * + -> plus in order to prevent an error when saving to
-+ * The package names with + symbols were converted so that + ->
-+ * plus in order to prevent an error when saving to
- * ICStorageElement.
- */
- if (item.getText().contains("+")) { //$NON-NLS-1$
-@@ -209,8 +231,8 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- } else {
- value = strgElem.getAttribute(item.getText());
- }
-- if(value!=null) {
-- if(value.equals("true")) { //$NON-NLS-1$
-+ if (value != null) {
-+ if (value.equals("true")) { //$NON-NLS-1$
- item.setChecked(true);
- }
- }
-@@ -223,48 +245,49 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- /**
- * Saves checked state of the packages.
- */
-- private void saveChecked() {
-+ private void saveChecked() {
- ICConfigurationDescription desc = getResDesc().getConfiguration();
- ICStorageElement strgElem = null;
-- //get storage or create one if it doesn't exist
-+ // get storage or create one if it doesn't exist
- try {
- strgElem = desc.getStorage(this.PACKAGES, true);
- } catch (CoreException e) {
-- Activator.getDefault().log(e, "Getting packages from the storage failed."); //$NON-NLS-1$
-+ Activator.getDefault().log(e,
-+ "Getting packages from the storage failed."); //$NON-NLS-1$
- }
- TableItem[] items = this.pkgCfgViewer.getTable().getItems();
-- for(TableItem item : items) {
-- if(item != null) {
-+ for (TableItem item : items) {
-+ if (item != null) {
- String chkd;
-- //form literal form of boolean state
-- if(item.getChecked()) {
-+ // form literal form of boolean state
-+ if (item.getChecked()) {
- chkd = "true"; //$NON-NLS-1$
- } else {
- chkd = "false"; //$NON-NLS-1$
- }
- /*
-- * add package name and the checkbox state
-- * to the storage
-+ * add package name and the checkbox state to the storage
- */
-- try {
-+ try {
- String pkgName = item.getText();
-- //need to convert + symbols to "plus"
-+ // need to convert + symbols to "plus"
- if (pkgName.contains("+")) { //$NON-NLS-1$
- String newPkgName = pkgName.replace("+", "plus"); //$NON-NLS-1$ //$NON-NLS-2$
-- if (strgElem!=null) {
-+ if (strgElem != null) {
- strgElem.setAttribute(newPkgName, chkd);
- }
- } else {
-- if (strgElem!=null) {
-+ if (strgElem != null) {
- strgElem.setAttribute(pkgName, chkd);
- }
- }
- } catch (Exception e) {
-- Activator.getDefault().log(e, "Setting attribute to ICStorageElement failed."); //$NON-NLS-1$
-- //Seems like ICStorageElement cannot store Strings with +
-+ Activator.getDefault().log(e,
-+ "Setting attribute to ICStorageElement failed."); //$NON-NLS-1$
-+ // Seems like ICStorageElement cannot store Strings with +
- /*
-- * INVALID_CHARACTER_ERR: An invalid or
-- * illegal XML character is specified.
-+ * INVALID_CHARACTER_ERR: An invalid or illegal XML
-+ * character is specified.
- */
- }
- }
-@@ -279,16 +302,16 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
-
- @Override
- protected void performDefaults() {
-- //uncheck every checkbox
-+ // uncheck every checkbox
- this.pkgCfgViewer.setCheckedElements(new Object[] {});
-
-- //remove values from Tools Options
-+ // remove values from Tools Options
- handleCheckStateChange();
- }
-
- @Override
- protected void performOK() {
-- //freshen index if new packages have been selected
-+ // freshen index if new packages have been selected
- if (this.reindexToggle) {
- rebuiltIndex();
- }
-@@ -297,7 +320,7 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
-
- @Override
- protected void updateButtons() {
-- //nothing here
-+ // nothing here
- }
-
- @Override
-@@ -308,22 +331,24 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- Job j = new Job("Update Pkg-config exernal settings provider") { //$NON-NLS-1$
- @Override
- protected IStatus run(IProgressMonitor monitor) {
-- //a set holding external setting providers
-- Set<String> externalSettingsProviders = new
-- LinkedHashSet<String>(Arrays.asList(confDesc.getExternalSettingsProviderIds()));
--
-- //remove pkg-config external setting provider
-- externalSettingsProviders.remove(PkgConfigExternalSettingProvider.ID);
-- confDesc.setExternalSettingsProviderIds(externalSettingsProviders.toArray(new
-- String[externalSettingsProviders.size()]));
--
-- //add pkg-config external setting provider
-- externalSettingsProviders.add(PkgConfigExternalSettingProvider.ID);
-- confDesc.setExternalSettingsProviderIds(externalSettingsProviders.toArray(new
-- String[externalSettingsProviders.size()]));
--
-- //update external setting providers
-- confDesc.updateExternalSettingsProviders(new String[] {PkgConfigExternalSettingProvider.ID});
-+ // a set holding external setting providers
-+ Set<String> externalSettingsProviders = new LinkedHashSet<String>(
-+ Arrays.asList(confDesc.getExternalSettingsProviderIds()));
-+
-+ // remove pkg-config external setting provider
-+ externalSettingsProviders
-+ .remove(PkgConfigExternalSettingProvider.ID);
-+ confDesc.setExternalSettingsProviderIds(externalSettingsProviders
-+ .toArray(new String[externalSettingsProviders.size()]));
-+
-+ // add pkg-config external setting provider
-+ externalSettingsProviders
-+ .add(PkgConfigExternalSettingProvider.ID);
-+ confDesc.setExternalSettingsProviderIds(externalSettingsProviders
-+ .toArray(new String[externalSettingsProviders.size()]));
-+
-+ // update external setting providers
-+ confDesc.updateExternalSettingsProviders(new String[] { PkgConfigExternalSettingProvider.ID });
- return Status.OK_STATUS;
- }
- };
-@@ -331,15 +356,17 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- j.schedule();
-
- try {
-- CoreModel.getDefault().setProjectDescription(this.page.getProject(), projDesc);
-+ CoreModel.getDefault().setProjectDescription(
-+ this.page.getProject(), projDesc);
- } catch (CoreException e) {
-- Activator.getDefault().log(e, "Setting/updating the project description failed."); //$NON-NLS-1$
-+ Activator.getDefault().log(e,
-+ "Setting/updating the project description failed."); //$NON-NLS-1$
- }
- }
-
- /**
- * Check state listener for the table viewer.
-- *
-+ *
- */
- public class PkgListener implements ICheckStateListener {
-
-@@ -355,12 +382,13 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- * @param parent
- * @param viewer
- */
-- private void createColumns(@SuppressWarnings("unused") final Composite parent,
-+ private void createColumns(
-+ @SuppressWarnings("unused") final Composite parent,
- @SuppressWarnings("unused") final TableViewer viewer) {
- String[] titles = { "Packages", "Description" }; //$NON-NLS-1$ //$NON-NLS-2$
- int[] bounds = { 200, 450 };
-
-- //first column is for the package
-+ // first column is for the package
- TableViewerColumn col = createTableViewerColumn(titles[0], bounds[0]);
- col.setLabelProvider(new ColumnLabelProvider() {
- @Override
-@@ -370,7 +398,7 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- }
- });
-
-- //second column is for the description
-+ // second column is for the description
- col = createTableViewerColumn(titles[1], bounds[1]);
- col.setLabelProvider(new ColumnLabelProvider() {
- @Override
-@@ -378,7 +406,7 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- DataModel dm = (DataModel) element;
- return dm.getDescription();
- }
-- });
-+ });
- }
-
- /**
-@@ -390,8 +418,8 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- */
- private TableViewerColumn createTableViewerColumn(String title, int bound) {
-
-- final TableViewerColumn viewerColumn = new TableViewerColumn(this.pkgCfgViewer,
-- SWT.NONE);
-+ final TableViewerColumn viewerColumn = new TableViewerColumn(
-+ this.pkgCfgViewer, SWT.NONE);
- final TableColumn column = viewerColumn.getColumn();
-
- column.setText(title);
-@@ -411,11 +439,13 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- return selected;
- }
-
-- /* (non-Javadoc)
-+ /*
-+ * (non-Javadoc)
-+ *
- * @see org.eclipse.cdt.ui.newui.AbstractCPropertyTab#buttonPressed(int)
- */
- @Override
-- public void buttonPressed (int n) {
-+ public void buttonPressed(int n) {
- switch (n) {
- case BUTTON_SELECT:
- selectedButtonPressed();
-@@ -423,6 +453,9 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- case BUTTON_DESELECT:
- deselectedButtonPressed();
- break;
-+ case BUTTON_ADVANCED:
-+ advancedButtonPressed();
-+ break;
- default:
- break;
- }
-@@ -452,10 +485,29 @@ public class PkgConfigPropertyTab extends AbstractCPropertyTab {
- }
-
- /**
-+ * Action for the Select button.
-+ */
-+ private void advancedButtonPressed() {
-+ // Create new dialog
-+ PkgConfigSettingsDialog dialog = new PkgConfigSettingsDialog(
-+ this.usercomp.getShell(), Messages.PkgConfigPropertyTab_0,
-+ this.page.getProject().getName());
-+ dialog.open();
-+ if (PkgConfigPropertyTab.this.pkgCfgViewer != null) {
-+ // Update pkg-config libraries for the project
-+ PkgConfigPropertyTab.this.pkgCfgViewer
-+ .setInput(new DataModelProvider(
-+ PkgConfigPropertyTab.this.page.getProject()
-+ .getName()).getEntries());
-+ }
-+ }
-+
-+ /**
- * Rebuilts the index of the selected project in the workspace.
- */
- private void rebuiltIndex() {
-- ICProject cproject = CoreModel.getDefault().getCModel().getCProject(this.page.getProject().getName());
-+ ICProject cproject = CoreModel.getDefault().getCModel()
-+ .getCProject(this.page.getProject().getName());
- CCorePlugin.getIndexManager().reindex(cproject);
- }
-
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/settings/PkgConfigExternalSettingProvider.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/settings/PkgConfigExternalSettingProvider.java
-index 6f1f5fa..d5782ec 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/settings/PkgConfigExternalSettingProvider.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/settings/PkgConfigExternalSettingProvider.java
-@@ -47,45 +47,53 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
-
- public static final String ID = "org.eclipse.cdt.managedbuilder.pkgconfig.extSettings"; //$NON-NLS-1$
- private final static String PACKAGES = "packages"; //$NON-NLS-1$
--
-+
- @Override
- public CExternalSetting[] getSettings(IProject proj,
- ICConfigurationDescription cfg) {
--
-+
- if (proj != null) {
-- ICSettingEntry[] includes = getEntries(proj, ICSettingEntry.INCLUDE_PATH);
-- ICSettingEntry[] libFiles = getEntries(proj, ICSettingEntry.LIBRARY_FILE);
-- ICSettingEntry[] libPaths = getEntries(proj, ICSettingEntry.LIBRARY_PATH);
--
-- CExternalSetting includeSettings = new CExternalSetting(null, new String[] {
-- "org.eclipse.cdt.core.cSource", "org.eclipse.cdt.core.cxxSource" }, null, includes); //$NON-NLS-1$ //$NON-NLS-2$
--
-- CExternalSetting libraryFileSettings =
-- new CExternalSetting(null, new String[] {
-- "org.eclipse.cdt.managedbuilder.core.compiledObjectFile" }, null, libFiles); //$NON-NLS-1$
--
-- CExternalSetting libraryPathSettings =
-- new CExternalSetting(null, new String[] {
-- "org.eclipse.cdt.managedbuilder.core.compiledObjectFile" }, null, libPaths); //$NON-NLS-1$
--
-+ ICSettingEntry[] includes = getEntries(proj,
-+ ICSettingEntry.INCLUDE_PATH);
-+ ICSettingEntry[] libFiles = getEntries(proj,
-+ ICSettingEntry.LIBRARY_FILE);
-+ ICSettingEntry[] libPaths = getEntries(proj,
-+ ICSettingEntry.LIBRARY_PATH);
-+
-+ CExternalSetting includeSettings = new CExternalSetting(
-+ null,
-+ new String[] {
-+ "org.eclipse.cdt.core.cSource", "org.eclipse.cdt.core.cxxSource" }, null, includes); //$NON-NLS-1$ //$NON-NLS-2$
-+
-+ CExternalSetting libraryFileSettings = new CExternalSetting(
-+ null,
-+ new String[] { "org.eclipse.cdt.managedbuilder.core.compiledObjectFile" }, null, libFiles); //$NON-NLS-1$
-+
-+ CExternalSetting libraryPathSettings = new CExternalSetting(
-+ null,
-+ new String[] { "org.eclipse.cdt.managedbuilder.core.compiledObjectFile" }, null, libPaths); //$NON-NLS-1$
-+
- addOtherFlagsToTools(proj);
--
-- return new CExternalSetting[] { includeSettings, libraryFileSettings, libraryPathSettings };
-+
-+ return new CExternalSetting[] { includeSettings,
-+ libraryFileSettings, libraryPathSettings };
- }
-- return new CExternalSetting[] { };
-+ return new CExternalSetting[] {};
- }
-
- /**
- * Get language setting entries for given ICSettingEntry.
-+ *
- * @param proj
- * @param settingEntry
- * @return
- */
-- private static ICLanguageSettingEntry[] getEntries(IProject proj, int settingEntry) {
-+ private static ICLanguageSettingEntry[] getEntries(IProject proj,
-+ int settingEntry) {
- String[] values = null;
- ICLanguageSettingEntry[] newEntries = null;
- ICLanguageSetting lang = getGCCLanguageSetting(proj);
-- if (lang!=null) {
-+ if (lang != null) {
- switch (settingEntry) {
- case ICSettingEntry.INCLUDE_PATH:
- values = getIncludePathsFromCheckedPackages(proj);
-@@ -108,19 +116,21 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- }
- return newEntries;
- }
--
-+
- /**
- * Get language settings for given project and language id.
-+ *
- * @param proj
- * @param languageId
- * @return
- */
-- private static ICLanguageSetting getLanguageSetting(IProject proj, String languageId) {
-+ private static ICLanguageSetting getLanguageSetting(IProject proj,
-+ String languageId) {
- ICLanguageSetting[] langSettings = getLanguageSettings(proj);
- ICLanguageSetting lang = null;
- for (ICLanguageSetting langSetting : langSettings) {
- String id = langSetting.getLanguageId();
-- if(id != null) {
-+ if (id != null) {
- if (id.equalsIgnoreCase(languageId)) {
- lang = langSetting;
- return lang;
-@@ -129,76 +139,89 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- }
- return null;
- }
--
-+
- /**
- * Get language settings for the given project.
-+ *
- * @param proj
- * @return
- */
- private static ICLanguageSetting[] getLanguageSettings(IProject proj) {
-- ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(proj);
-- ICConfigurationDescription activeConf = projectDescription.getActiveConfiguration();
-- ICFolderDescription folderDesc = activeConf.getRootFolderDescription();
-+ ICProjectDescription projectDescription = CoreModel.getDefault()
-+ .getProjectDescription(proj);
-+ ICConfigurationDescription activeConf = projectDescription
-+ .getActiveConfiguration();
-+ ICFolderDescription folderDesc = activeConf.getRootFolderDescription();
- ICLanguageSetting[] langSettings = folderDesc.getLanguageSettings();
- return langSettings;
- }
--
-+
- /**
- * Get language settings for C projects.
-+ *
- * @param proj
- * @return
- */
- private static ICLanguageSetting getGCCLanguageSetting(IProject proj) {
- return getLanguageSetting(proj, "org.eclipse.cdt.core.gcc"); //$NON-NLS-1$
- }
--
-+
- /**
- * Form ICIncludePathEntry array from include path String array.
-+ *
- * @param includes
- * @return
- */
-- private static ICLanguageSettingEntry[] formIncludePathEntries(String[] includes) {
-+ private static ICLanguageSettingEntry[] formIncludePathEntries(
-+ String[] includes) {
- List<ICLanguageSettingEntry> incPathEntries = new ArrayList<ICLanguageSettingEntry>();
-- for(String inc : includes) {
-- ICIncludePathEntry incPathEntry = new CIncludePathEntry(new Path(inc),
-- ICSettingEntry.INCLUDE_PATH);
-+ for (String inc : includes) {
-+ ICIncludePathEntry incPathEntry = new CIncludePathEntry(new Path(
-+ inc), ICSettingEntry.INCLUDE_PATH);
- incPathEntries.add(incPathEntry);
- }
-- return incPathEntries.toArray(new ICLanguageSettingEntry[incPathEntries.size()]);
-+ return incPathEntries.toArray(new ICLanguageSettingEntry[incPathEntries
-+ .size()]);
- }
--
-+
- /**
- * Form CLibraryFileEntry array from library file String array.
-+ *
- * @param libs
- * @return
- */
- private static ICLanguageSettingEntry[] formLibraryFileEntries(String[] libs) {
- List<ICLanguageSettingEntry> libEntries = new ArrayList<ICLanguageSettingEntry>();
-- for(String lib : libs) {
-+ for (String lib : libs) {
- CLibraryFileEntry libFileEntry = new CLibraryFileEntry(lib,
- ICSettingEntry.LIBRARY_FILE);
- libEntries.add(libFileEntry);
- }
-- return libEntries.toArray(new ICLanguageSettingEntry[libEntries.size()]);
-+ return libEntries
-+ .toArray(new ICLanguageSettingEntry[libEntries.size()]);
- }
--
-+
- /**
- * Form CLibraryPathEntry array from library path String array.
-+ *
- * @param libPaths
- * @return
- */
-- private static ICLanguageSettingEntry[] formLibraryPathEntries(String[] libPaths) {
-+ private static ICLanguageSettingEntry[] formLibraryPathEntries(
-+ String[] libPaths) {
- List<ICLanguageSettingEntry> libPathEntries = new ArrayList<ICLanguageSettingEntry>();
-- for(String libPath : libPaths) {
-- CLibraryPathEntry libPathEntry = new CLibraryPathEntry(new Path(libPath),
-- ICSettingEntry.LIBRARY_PATH);
-+ for (String libPath : libPaths) {
-+ CLibraryPathEntry libPathEntry = new CLibraryPathEntry(new Path(
-+ libPath), ICSettingEntry.LIBRARY_PATH);
- libPathEntries.add(libPathEntry);
- }
-- return libPathEntries.toArray(new ICLanguageSettingEntry[libPathEntries.size()]);
-+ return libPathEntries.toArray(new ICLanguageSettingEntry[libPathEntries
-+ .size()]);
- }
--
-+
- /**
- * Get include paths from the checked packages.
-+ *
- * @param proj
- * @return
- */
-@@ -208,17 +231,18 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- String cflags = null;
- String[] includeArray = null;
- for (String pkg : pkgs) {
-- cflags = PkgConfigUtil.getCflags(pkg);
-+ cflags = PkgConfigUtil.getCflags(pkg, proj.getName());
- includeArray = Parser.parseIncPaths(cflags);
-- if (includeArray!=null) {
-+ if (includeArray != null) {
- Collections.addAll(includeList, includeArray);
- }
- }
- return includeList.toArray(new String[includeList.size()]);
- }
--
-+
- /**
- * Get library files from the checked packages.
-+ *
- * @param proj
- * @return
- */
-@@ -228,17 +252,18 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- String libs = null;
- String[] libArray = null;
- for (String pkg : pkgs) {
-- libs = PkgConfigUtil.getLibFilesOnly(pkg);
-+ libs = PkgConfigUtil.getLibFilesOnly(pkg, proj.getName());
- libArray = Parser.parseLibs2(libs);
-- if (libArray!=null) {
-+ if (libArray != null) {
- Collections.addAll(libList, libArray);
- }
- }
- return libList.toArray(new String[libList.size()]);
- }
--
-+
- /**
- * Get library paths from the checked packages.
-+ *
- * @param proj
- * @return
- */
-@@ -248,17 +273,18 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- String libPaths = null;
- String[] libPathArray = null;
- for (String pkg : pkgs) {
-- libPaths = PkgConfigUtil.getLibPathsOnly(pkg);
-+ libPaths = PkgConfigUtil.getLibPathsOnly(pkg, proj.getName());
- libPathArray = Parser.parseLibPaths2(libPaths);
-- if (libPathArray!=null) {
-+ if (libPathArray != null) {
- Collections.addAll(libPathList, libPathArray);
- }
- }
- return libPathList.toArray(new String[libPathList.size()]);
- }
--
-+
- /**
- * Get other flags from the checked packages.
-+ *
- * @param proj
- * @return
- */
-@@ -268,17 +294,18 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- String cflags = null;
- String[] otherFlagArray = null;
- for (String pkg : pkgs) {
-- cflags = PkgConfigUtil.getCflags(pkg);
-+ cflags = PkgConfigUtil.getCflags(proj.getName(), pkg);
- otherFlagArray = Parser.parseCflagOptions(cflags);
-- if (otherFlagArray!=null) {
-+ if (otherFlagArray != null) {
- Collections.addAll(otherFlagList, otherFlagArray);
- }
- }
- return otherFlagList.toArray(new String[otherFlagList.size()]);
- }
--
-+
- /**
- * Add other flags to Tool's Option.
-+ *
- * @param proj
- */
- private static void addOtherFlagsToTools(final IProject proj) {
-@@ -298,29 +325,35 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
-
- /**
- * Get a storage element which stores the checked packages.
-+ *
- * @param proj
- * @return
- */
- private static ICStorageElement getPackageStorage(IProject proj) {
- try {
-- ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(proj);
-- ICConfigurationDescription activeConf = projectDescription.getActiveConfiguration();
-+ ICProjectDescription projectDescription = CoreModel.getDefault()
-+ .getProjectDescription(proj);
-+ ICConfigurationDescription activeConf = projectDescription
-+ .getActiveConfiguration();
- ICConfigurationDescription desc = activeConf.getConfiguration();
- ICStorageElement strgElem = null;
- try {
- strgElem = desc.getStorage(PACKAGES, true);
- return strgElem;
- } catch (CoreException e) {
-- Activator.getDefault().log(e, "Getting packages from the storage failed."); //$NON-NLS-1$
-+ Activator.getDefault().log(e,
-+ "Getting packages from the storage failed."); //$NON-NLS-1$
- }
- } catch (NullPointerException e) {
-- Activator.getDefault().log(e, "Getting project description failed."); //$NON-NLS-1$
-+ Activator.getDefault()
-+ .log(e, "Getting project description failed."); //$NON-NLS-1$
- }
- return null;
- }
--
-+
- /**
- * Get names of the checked packages.
-+ *
- * @param proj
- * @return
- */
-@@ -329,14 +362,14 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- String[] pkgNames = pkgStorage.getAttributeNames();
- List<String> pkgs = new ArrayList<String>();
- String value = null;
-- for(String pkgName : pkgNames) {
-+ for (String pkgName : pkgNames) {
- value = pkgStorage.getAttribute(pkgName);
-- if(value!=null) {
-- if(value.equals("true")) { //$NON-NLS-1$
-+ if (value != null) {
-+ if (value.equals("true")) { //$NON-NLS-1$
- /*
-- * replace + symbols, because + symbols in package names
-- * had to be replaced when storing them to
-- * ICStorageElement to prevent error
-+ * replace + symbols, because + symbols in package names had
-+ * to be replaced when storing them to ICStorageElement to
-+ * prevent error
- */
- if (pkgName.contains("plus")) { //$NON-NLS-1$
- pkgName = pkgName.replace("plus", "+"); //$NON-NLS-1$ //$NON-NLS-2$
-@@ -347,5 +380,5 @@ public class PkgConfigExternalSettingProvider extends CExternalSettingProvider {
- }
- return pkgs.toArray(new String[pkgs.size()]);
- }
--
-+
- }
-diff --git a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java
-index 923753c..e0e4127 100644
---- a/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java
-+++ b/org.eclipse.cdt.managedbuilder.pkgconfig/src/org/eclipse/cdt/managedbuilder/pkgconfig/util/PkgConfigUtil.java
-@@ -20,13 +20,15 @@ import org.eclipse.cdt.managedbuilder.pkgconfig.Activator;
- import org.eclipse.cdt.managedbuilder.pkgconfig.preferences.PreferenceStore;
-
- /**
-- * Runs pkg-config utility in the command line and outputs necessary
-- * options to build the given package.
-+ * Runs pkg-config utility in the command line and outputs necessary options to
-+ * build the given package.
- *
- */
- public class PkgConfigUtil {
-
-- //Constant variables
-+ private static final String UNIX_PATH_SEPARATOR = ":"; //$NON-NLS-1$
-+ private static final String WINDOWS_PATH_SEPARATOR = ";"; //$NON-NLS-1$
-+ // Constant variables
- private static final String PKG_CONFIG = "pkg-config"; //$NON-NLS-1$
- private static final String LIST_PACKAGES = "--list-all"; //$NON-NLS-1$
- private static final String OUTPUT_LIBS = "--libs"; //$NON-NLS-1$
-@@ -36,16 +38,16 @@ public class PkgConfigUtil {
- private static final String OUTPUT_ONLY_LIB_FILES = "--libs-only-l"; //$NON-NLS-1$
-
- /**
-- * Get options needed to build the given package.
-- * Does not like spaces on paths except that getAllPackages seem to work.
-+ * Get options needed to build the given package. Does not like spaces on
-+ * paths except that getAllPackages seem to work.
- *
- * @param pkgConfigOptions
- * Pkg-config options
- * @param pkg
- * @return
- */
-- private static String getPkgOutput(String pkgConfigOptions) {
-- List<String> pkgOutputs = getPkgOutputs(pkgConfigOptions);
-+ private static String getPkgOutput(String project, String pkgConfigOptions) {
-+ List<String> pkgOutputs = getPkgOutputs(project, pkgConfigOptions);
- if (pkgOutputs.isEmpty())
- return null;
- return pkgOutputs.get(0);
-@@ -57,14 +59,14 @@ public class PkgConfigUtil {
- *
- * @param pkgconfigOptions
- * Pkg-config options as --list-all, --libs...
-- * @param pkg
-- * Pkg-config library name. In case of --list-all option, it must
-- * be set to null
-+ * @param project
-+ * Project name
- * @return pkg-config command results as a list of string
- */
-- private static List<String> getPkgOutputs(String pkgconfigOptions) {
-+ private static List<String> getPkgOutputs(String project,
-+ String pkgconfigOptions) {
- ProcessBuilder pb = null;
-- String pkgConfigBinPath = PreferenceStore.getPkgConfigBinPath();
-+ String pkgConfigBinPath = PreferenceStore.getPkgConfigBinPath(project);
-
- if (pkgConfigBinPath.isEmpty()) {
- if (OSDetector.isWindows())
-@@ -73,30 +75,60 @@ public class PkgConfigUtil {
- pkgConfigBinPath = PKG_CONFIG;
- }
-
-- String pkgConfigPath = PreferenceStore.getPkgConfigPath();
-+ String[] pkgConfigPaths = PreferenceStore.getPkgConfigPath(project);
- StringBuffer pkgConfigCmd = new StringBuffer();
-+ String pkgConfigPath = ""; //$NON-NLS-1$
-+
-+ if (pkgConfigPaths != null) {
-+ for (int i = 0; i < pkgConfigPaths.length; i++) {
-+ String pkgConfigPathValue = pkgConfigPaths[i];
-+ pkgConfigPath += pkgConfigPathValue;
-+ if (i != pkgConfigPaths.length - 1) {
-+ if (OSDetector.isWindows()) {
-+ pkgConfigPath += WINDOWS_PATH_SEPARATOR;
-+ } else {
-+ pkgConfigPath += UNIX_PATH_SEPARATOR;
-+ }
-+ }
-+ }
-
-- if (pkgConfigPath != null && !pkgConfigPath.isEmpty()) {
-- pkgConfigPath = pkgConfigPath.replace(" ", "\\ "); //$NON-NLS-1$ //$NON-NLS-2$
-- if (OSDetector.isWindows()) {
-- pkgConfigCmd
-- .append(" set PKG_CONFIG_PATH=" + pkgConfigPath + " ");//$NON-NLS-1$ //$NON-NLS-2$
-- } else {
-- pkgConfigCmd.append(" PKG_CONFIG_PATH=" + pkgConfigPath + " ");//$NON-NLS-1$ //$NON-NLS-2$
-+ if (!pkgConfigPath.isEmpty()) {
-+ pkgConfigPath = pkgConfigPath.replace(" ", "\\ "); //$NON-NLS-1$ //$NON-NLS-2$
-+ if (OSDetector.isWindows()) {
-+ pkgConfigCmd
-+ .append(" set PKG_CONFIG_PATH=" + pkgConfigPath + "&");//$NON-NLS-1$ //$NON-NLS-2$
-+ } else {
-+ pkgConfigCmd
-+ .append(" PKG_CONFIG_PATH=" + pkgConfigPath + " ");//$NON-NLS-1$ //$NON-NLS-2$
-+ }
- }
- }
-
-- String pkgConfigLibDirPath = PreferenceStore.getPkgConfigLibDir();
-- if (pkgConfigLibDirPath != null && !pkgConfigLibDirPath.isEmpty()) {
-- pkgConfigLibDirPath = pkgConfigLibDirPath.replace(" ", "\\ "); //$NON-NLS-1$ //$NON-NLS-2$
-- if (OSDetector.isWindows()) {
-- if (pkgConfigPath != null && !pkgConfigPath.isEmpty())
-- pkgConfigCmd.append("&&"); //$NON-NLS-1$
-- pkgConfigCmd
-- .append(" set PKG_CONFIG_LIBDIR=" + pkgConfigLibDirPath + " ");//$NON-NLS-1$ //$NON-NLS-2$
-- } else {
-- pkgConfigCmd
-- .append(" PKG_CONFIG_LIBDIR=" + pkgConfigLibDirPath + " ");//$NON-NLS-1$ //$NON-NLS-2$
-+ String[] pkgConfigLibDirPaths = PreferenceStore
-+ .getPkgConfigLibDir(project);
-+ if (pkgConfigLibDirPaths != null) {
-+ String pkgConfigLibDirPath = ""; //$NON-NLS-1$
-+ for (int i = 0; i < pkgConfigLibDirPaths.length; i++) {
-+ String pkgConfigPathValue = pkgConfigLibDirPaths[i];
-+ pkgConfigLibDirPath += pkgConfigPathValue;
-+ if (pkgConfigPaths != null && i != pkgConfigPaths.length - 1) {
-+ if (OSDetector.isWindows()) {
-+ pkgConfigPath += WINDOWS_PATH_SEPARATOR;
-+ } else {
-+ pkgConfigPath += UNIX_PATH_SEPARATOR;
-+ }
-+ }
-+ }
-+
-+ if (!pkgConfigLibDirPath.isEmpty()) {
-+ pkgConfigLibDirPath = pkgConfigLibDirPath.replace(" ", "\\ "); //$NON-NLS-1$ //$NON-NLS-2$
-+ if (OSDetector.isWindows()) {
-+ pkgConfigCmd
-+ .append(" set PKG_CONFIG_LIBDIR=" + pkgConfigLibDirPath + "&");//$NON-NLS-1$ //$NON-NLS-2$
-+ } else {
-+ pkgConfigCmd
-+ .append(" PKG_CONFIG_LIBDIR=" + pkgConfigLibDirPath + " ");//$NON-NLS-1$ //$NON-NLS-2$
-+ }
- }
- }
- pkgConfigCmd.append(pkgConfigBinPath);
-@@ -148,65 +180,72 @@ public class PkgConfigUtil {
- }
- return results;
- }
--
-+
- /**
- * Get cflags and libraries needed to build the given package.
- *
-- * @param pkg
-+ * @param pkg Package
-+ * @param project Project name
- * @return
- */
-- public static String getAll(String pkg) {
-- return getPkgOutput(OUTPUT_ALL + " " + pkg); //$NON-NLS-1$
-+ public static String getAll(String pkg, String project) {
-+ return getPkgOutput(project, OUTPUT_ALL + " " + pkg); //$NON-NLS-1$
- }
--
-+
- /**
- * Get libraries (files and paths) needed to build the given package.
- *
-- * @param pkg
-+ * @param pkg Package
-+ * @param project Project name
- * @return
- */
-- public static String getLibs(String pkg) {
-- return getPkgOutput(OUTPUT_LIBS + " " + pkg); //$NON-NLS-1$
-+ public static String getLibs(String pkg, String project) {
-+ return getPkgOutput(project, OUTPUT_LIBS + " " + pkg); //$NON-NLS-1$
- }
--
-+
- /**
- * Get library paths needed to build the given package.
- *
-- * @param pkg
-+ * @param pkg Package
-+ * @param project Project name
- * @return
- */
-- public static String getLibPathsOnly(String pkg) {
-- return getPkgOutput(OUTPUT_ONLY_LIB_PATHS + " " + pkg); //$NON-NLS-1$
-+ public static String getLibPathsOnly(String pkg, String project) {
-+ return getPkgOutput(project, OUTPUT_ONLY_LIB_PATHS + " " + pkg); //$NON-NLS-1$
- }
-
- /**
- * Get library files needed to build the given package.
- *
-- * @param pkg
-- * @return
-+ * @param pkg Package
-+ * @param project Project name
-+ * @return
- */
-- public static String getLibFilesOnly(String pkg) {
-- return getPkgOutput(OUTPUT_ONLY_LIB_FILES + " " + pkg); //$NON-NLS-1$
-+ public static String getLibFilesOnly(String pkg, String project) {
-+ return getPkgOutput(project, OUTPUT_ONLY_LIB_FILES + " " + pkg); //$NON-NLS-1$
- }
--
-+
- /**
- * Get cflags needed to build the given package.
- *
-- * @param pkg
-+ * @param pkg Package
-+ * @param project Project name
- * @return
- */
-- public static String getCflags(String pkg) {
-- return getPkgOutput(OUTPUT_CFLAGS + " " + pkg); //$NON-NLS-1$
-+ public static String getCflags(String pkg, String project) {
-+ return getPkgOutput(project, OUTPUT_CFLAGS + " " + pkg); //$NON-NLS-1$
- }
--
-+
- /**
- * Get all packages that pkg-config utility finds (package name with
- * description).
- *
-+ * @param project
-+ *
- * @return
- */
-- public static List<String> getAllPackages() {
-- return getPkgOutputs(LIST_PACKAGES);
-+ public static List<String> getAllPackages(String project) {
-+ return getPkgOutputs(project, LIST_PACKAGES);
- }
--
-+
- }
---
-1.7.9.5
-
--
1.7.9.5

Reply all
Reply to author
Forward
0 new messages