OpenBoardView: add recipe

This commit is contained in:
Gerasim Troeglazov
2021-07-01 20:43:26 +10:00
parent 4ef8263498
commit 95ebbb90ac
4 changed files with 361 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
resource app_flags B_MULTIPLE_LAUNCH;
resource app_version {
major = @MAJOR@,
middle = @MIDDLE@,
minor = @MINOR@,
variety = B_APPV_FINAL,
internal = 0,
short_info = "OpenBoardView",
long_info = "@LONG_INFO@"
};
resource app_signature "@APP_SIGNATURE@";
resource vector_icon array {
$"6E6369660505FF020006023930D4400066BE6CED37DDD44B3ACE4669CA00FFFF"
$"FFFF3F3F7703372447050004005A0D0208B64A202420BCB7205820C2E220CAA6"
$"20602860B4A560BC61605860C31E605C5860CA7660C2DB602860BC8A60246020"
$"C95A205C20C2F7202820BC9320240003B7AEC78DB7AEC78DB9A3C5AEBD8DC1F0"
$"BB98C3CFC117C1F0C829C1F0C4A0C1F0C829C1F00004B6EDC131B6EDC131B8A1"
$"BF7CBC0ABC13BA56BDC8BED9BC13C477BC13C1A8BC13C5A5BAE5C800B88AC6D3"
$"B9B8C800B88A0606FF07B81AC85EB81AC85EB81AC914B6D0C9A7B787C9A7B61A"
$"C9A7B587C85EB587C914B587C7A7B6D0C714B61AC714B787C714B81AC85EB81A"
$"C7A7B81AC85EC85E0606FF07B81AC85EB81AC85EB81AC914B6D0C9A7B787C9A7"
$"B61AC9A7B587C85EB587C914B587C7A7B6D0C714B61AC714B787C714B81AC85E"
$"B81AC7A7B81AC85EC85E0606FF07C9F1B88AC9F1B88AC9F1B99AC804BA77C914"
$"BA77C6F3BA77C617B88AC617B99AC617B77AC804B69DC6F3B69DC914B69DC9F1"
$"B88AC9F1B77AC9F1B88AB88A0606FF07C9F1B88AC9F1B88AC9F1B99AC804BA77"
$"C914BA77C6F3BA77C617B88AC617B99AC617B77AC804B69DC6F3B69DC914B69D"
$"C9F1B88AC9F1B77AC9F1B88AB88A0003C005C654C005C654C105C754C304C954"
$"C205C854C62DC954CC7EC954C956C954CC7EC9540606FF07C221C62AC221C62A"
$"C221C73AC034C817C144C817BF23C817BE47C62ABE47C73ABE47C51AC034C43D"
$"BF23C43DC144C43DC221C62AC221C51AC221C62AC62A0606FF07C221C62AC221"
$"C62AC221C73AC034C817C144C817BF23C817BE47C62ABE47C73ABE47C51AC034"
$"C43DBF23C43DC144C43DC221C62AC221C51AC221C62AC62A0606FF07BE6AB86E"
$"BE6AB86EBE6AB924BD20B9B7BDD6B9B7BC6AB9B7BBD7B86EBBD7B924BBD7B7B8"
$"BD20B724BC6AB724BDD6B724BE6AB86EBE6AB7B8BE6AB86EB86E0606FF07C290"
$"B86EC290B86EC290B924C146B9B7C1FCB9B7C090B9B7BFFCB86EBFFCB924BFFC"
$"B7B8C146B724C090B724C1FCB724C290B86EC290B7B8C290B86EB86E0606FF07"
$"B9BFB86EB9BFB86EB9BFB924B876B9B7B92CB9B7B7C0B9B7B72CB86EB72CB924"
$"B72CB7B8B876B724B7C0B724B92CB724B9BFB86EB9BFB7B8B9BFB86EB86E0F0A"
$"040100023F80000000000000003F80004600004600000A030100123F80000000"
$"000000003F800043000043000001178522040A010100023F8000000000000000"
$"3F80004300004300000A000101123F80000000000000003F8000430000430000"
$"01178300040A000102123F80000000000000003F800043000043000001178300"
$"040A010103023F80000000000000003F80004300004300000A000104123F8000"
$"0000000000003F800043000043000001178100040A010105023F800000000000"
$"00003F80004300004300000A000106123F80000000000000003F800043000043"
$"000001178100040A000107123F80000000000000003F80004300004300000117"
$"8300040A010108023F80000000000000003F80004300004300000A000109123F"
$"80000000000000003F800043000043000001178100040A00010A023F80000000"
$"000000003F80004300004300000A00010B023F80000000000000003F80004300"
$"004300000A00010C023F80000000000000003F8000430000430000"
};

View File

@@ -0,0 +1,115 @@
SUMMARY="Open source Linux SDL/ImGui edition software for viewing .brd files"
DESCRIPTION="Linux SDL/ImGui edition software for viewing .brd files, intended \
as a drop-in replacement for the \"Test_Link\" software and \"Landrex\".
Features:
* Annotations (per board database file)
* Part and pin sizes better represented
* Better outlining of irregular objects (such as connectors)
* Drag and drop
* Recently used file history
* Non-orthagonally orientated caps/resistors/diodes now drawn more realistically
* Adjustable DPI (for working on 2K/4K screens)
* Works with multiple concurrent instances"
HOMEPAGE="https://openboardview.org/"
COPYRIGHT="2016 Chloridite and OpenBoardView contributors"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://github.com/OpenBoardView/OpenBoardView/archive/refs/tags/$portVersion.tar.gz"
CHECKSUM_SHA256="e1e2cfe12375b8725c714d9760241f3a15646fba6cda5173db9a9caaa9868aa7"
SOURCE_DIR="OpenBoardView-$portVersion"
srcGitRev_2="a5ca31c88a4cc5847ea012629aff3690f261c7c4"
SOURCE_URI_2="https://github.com/Dav1dde/glad/archive/$srcGitRev_2.zip"
CHECKSUM_SHA256_2="9aa8158dda4d3af8de3d61427bf99e75090f9178824550ebaf69ec26964656a5"
SOURCE_DIR_2="glad-$srcGitRev_2"
srcGitRev_3="738606a2943a8a11316fa15b319193a2baa84bc0"
SOURCE_URI_3="https://github.com/ocornut/imgui/archive/$srcGitRev_3.zip"
CHECKSUM_SHA256_3="0d52d2ffed6006edd2a77c8bfa083bce5982c06ab2620272403623fb42257f78"
SOURCE_DIR_3="imgui-$srcGitRev_3"
srcGitRev_4="80c8f6af0304588b9d780a41015472013b705194"
SOURCE_URI_4="https://github.com/nothings/stb/archive/$srcGitRev_4.zip"
CHECKSUM_SHA256_4="9783c3a6f29fe5c9672bd66d969d3dc2be76c70694be33d9734a075380e49ec1"
SOURCE_DIR_4="stb-$srcGitRev_4"
srcGitRev_5="3e9e3ec15c7bf129664ab2a113eb03b54ee0b584"
SOURCE_URI_5="https://github.com/sheredom/utf8.h/archive/$srcGitRev_5.zip"
CHECKSUM_SHA256_5="fe19ed41de2418722b7ccb94a36a3f81fff3720b089f2a52065ea5e10801a5e3"
SOURCE_DIR_5="utf8.h-$srcGitRev_5"
PATCHES="openboardview-$portVersion.patchset"
PATCHES_3="imgui-$portVersion.patchset"
ADDITIONAL_FILES="openboardview.rdef.in"
ARCHITECTURES="!x86_gcc2 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
openboardview$secondaryArchSuffix = $portVersion
app:OpenBoardView$secondaryArchSuffix
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libfontconfig$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
lib:libGL$secondaryArchSuffix
lib:libGLU$secondaryArchSuffix
lib:libSDL2_2.0$secondaryArchSuffix
lib:libsqlite3$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libfontconfig$secondaryArchSuffix
devel:libfreetype$secondaryArchSuffix
devel:libGL$secondaryArchSuffix
devel:libGLU$secondaryArchSuffix
devel:libSDL2_2.0$secondaryArchSuffix
devel:libsqlite3$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
cmd:python3
"
BUILD()
{
# link submodules
rm -rf $sourceDir/src/{glad,imgui,stb,utf8}
ln -s $sourceDir2 $sourceDir/src/glad
ln -s $sourceDir3 $sourceDir/src/imgui
ln -s $sourceDir4 $sourceDir/src/stb
ln -s $sourceDir5 $sourceDir/src/utf8
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DSDL2_INCLUDE_DIR=/system/$relativeIncludeDir/SDL2
make $jobArgs
}
INSTALL()
{
mkdir $appsDir
cp build/src/openboardview/openboardview $appsDir/OpenBoardView
local APP_SIGNATURE="application/x-vnd.openboardview"
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
local MINOR="`echo "$portVersion" | cut -d. -f3`"
local LONG_INFO="$SUMMARY"
sed \
-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
-e "s|@MAJOR@|$MAJOR|" \
-e "s|@MIDDLE@|$MIDDLE|" \
-e "s|@MINOR@|$MINOR|" \
-e "s|@LONG_INFO@|$LONG_INFO|" \
$portDir/additional-files/openboardview.rdef.in > $sourceDir/openboardview.rdef
addResourcesToBinaries $sourceDir/openboardview.rdef $appsDir/OpenBoardView
addAppDeskbarSymlink $appsDir/OpenBoardView
}

View File

@@ -0,0 +1,38 @@
From 39f8d902303ec6bcdccf2f06ebf836f48ee0f880 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Thu, 1 Jul 2021 19:32:05 +1000
Subject: Fixes for Haiku
diff --git a/backends/imgui_impl_opengl2.cpp b/backends/imgui_impl_opengl2.cpp
index e56e87d..068b2fa 100644
--- a/backends/imgui_impl_opengl2.cpp
+++ b/backends/imgui_impl_opengl2.cpp
@@ -47,9 +47,9 @@
#endif
#if defined(__APPLE__)
#define GL_SILENCE_DEPRECATION
-#include <OpenGL/gl.h>
+#include <glad/glad.h>
#else
-#include <GL/gl.h>
+#include <glad/glad.h>
#endif
// OpenGL Data
diff --git a/backends/imgui_impl_sdl.cpp b/backends/imgui_impl_sdl.cpp
index bf273ac..77f8caa 100644
--- a/backends/imgui_impl_sdl.cpp
+++ b/backends/imgui_impl_sdl.cpp
@@ -251,7 +251,7 @@ static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
io.MouseDown[2] = g_MousePressed[2] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;
-#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE && !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !(defined(__APPLE__) && TARGET_OS_IOS)
+#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE && !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(defined(__APPLE__) && TARGET_OS_IOS)
SDL_Window* focused_window = SDL_GetKeyboardFocus();
if (g_Window == focused_window)
{
--
2.30.2

View File

@@ -0,0 +1,152 @@
From ec9e8290603dbc170ce03d32932abe700d907960 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Thu, 1 Jul 2021 19:32:34 +1000
Subject: Fixes for Haiku
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 301f933..23db76b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -72,6 +72,10 @@ if(NOT TARGET SDL2::SDL2)
INTERFACE_INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIRS})
endif()
+if(HAIKU)
+ include_directories(${SDL2_INCLUDE_DIR})
+endif()
+
## imgui ##
# note: in the future there may be integrated CMake support into imgui
# see: https://github.com/ocornut/imgui/pull/1713
@@ -127,7 +131,7 @@ target_link_libraries(imgui
)
else()
target_link_libraries(imgui
- SDL2::SDL2
+ SDL2
)
endif()
diff --git a/src/openboardview/CMakeLists.txt b/src/openboardview/CMakeLists.txt
index 44d172a..b71fdc0 100644
--- a/src/openboardview/CMakeLists.txt
+++ b/src/openboardview/CMakeLists.txt
@@ -28,6 +28,7 @@ find_package(PkgConfig REQUIRED)
add_definitions(-DENABLE_FONTCONFIG)
endif()
+ if(NOT HAIKU)
pkg_search_module(GTK REQUIRED gtk+-3.0 gtk+-2.0) # gtk2 fallback if gtk3 not found
if(GTK_FOUND)
message(STATUS "Found GTK version ${GTK_VERSION}")
@@ -37,6 +38,7 @@ find_package(PkgConfig REQUIRED)
else()
message(WARNING "GTK not found, file picker will be unavailable.")
endif()
+ endif()
endif(APPLE)
endif()
@@ -150,12 +152,23 @@ target_link_libraries(${PROJECT_NAME_LOWER}
)
else()
target_link_libraries(${PROJECT_NAME_LOWER}
- SDL2::SDL2
+ SDL2
)
endif()
+if(NOT HAIKU)
target_link_libraries(${PROJECT_NAME_LOWER}
SDL2::SDL2main
)
+endif()
+
+if(HAIKU)
+target_link_libraries(${PROJECT_NAME_LOWER}
+ be tracker
+)
+include_directories(
+ ${SDL2_INCLUDE_DIR}
+)
+endif(HAIKU)
install(TARGETS
${PROJECT_NAME_LOWER}
diff --git a/src/openboardview/main_opengl.cpp b/src/openboardview/main_opengl.cpp
index f298722..9872af6 100644
--- a/src/openboardview/main_opengl.cpp
+++ b/src/openboardview/main_opengl.cpp
@@ -301,7 +301,7 @@ int main(int argc, char **argv) {
// Font selection
std::deque<std::string> fontList(
- {"Liberation Sans", "DejaVu Sans", "Arial", "Helvetica", ""}); // Empty string = use system default font
+ {"Noto Sans", "Liberation Sans", "DejaVu Sans", "Arial", "Helvetica", ""}); // Empty string = use system default font
std::string customFont(app.obvconfig.ParseStr("fontName", ""));
if (!customFont.empty()) fontList.push_front(customFont);
diff --git a/src/openboardview/unix.cpp b/src/openboardview/unix.cpp
index bc25523..17b91e7 100644
--- a/src/openboardview/unix.cpp
+++ b/src/openboardview/unix.cpp
@@ -17,6 +17,13 @@
#include <fontconfig/fontconfig.h>
#endif
+#ifdef __HAIKU__
+#include <Path.h>
+#include <Entry.h>
+#include <FilePanel.h>
+#include <FindDirectory.h>
+#endif
+
#ifdef ENABLE_GTK
#define declareFunc(x) decltype(x) *x
#define loadFunc(x) x = reinterpret_cast<decltype(x)>(SDL_LoadFunction(lib, #x));
@@ -148,6 +155,21 @@ const filesystem::path show_file_picker(bool filterBoards) {
return path;
}
+#elif defined(__HAIKU__)
+const filesystem::path show_file_picker(bool filterBoards) {
+ BFilePanel openPanel(B_OPEN_PANEL, NULL, NULL, 0, false, NULL, NULL, true, true);
+ openPanel.Show();
+ while (openPanel.IsShowing())
+ SDL_Delay(100);
+
+ entry_ref ref;
+ openPanel.Rewind();
+ if (openPanel.GetNextSelectedRef(&ref) == B_OK) {
+ BPath path(&ref);
+ return std::string(path.Path());
+ }
+ return std::string();
+}
#elif !defined(__APPLE__)
const filesystem::path show_file_picker(bool filterBoards) { // dummy function when not building for OS X and GTK not available
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Cannot show open file dialog: not built in.");
@@ -221,7 +243,11 @@ bool create_dirs(const std::string &path) {
const std::string get_user_dir(const UserDir userdir) {
std::string path;
std::string envVar;
-
+#ifdef __HAIKU__
+ char buffer[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
+ find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, buffer, sizeof(buffer));
+ path = std::string(buffer);
+#else
if (userdir == UserDir::Config)
envVar = get_env_var("XDG_CONFIG_HOME");
else if (userdir == UserDir::Data)
@@ -239,6 +265,7 @@ const std::string get_user_dir(const UserDir userdir) {
} else {
path += std::string(envVar);
}
+#endif
if (!path.empty()) {
path += "/" OBV_NAME "/";
if (create_dirs(path)) return path; // Check if dir already exists and create it otherwise
--
2.30.2