From ca7c0d4ea7afc7e045396f2d023f11feb1641a91 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 8 Sep 2017 22:59:38 +0200 Subject: [PATCH 1/4] Fix build with libraries in custom prefixes --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 2ff7814f..e1be7ff1 100644 --- a/Makefile +++ b/Makefile @@ -10,11 +10,12 @@ include arch.mk ifeq ($(ARCH), lin) SOURCES += ext/osdialog/osdialog_gtk2.c - CFLAGS += $(shell pkg-config --cflags gtk+-2.0) + CFLAGS += $(shell pkg-config --cflags gtk+-2.0 gl glew glfw3 jansson libzip portaudio-2.0 samplerate) + CXXFLAGS += $(shell pkg-config --cflags gl glew glfw3 jansson libzip portaudio-2.0 samplerate) LDFLAGS += -rdynamic \ - -lpthread -lGL -ldl \ - $(shell pkg-config --libs gtk+-2.0) \ - -Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lportaudio -lportmidi + -lpthread -ldl \ + $(shell pkg-config --libs gtk+-2.0 gl glew glfw3 jansson libzip portaudio-2.0 samplerate) \ + -Ldep/lib -lcurl -lportmidi TARGET = Rack endif From 32c5a149a589deb9f485168f80ec22aa71fc5306 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 8 Sep 2017 23:00:09 +0200 Subject: [PATCH 2/4] Use cmath and std functions, instead of math.h --- include/math.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/math.hpp b/include/math.hpp index ca83a664..bdeb7990 100644 --- a/include/math.hpp +++ b/include/math.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace rack { @@ -180,7 +180,7 @@ struct Vec { return Vec(roundf(x), roundf(y)); } bool isFinite() { - return isfinite(x) && isfinite(y); + return std::isfinite(x) && std::isfinite(y); } bool isZero() { return x == 0.0 && y == 0.0; From 1c300584e257ef6a19d704da2cc8b4463a4f8a9d Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 8 Sep 2017 23:00:39 +0200 Subject: [PATCH 3/4] Fix build against old glfw3 --- src/gui.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui.cpp b/src/gui.cpp index bbcd03b6..1601161b 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -22,6 +22,10 @@ #include #endif +#if GLFW_VERSION_MINOR == 0 && GLFW_VERSION_REVISION <= 4 +#define OLD_GLFW_VERSION +#endif + namespace rack { static GLFWwindow *window = NULL; @@ -227,7 +231,9 @@ void guiInit() { // glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); // glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); +#ifndef OLD_GLFW_VERSION glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE); +#endif std::string title = gApplicationName + " " + gApplicationVersion; window = glfwCreateWindow(1000, 750, title.c_str(), NULL, NULL); assert(window); @@ -254,7 +260,9 @@ void guiInit() { // GLEW generates GL error because it calls glGetString(GL_EXTENSIONS), we'll consume it here. glGetError(); +#ifndef OLD_GLFW_VERSION glfwSetWindowSizeLimits(window, 640, 480, GLFW_DONT_CARE, GLFW_DONT_CARE); +#endif // Set up NanoVG gVg = nvgCreateGL2(NVG_ANTIALIAS); From af839b0c596e4e80568a909356e82b811ef78279 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 8 Sep 2017 23:01:09 +0200 Subject: [PATCH 4/4] Fix build against old libzip --- src/plugin.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugin.cpp b/src/plugin.cpp index d21de1ae..650e551c 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -24,6 +24,11 @@ #include "plugin.hpp" +#if LIBZIP_VERSION_MAJOR == 0 && LIBZIP_VERSION_MINOR <= 10 +typedef zip zip_t; +typedef zip_file zip_file_t; +typedef struct zip_stat zip_stat_t; +#endif namespace rack { @@ -168,7 +173,7 @@ static void extract_zip(const char *dir, int zipfd) { if (!za) return; if (err) goto cleanup; - for (int i = 0; i < zip_get_num_entries(za, 0); i++) { + for (zip_uint64_t i = 0; i < zip_get_num_entries(za, 0); i++) { zip_stat_t zs; err = zip_stat_index(za, i, 0, &zs); if (err) goto cleanup;