reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 69e2e465fff42fc416ee38cead2b6a94fb66c81c
parent 09061f89dc4f6020d33dbc9e81331e16dec91676
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Sat, 28 Jul 2018 07:48:04 -0700

link against system zlib/Catch2 and use vcpkg on Windows

Diffstat:
M.gitignore | 9+++++----
MREADME.md | 139++++++++++++++++++++++++++++++++++++-------------------------------------------
MTupfile | 4+---
Dbuild_deps.bat | 33---------------------------------
Mlinux.tup | 2+-
Mmacosx.tup | 2+-
Msrc/path.cpp | 4++--
Mtest/helper.hpp | 2+-
Mtest/version.cpp | 2++
Dvendor/.gitkeep | 0
Avendor/0001-vcpkg-curl-use-winssl.patch | 23+++++++++++++++++++++++
Avendor/vcpkg-deps.txt | 1+
Mwin32.tup | 28++++++++--------------------
Mx64/tup.config | 1+
Mx86/tup.config | 1+
15 files changed, 111 insertions(+), 140 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,8 +1,9 @@ -.DS_Store -.tup/ +/.tup/ + bin/ build/ -vendor/* -!vendor/.gitkeep resource.rc_mac* resource.res + +/vendor/*/ +/vendor/reaper_plugin*.h diff --git a/README.md b/README.md @@ -2,96 +2,85 @@ [![Donate](https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png)](https://www.paypal.com/cgi-bin/webscr?business=T3DEWBQJAV7WL&cmd=_donations&currency_code=CAD&item_name=ReaPack%3A+Package+manager+for+REAPER) -## User Guide +Visit the [ReaPack website](https://reapack.com/) for ready-to-use binaries +and the user guide. -https://reapack.com/user-guide +## Compilation -## Build Setup +The following section describes how to build ReaPack on your computer. +The build system uses Rake and is based on [Tup](http://gittup.org/tup/). +A modern compiler (gcc/clang/msvc) with C++14 support is needed. -Download these files into the `vendor` directory: +By default the `rake` command triggers both the 64-bit and 32-bit builds and +runs the test suite. Use `rake 'default[x64]'` or `rake 'default[x86]'` +to select a single architecture. + +The 64-bit and 32-bit binaries (such as `reaper_reapack64.so`) are created in +`x64/bin` and `x86/bin` respectively. Copy or link the desired one into +`<REAPER resource path>/UserPlugins` and restart REAPER to use it. + +Compiling ReaPack requires several external libraries and files depending +on the operating system. + +Put the REAPER extension SDK into the `vendor` directory: -- catch.hpp from - [philsquared/Catch](https://github.com/philsquared/Catch/raw/master/single_include/catch.hpp) - reaper_plugin.h from [reaper-oss/sws](https://github.com/reaper-oss/sws/raw/master/reaper/reaper_plugin.h) - reaper_plugin_functions.h from the REAPER action -- [WDL](http://www.cockos.com/wdl/) from Cockos: - `git clone https://github.com/justinfrankel/WDL.git vendor/WDL` "[developer] Write C++ API functions header" -The `vendor` directory structure should be as follow: - -``` -reapack> tree vendor -vendor -├── WDL/ -│ └── WDL/ -│ ├── MersenneTwister.h -│ ├── adpcm_decode.h -│ ├── adpcm_encode.h -│ ├── assocarray.h -│ └── ... -├── catch.hpp -├── reaper_plugin.h -└── reaper_plugin_functions.h -``` - -Follow the following instructions to install prerequisites and build both 64-bit -and 32-bit versions. Use `rake 'default[x64]'` or `rake 'default[x86]'` instead -of `rake` to build just one. +Clone [WDL](http://www.cockos.com/wdl/): `git clone https://github.com/justinfrankel/WDL.git vendor/WDL` ### Linux -1. Install gcc-multilib (and g++-multilib depending on your vendor), tup, Ruby and PHP -2. Install Boost, curl and SQLite3 development files (64-bit and 32-bit versions if building both) -3. Build using `rake` -4. Copy or link `x64/bin/reaper_reapack64.so` or `x86/bin/reaper_reapack32.so` - to `~/.config/REAPER/UserPlugins` +Install GCC/G++ (multilib version if building for both 64-bit and 32-bit), +tup, Ruby and PHP. + +Install libraries and development files for Boost, Catch2, curl, SQLite3 and +zlib matching the target architecture(s). ### macOS -1. Install [Homebrew](http://brew.sh/) and Xcode Command Line Tools -2. Install [tup](http://gittup.org/tup/) and [Boost](http://www.boost.org/): - `brew tap homebrew/fuse && brew install tup boost` -3. Apply these patches to WDL: - - [optimize-listview-setitemtext](https://github.com/cfillion/WDL/commit/a6d7f802762e5e9d9833829bab83696e0db50de6.patch) - - [resize-redraw-fix](https://github.com/cfillion/WDL/commit/45ca4c819d4aaaed98540b8e5125085c05044786.patch) - - [richtext-off](https://github.com/cfillion/WDL/commit/af9df173570edbb1d022045a7036d8d3296977b6.patch) - - [shellexecute-https](https://github.com/cfillion/WDL/commit/0424a87047470aefbeef98526622e5af5f919ac9.patch) -3. Build using `rake` -5. Copy or link `x64/bin/reaper_reapack64.dylib` or `x86/bin/reaper_reapack32.dylib` - to REAPER's extension directory +Install Boost, tup and Xcode Command Line Tools. Using [Homebrew](http://brew.sh/): + + xcode-select --install + brew cask install osxfuse + brew install boost tup + +Download the single header version of +[Catch2](https://github.com/catchorg/Catch2) (catch.hpp) into `vendor/catch`. + +Apply these patches to WDL: + +- [optimize-listview-setitemtext](https://github.com/cfillion/WDL/commit/a6d7f802762e5e9d9833829bab83696e0db50de6.patch) +- [resize-redraw-fix](https://github.com/cfillion/WDL/commit/45ca4c819d4aaaed98540b8e5125085c05044786.patch) +- [richtext-off](https://github.com/cfillion/WDL/commit/af9df173570edbb1d022045a7036d8d3296977b6.patch) +- [shellexecute-https](https://github.com/cfillion/WDL/commit/0424a87047470aefbeef98526622e5af5f919ac9.patch) ### Windows -1. Install [Ruby for Windows](http://rubyinstaller.org/), - [tup](http://gittup.org/tup/win32/tup-explicit-variant-v0.7.3-45-gcf6a829.zip) - (explicit-variant branch, see [this - thread](https://groups.google.com/d/topic/tup-users/UNUSE15PQdA/discussion)) - and [Visual Studio 2017, with C++ support](https://www.visualstudio.com/vs/community/) -2. Prevent Microsoft's C++ compiler from saving telemetry outside of the build directory: - [instructions here](https://msdn.microsoft.com/en-us/library/ee225238.aspx#Anchor_5) - or set the `OptIn` registry key to `0` in - `HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VSCommon\15.0\SQM` -3. Download the latest [Boost](http://www.boost.org/) and copy the - `boost` subdirectory into `vendor` -4. Download the latest [curl](http://curl.haxx.se/download.html) source - code and extract it as `vendor/curl`: - - ``` - reapack> tree vendor - vendor - ├── curl/ - │   ├── builds/ - │   │   └── ... - │   ├── winbuild/ - │   │ ├── Makefile.vc - │   │ └── ... - │   └── ... - └── ... - ``` -5. Download the latest stable amalgamation build of [SQLite](https://www.sqlite.org/download.html). - Put `sqlite3.h` and `sqlite3.c` in `vendor`. -6. Run `.\build_deps.bat` and `rake` using "Developer Command Prompt for VS 2017" -7. Copy or symlink `x64\bin\reaper_reapack64.dll` or `x86\bin\reaper_reapack32.dll` - to your REAPER plugin folder +Install [Ruby for Windows](http://rubyinstaller.org/), +tup ([explicit-variant](http://gittup.org/tup/win32/tup-explicit-variant-v0.7.3-45-gcf6a829.zip) branch, see [this thread](https://groups.google.com/d/topic/tup-users/UNUSE15PQdA/discussion)) +and [Visual Studio 2017 with C++ support](https://www.visualstudio.com/vs/community/). + +Clone [vcpkg](https://github.com/Microsoft/vcpkg) into `vendor` and install +the build dependencies: + + git clone https://github.com/Microsoft/vcpkg.git vendor\vcpkg + git apply --directory=vendor vendor\0001-vcpkg-curl-use-winssl.patch + vendor\vcpkg\bootstrap-vcpkg.bat + + set /p vcpkg-deps=<vendor\vcpkg-deps.txt + vendor\vcpkg\vcpkg install --triplet x64-windows-static %vcpkg-deps% + vendor\vcpkg\vcpkg install --triplet x86-windows-static %vcpkg-deps% + +Run the build commands using the Developer Command Prompt for VS 2017. + +## Support and feedback + +Ask any ReaPack-releated questions in the +[ReaPack forum thread](https://forum.cockos.com/showthread.php?t=177978). +Questions related to development or packaging can be asked in the +[development thread](https://forum.cockos.com/showthread.php?t=169127). + +Report bugs or request features in the [issue tracker](https://github.com/cfillion/reapack/issues). diff --git a/Tupfile b/Tupfile @@ -6,9 +6,7 @@ WDLSOURCE += $(TINYXML)/tinyxml.cpp $(TINYXML)/tinystr.cpp WDLSOURCE += $(TINYXML)/tinyxmlparser.cpp $(TINYXML)/tinyxmlerror.cpp ZLIB := $(WDL)/zlib -WDLSOURCE += $(ZLIB)/zip.c $(ZLIB)/unzip.c $(ZLIB)/inflate.c $(ZLIB)/deflate.c -WDLSOURCE += $(ZLIB)/zutil.c $(ZLIB)/crc32.c $(ZLIB)/adler32.c $(ZLIB)/ioapi.c -WDLSOURCE += $(ZLIB)/trees.c $(ZLIB)/inftrees.c $(ZLIB)/inffast.c +WDLSOURCE += $(ZLIB)/zip.c $(ZLIB)/unzip.c $(ZLIB)/ioapi.c include @(TUP_PLATFORM).tup diff --git a/build_deps.bat b/build_deps.bat @@ -1,33 +0,0 @@ -@echo off -setlocal - -set self=%~dp0 -set vendor=%self%vendor -set curl=%vendor%\curl - -call :AssertExists "%curl%\winbuild\Makefile.vc" || goto :eof - -if "%1%"=="curl32" ( - cd "%curl%\winbuild" - nmake /f Makefile.vc mode=static RTLIBCFG=static MACHINE=x86 - xcopy /y /s %curl%\builds\libcurl-vc-x86-release-static-ipv6-sspi-winssl %vendor%\libcurl32\ - rmdir "%curl%\builds" /Q /S - exit /b -) -if "%1%"=="curl64" ( - cd "%curl%\winbuild" - nmake /f Makefile.vc mode=static RTLIBCFG=static MACHINE=x64 - xcopy /y /s %curl%\builds\libcurl-vc-x64-release-static-ipv6-sspi-winssl %vendor%\libcurl64\ - rmdir "%curl%\builds" /Q /S - exit /b -) - -call %self%\wrapper i386 cmd /c %self%\build_deps curl32 -call %self%\wrapper x86_64 cmd /c %self%\build_deps curl64 -exit - -:AssertExists -if not exist "%~1" ( - echo [build_deps] %~1: No such file or directory - exit /b 1 -) diff --git a/linux.tup b/linux.tup @@ -17,7 +17,7 @@ SWELL := $(WDL)/swell WDLSOURCE += $(SWELL)/swell-modstub-generic.cpp export CURLSO -LDFLAGS := -lstdc++ -lpthread -ldl ${CURLSO:--lcurl} -lsqlite3 +LDFLAGS := -lstdc++ -lpthread -ldl ${CURLSO:--lcurl} -lsqlite3 -lz SOFLAGS := -shared SOTARGET := bin/$(REAPACK_FILE) diff --git a/macosx.tup b/macosx.tup @@ -20,7 +20,7 @@ WDLSOURCE += $(SWELL)/swell.cpp $(SWELL)/swell-ini.cpp $(SWELL)/swell-miscdlg.mm WDLSOURCE += $(SWELL)/swell-gdi.mm $(SWELL)/swell-kb.mm $(SWELL)/swell-menu.mm WDLSOURCE += $(SWELL)/swell-misc.mm $(SWELL)/swell-dlg.mm $(SWELL)/swell-wnd.mm -LDFLAGS := -framework Cocoa -framework Carbon -lcurl -lsqlite3 -lc++ +LDFLAGS := -framework Cocoa -framework Carbon -lc++ -lcurl -lsqlite3 -lz SOFLAGS := -dynamiclib SOTARGET := bin/$(REAPACK_FILE) diff --git a/src/path.cpp b/src/path.cpp @@ -21,8 +21,6 @@ #include <boost/range/adaptor/reversed.hpp> #include <vector> -using namespace std; - static constexpr char UNIX_SEPARATOR = '/'; #ifndef _WIN32 @@ -35,6 +33,8 @@ static constexpr char NATIVE_SEPARATOR = '\\'; static constexpr const char *DOT = "."; static constexpr const char *DOTDOT = ".."; +using namespace std; + const Path Path::DATA("ReaPack"); const Path Path::CACHE = Path::DATA + "cache"; const Path Path::CONFIG("reapack.ini"); diff --git a/test/helper.hpp b/test/helper.hpp @@ -7,4 +7,4 @@ class Time; std::ostream &operator<<(std::ostream &, const std::set<Path> &); // include Catch only after having declared our ostream overloads -#include <catch.hpp> +#include <catch/catch.hpp> diff --git a/test/version.cpp b/test/version.cpp @@ -6,6 +6,8 @@ #include <index.hpp> #include <package.hpp> +#include <sstream> + using namespace std; #define MAKE_PACKAGE \ diff --git a/vendor/.gitkeep b/vendor/.gitkeep diff --git a/vendor/0001-vcpkg-curl-use-winssl.patch b/vendor/0001-vcpkg-curl-use-winssl.patch @@ -0,0 +1,23 @@ +diff --git a/vcpkg/triplets/x64-windows-static.cmake b/vcpkg/triplets/x64-windows-static.cmake +index 75f9b953..0f828565 100644 +--- a/vcpkg/triplets/x64-windows-static.cmake ++++ b/vcpkg/triplets/x64-windows-static.cmake +@@ -1,3 +1,4 @@ + set(VCPKG_TARGET_ARCHITECTURE x64) + set(VCPKG_CRT_LINKAGE static) + set(VCPKG_LIBRARY_LINKAGE static) ++set(CURL_USE_WINSSL ON) +diff --git a/vcpkg/triplets/x86-windows-static.cmake b/vcpkg/triplets/x86-windows-static.cmake +index c855f0ca..afd1246d 100644 +--- a/vcpkg/triplets/x86-windows-static.cmake ++++ b/vcpkg/triplets/x86-windows-static.cmake +@@ -1,3 +1,4 @@ + set(VCPKG_TARGET_ARCHITECTURE x86) + set(VCPKG_CRT_LINKAGE static) +-set(VCPKG_LIBRARY_LINKAGE static) +\ No newline at end of file ++set(VCPKG_LIBRARY_LINKAGE static) ++set(CURL_USE_WINSSL ON) +-- +2.18.0.windows.1 + diff --git a/vendor/vcpkg-deps.txt b/vendor/vcpkg-deps.txt @@ -0,0 +1 @@ +boost-algorithm boost-core boost-logic boost-mpl boost-optional boost-preprocessor boost-range boost-signals2 boost-variant catch2 curl sqlite3 diff --git a/win32.tup b/win32.tup @@ -5,35 +5,24 @@ CXX := $(WRAP) cl REAPACK_FILE := reaper_reapack@(SUFFIX) +VCPKG = vendor/vcpkg/installed/@(VCPKG_TRIPLET) + CXXFLAGS := /nologo /W3 /WX /wd4996 /EHsc /MT CXXFLAGS += /O2 /Z7 /Zo -CXXFLAGS += /Ivendor /Ivendor/WDL /Ivendor/WDL/WDL -CXXFLAGS += /Ivendor/libcurl@(SUFFIX)/include -CXXFLAGS += /DWDL_NO_DEFINE_MINMAX -CXXFLAGS += /DCURL_STATICLIB /DUNICODE /DNDEBUG +CXXFLAGS += /Ivendor /I$(VCPKG)/include /Ivendor/WDL /Ivendor/WDL/WDL +CXXFLAGS += /DWDL_NO_DEFINE_MINMAX /DCURL_STATICLIB /DUNICODE /DNDEBUG CXXFLAGS += /DREAPACK_FILE#\"$(REAPACK_FILE).dll\" -SQLFLAGS := /Os /wd4101 -SQLFLAGS += /DSQLITE_OMIT_COMPOUND_SELECT /DSQLITE_OMIT_DATETIME_FUNCS -SQLFLAGS += /DSQLITE_OMIT_INTEGRITY_CHECK /DSQLITE_OMIT_UTF16 -SQLFLAGS += /DSQLITE_OMIT_SHARED_CACHE /DSQLITE_OMIT_INCRBLOB -SQLFLAGS += /DSQLITE_OMIT_AUTHORIZATION /DSQLITE_OMIT_BUILTIN_TEST -SQLFLAGS += /DSQLITE_OMIT_SCHEMA_PRAGMAS /DSQLITE_OMIT_TRACE -SQLFLAGS += /DSQLITE_OMIT_LOAD_EXTENSION /DSQLITE_OMIT_GET_TABLE -SQLFLAGS += /DSQLITE_OMIT_COMPLETE /DSQLITE_OMIT_TEMPDB -SQLFLAGS += /DSQLITE_OMIT_COMPILEOPTION_DIAGS /DSQLITE_OMIT_CAST -SQLFLAGS += /DSQLITE_OMIT_CHECK /DSQLITE_OMIT_DECLTYPE /DSQLITE_OMIT_DEPRECATED - LD := $(WRAP) link LDFLAGS := /nologo User32.lib Shell32.lib Gdi32.lib Comdlg32.lib Comctl32.lib -LDFLAGS += vendor/libcurl@(SUFFIX)/lib/libcurl_a.lib +LDFLAGS += $(VCPKG)/lib/libcurl.lib Ws2_32.lib Crypt32.lib Advapi32.lib +LDFLAGS += $(VCPKG)/lib/sqlite3.lib $(VCPKG)/lib/zlib.lib LDFLAGS += $(TUP_VARIANTDIR)/src/resource.res -LDFLAGS += $(TUP_VARIANTDIR)/build/vendor/sqlite3.o LDFLAGS += /DEBUG /OPT:REF /PDBALTPATH:%_PDB% -LINKDEPS := src/resource.res build/vendor/sqlite3.o +LINKDEPS := src/resource.res -RC := rc +RC := $(WRAP) rc RCFLAGS += /nologo /fo $(TUP_VARIANTDIR)/src/resource.res TARGET := bin/$(REAPACK_FILE) @@ -47,4 +36,3 @@ TSTARGET := bin/test.exe bin/test.lib bin/test.exp bin/test.pdb !link = |> $(LD) $(LDFLAGS) %f |> : src/resource.rc |> $(RC) $(RCFLAGS) %f |> src/resource.res -: vendor/sqlite3.c |> !build $(SQLFLAGS) |> build/vendor/sqlite3.o diff --git a/x64/tup.config b/x64/tup.config @@ -1,2 +1,3 @@ CONFIG_ARCH=x86_64 CONFIG_SUFFIX=64 +CONFIG_VCPKG_TRIPLET=x64-windows-static diff --git a/x86/tup.config b/x86/tup.config @@ -1,2 +1,3 @@ CONFIG_ARCH=i386 CONFIG_SUFFIX=32 +CONFIG_VCPKG_TRIPLET=x86-windows-static