commit 1fb44077dce9bb3e7b97ca9544733808421aea47
parent 7e1628eac5bcd700bdd5bc8cf679bf472b8ca4ee
Author: cfillion <cfillion@users.noreply.github.com>
Date: Mon, 6 Feb 2017 21:12:26 -0500
initial linux port
Diffstat:
10 files changed, 125 insertions(+), 8 deletions(-)
diff --git a/linux.tup b/linux.tup
@@ -0,0 +1,30 @@
+CXX := c++
+
+REAPACK_FILE = reaper_reapack@(SUFFIX).so
+
+CXXFLAGS := -Wall -Wextra -Werror
+CXXFLAGS += -Wno-unused-parameter -Wno-missing-field-initializers
+CXXFLAGS += -Wno-unused-function -Wno-missing-braces
+CXXFLAGS += -fdiagnostics-color -fstack-protector-strong -fvisibility=hidden
+CXXFLAGS += -pipe -fPIC -O2 -std=c++14
+CXXFLAGS += -Ivendor -Ivendor/WDL -Ivendor/WDL/WDL -Ivendor/WDL/WDL/swell
+CXXFLAGS += -DWDL_NO_DEFINE_MINMAX -DSWELL_PROVIDED_BY_APP -DSWELL_TARGET_GDK
+CXXFLAGS += -DREAPACK_FILE=\"$(REAPACK_FILE)\"
+
+WDLFLAGS := -std=c++98 -w
+
+SWELL := $(WDL)/swell
+WDLSOURCE += $(SWELL)/swell-modstub-generic.cpp
+
+LDFLAGS := -lpthread -ldl -lcurl -lsqlite3
+
+SOFLAGS := -shared
+SOTARGET := bin/$(REAPACK_FILE)
+
+TSTARGET := bin/test
+
+!build = |> $(CXX) $(CXXFLAGS) -c %f -o %o |>
+!link = |> $(CXX) $(CXXFLAGS) %f $(LDFLAGS) -o %o |>
+
+BUILDDEPS := src/resource.rc_mac_menu src/resource.rc_mac_dlg
+: src/resource.rc |> php $(SWELL)/mac_resgen.php %f |> $(BUILDDEPS)
diff --git a/src/main.cpp b/src/main.cpp
@@ -185,7 +185,7 @@ extern "C" REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT(
return 1;
}
-#ifdef __APPLE__
+#ifndef _WIN32
#include "resource.hpp"
#include <swell/swell-dlggen.h>
diff --git a/src/platform.cpp b/src/platform.cpp
@@ -35,6 +35,10 @@ auto Platform::parse(const char *platform) -> Enum
return Darwin32Platform;
else if(!strcmp(platform, "darwin64"))
return Darwin64Platform;
+ else if(!strcmp(platform, "linux"))
+ return LinuxPlatform;
+ else if(!strcmp(platform, "linux64"))
+ return Linux64Platform;
else
return UnknownPlatform;
}
@@ -51,6 +55,12 @@ bool Platform::test() const
case Darwin32Platform:
#endif
+#elif __linux__
+ case LinuxPlatform:
+#ifdef __x86_64__
+ case Linux64Platform:
+#endif
+
#elif _WIN32
case WindowsPlatform:
#ifdef _WIN64
diff --git a/src/platform.hpp b/src/platform.hpp
@@ -24,15 +24,16 @@ public:
UnknownPlatform,
GenericPlatform,
- // windows
WindowsPlatform,
Win32Platform,
Win64Platform,
- // os x
DarwinPlatform,
Darwin32Platform,
Darwin64Platform,
+
+ LinuxPlatform,
+ Linux64Platform,
};
Platform() : m_value(GenericPlatform) {}
diff --git a/src/richedit-gtk.cpp b/src/richedit-gtk.cpp
@@ -0,0 +1,49 @@
+/* ReaPack: Package manager for REAPER
+ * Copyright (C) 2015-2017 Christian Fillion
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "richedit.hpp"
+
+#ifdef SWELL_TARGET_GDK
+
+// Starting here and onward is the Linux implementation of RichEdit
+// See also richedit.mm and richedit-win32.cpp
+
+using namespace std;
+
+void RichEdit::Init()
+{
+}
+
+RichEdit::RichEdit(HWND handle)
+ : Control(handle)
+{
+}
+
+RichEdit::~RichEdit()
+{
+}
+
+void RichEdit::onNotify(LPNMHDR, LPARAM)
+{
+}
+
+bool RichEdit::setRichText(const string &)
+{
+ return false;
+}
+
+#endif
diff --git a/src/richedit.cpp b/src/richedit-win32.cpp
diff --git a/src/transaction.cpp b/src/transaction.cpp
@@ -204,7 +204,7 @@ bool Transaction::runTasks()
if(m_promptObsolete(selected)) {
if(m_taskQueues.empty())
- m_taskQueues.push({});
+ m_taskQueues.push(TaskQueue());
for(const auto &entry : selected)
m_taskQueues.back().push(make_shared<UninstallTask>(entry, this));
diff --git a/test/index_v1.cpp b/test/index_v1.cpp
@@ -263,12 +263,14 @@ TEST_CASE("read source platform", M) {
IndexPtr ri = Index::load("src_platform");
- CHECK(ri->packages().size() == 1);
+ REQUIRE(ri->packages().size() == 1);
#ifdef __APPLE__
const auto expected = Platform::DarwinPlatform;
#elif _WIN32
const auto expected = Platform::WindowsPlatform;
+#elif __linux__
+ const auto expected = Platform::LinuxPlatform;
#endif
REQUIRE(ri->category(0)->package(0)->version(0)->source(0)->platform()
diff --git a/test/indexes/v1/ReaPack/cache/src_platform.xml b/test/indexes/v1/ReaPack/cache/src_platform.xml
@@ -4,6 +4,7 @@
<version name="1.0">
<source platform="windows" type="effect">https://google.com/</source>
<source platform="darwin" type="effect">https://google.com/</source>
+ <source platform="linux" type="effect">https://google.com/</source>
</version>
</reapack>
</category>
diff --git a/test/platform.cpp b/test/platform.cpp
@@ -30,14 +30,20 @@ TEST_CASE("platform from string", M) {
SECTION("windows 64-bit")
REQUIRE(Platform("win64") == Platform::Win64Platform);
- SECTION("generic os x")
+ SECTION("generic macos")
REQUIRE(Platform("darwin") == Platform::DarwinPlatform);
- SECTION("os x 32-bit")
+ SECTION("macos 32-bit")
REQUIRE(Platform("darwin32") == Platform::Darwin32Platform);
- SECTION("os x 64-bit")
+ SECTION("macos 64-bit")
REQUIRE(Platform("darwin64") == Platform::Darwin64Platform);
+
+ SECTION("generic linux")
+ REQUIRE(Platform("linux") == Platform::LinuxPlatform);
+
+ SECTION("linux 64-bit")
+ REQUIRE(Platform("linux64") == Platform::Linux64Platform);
}
TEST_CASE("test platform", M) {
@@ -45,6 +51,8 @@ TEST_CASE("test platform", M) {
{Platform::GenericPlatform, true},
#ifdef __APPLE__
+ {Platform::LinuxPlatform, false},
+ {Platform::Linux64Platform, false},
{Platform::WindowsPlatform, false},
{Platform::Win32Platform, false},
{Platform::Win64Platform, false},
@@ -58,10 +66,23 @@ TEST_CASE("test platform", M) {
{Platform::Darwin64Platform, false},
#endif
+#elif __linux__
+ {Platform::DarwinPlatform, false},
+ {Platform::Darwin32Platform, false},
+ {Platform::Darwin64Platform, false},
+ {Platform::WindowsPlatform, false},
+ {Platform::Win32Platform, false},
+ {Platform::Win64Platform, false},
+
+ {Platform::LinuxPlatform, true},
+ {Platform::Linux64Platform, true},
+
#elif _WIN32
{Platform::DarwinPlatform, false},
{Platform::Darwin32Platform, false},
{Platform::Darwin64Platform, false},
+ {Platform::LinuxPlatform, false},
+ {Platform::Linux64Platform, false},
{Platform::WindowsPlatform, true},
#ifdef _WIN64
@@ -71,6 +92,9 @@ TEST_CASE("test platform", M) {
{Platform::Win32Platform, true},
{Platform::Win64Platform, false},
#endif
+
+#else
+#error Untested platform
#endif
};