Skip to content

Commit

Permalink
Merge pull request #129 from roblillack/add-support-for-openbsd
Browse files Browse the repository at this point in the history
Add OpenBSD (amd64 and arm64) support
  • Loading branch information
pwiecz authored May 25, 2024
2 parents 990b442 + 3a2c0c6 commit 5313f8a
Show file tree
Hide file tree
Showing 19 changed files with 210 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cgo_openbsd_amd64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build openbsd && amd64

package fltk

// #cgo openbsd,amd64 CXXFLAGS: -std=c++11
// #cgo openbsd,amd64 CPPFLAGS: -I${SRCDIR}/lib/openbsd/amd64 -I/usr/X11R6/include -I${SRCDIR}/include -I${SRCDIR}/include/FL/images -I${SRCDIR}/include/png -I${SRCDIR}/include/zlib -I${SRCDIR}/include/jpeg -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT
// #cgo openbsd,amd64 LDFLAGS: -L/usr/X11R6/lib ${SRCDIR}/lib/openbsd/amd64/libfltk_images.a ${SRCDIR}/lib/openbsd/amd64/libfltk_jpeg.a ${SRCDIR}/lib/openbsd/amd64/libfltk_png.a ${SRCDIR}/lib/openbsd/amd64/libfltk_z.a ${SRCDIR}/lib/openbsd/amd64/libfltk_gl.a -lGLU -lGL ${SRCDIR}/lib/openbsd/amd64/libfltk_forms.a ${SRCDIR}/lib/openbsd/amd64/libfltk.a -lm -lX11 -lXext -lpthread -lXinerama -lXfixes -lXcursor -lXft -lXrender -lm -lfontconfig
import "C"
8 changes: 8 additions & 0 deletions cgo_openbsd_arm64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build openbsd && arm64

package fltk

// #cgo openbsd,arm64 CXXFLAGS: -std=c++11
// #cgo openbsd,arm64 CPPFLAGS: -I${SRCDIR}/lib/openbsd/arm64 -I/usr/X11R6/include -I${SRCDIR}/include -I${SRCDIR}/include/FL/images -I${SRCDIR}/include/png -I${SRCDIR}/include/zlib -I${SRCDIR}/include/jpeg -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT
// #cgo openbsd,arm64 LDFLAGS: -L/usr/X11R6/lib ${SRCDIR}/lib/openbsd/arm64/libfltk_images.a ${SRCDIR}/lib/openbsd/arm64/libfltk_jpeg.a ${SRCDIR}/lib/openbsd/arm64/libfltk_png.a ${SRCDIR}/lib/openbsd/arm64/libfltk_z.a ${SRCDIR}/lib/openbsd/arm64/libfltk_gl.a -lGLU -lGL ${SRCDIR}/lib/openbsd/arm64/libfltk_forms.a ${SRCDIR}/lib/openbsd/arm64/libfltk.a -lm -lX11 -lXext -lpthread -lXinerama -lXfixes -lXcursor -lXft -lXrender -lm -lfontconfig
import "C"
13 changes: 12 additions & 1 deletion fltk-build.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ func main() {
os.Exit(1)
}

cmakeBuildCmd := exec.Command("cmake", "--build", "build", "--parallel")
cmakeBuildArgs := []string{"--build", "build", "--parallel"}
if runtime.GOOS == "openbsd" {
cmakeBuildArgs = []string{"--build", "build"}
}

cmakeBuildCmd := exec.Command("cmake", cmakeBuildArgs...)
cmakeBuildCmd.Dir = "fltk_build"
cmakeBuildCmd.Stdout = os.Stdout
cmakeBuildCmd.Stderr = os.Stderr
Expand Down Expand Up @@ -219,6 +224,9 @@ func main() {
os.Exit(1)
}
fltkConfigCxxFlags := strings.ReplaceAll(string(cxxOutput), currentDir, "${SRCDIR}")
if runtime.GOOS == "openbsd" {
fltkConfigCxxFlags = "-I/usr/X11R6/include " + fltkConfigCxxFlags
}
fmt.Fprintf(cgoFile, "// #cgo %s,%s CPPFLAGS: -I${SRCDIR}/%s %s", runtime.GOOS, runtime.GOARCH, libdir, fltkConfigCxxFlags)
if fltkConfigCxxFlags[len(fltkConfigCxxFlags)-1] != '\n' {
fmt.Fprintln(cgoFile, "")
Expand All @@ -231,6 +239,9 @@ func main() {
os.Exit(1)
}
fltkConfigLdFlags := strings.ReplaceAll(string(ldOutput), currentDir, "${SRCDIR}")
if runtime.GOOS == "openbsd" {
fltkConfigLdFlags = "-L/usr/X11R6/lib " + fltkConfigLdFlags
}
fmt.Fprintf(cgoFile, "// #cgo %s,%s LDFLAGS: %s", runtime.GOOS, runtime.GOARCH, fltkConfigLdFlags)
if fltkConfigLdFlags[len(fltkConfigLdFlags)-1] != '\n' {
fmt.Fprintln(cgoFile, "")
Expand Down
91 changes: 91 additions & 0 deletions lib/openbsd/amd64/FL/fl_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/* FL/fl_config.h. Generated from fl_config.cmake.in by CMake. */
/*
* Build configuration file for the Fast Light Tool Kit (FLTK).
*
* Copyright 1998-2021 by Bill Spitzak and others.
*
* This library is free software. Distribution and use rights are outlined in
* the file "COPYING" which should have been included with this file. If this
* file is missing or damaged, see the license at:
*
* https://www.fltk.org/COPYING.php
*
* Please see the following page on how to report bugs and issues:
*
* https://www.fltk.org/bugs.php
*/

#ifndef _FL_fl_config_h_
#define _FL_fl_config_h_

/*
* FL_ABI_VERSION (ABI version)
*
* define FL_ABI_VERSION: 1xxyy for 1.x.y (xx,yy with leading zero)
*/

/* #undef FL_ABI_VERSION */


/*
* FLTK_HAVE_CAIRO
*
* Do we have the Cairo library available?
*/

/* #undef FLTK_HAVE_CAIRO */


/*
* FLTK_HAVE_CAIROEXT
*
* Do we have the Cairo library available and want extended Cairo use in FLTK ?
* This implies to link cairo.lib in all FLTK based apps.
*/

/* #undef FLTK_HAVE_CAIROEXT */


/*
* FLTK_USE_X11
*
* Do we use X11 for the current platform?
*
*/

#define FLTK_USE_X11 1


/*
* FLTK_USE_CAIRO
*
* Do we use Cairo to draw to the display?
*
*/

/* #undef FLTK_USE_CAIRO */


/*
* FLTK_USE_WAYLAND
*
* Do we use Wayland for the current platform?
*
*/

/* #undef FLTK_USE_WAYLAND */


/*
* FLTK_USE_STD
*
* May we use std::string and std::vector for the current build?
*
* This is a build configuration option which allows FLTK to add some
* features based on std::string and std::vector in FLTK 1.4.x
*
*/

#define FLTK_USE_STD 0

#endif /* _FL_fl_config_h_ */
Binary file added lib/openbsd/amd64/libfltk.a
Binary file not shown.
Binary file added lib/openbsd/amd64/libfltk_forms.a
Binary file not shown.
Binary file added lib/openbsd/amd64/libfltk_gl.a
Binary file not shown.
Binary file added lib/openbsd/amd64/libfltk_images.a
Binary file not shown.
Binary file added lib/openbsd/amd64/libfltk_jpeg.a
Binary file not shown.
Binary file added lib/openbsd/amd64/libfltk_png.a
Binary file not shown.
Binary file added lib/openbsd/amd64/libfltk_z.a
Binary file not shown.
91 changes: 91 additions & 0 deletions lib/openbsd/arm64/FL/fl_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/* FL/fl_config.h. Generated from fl_config.cmake.in by CMake. */
/*
* Build configuration file for the Fast Light Tool Kit (FLTK).
*
* Copyright 1998-2021 by Bill Spitzak and others.
*
* This library is free software. Distribution and use rights are outlined in
* the file "COPYING" which should have been included with this file. If this
* file is missing or damaged, see the license at:
*
* https://www.fltk.org/COPYING.php
*
* Please see the following page on how to report bugs and issues:
*
* https://www.fltk.org/bugs.php
*/

#ifndef _FL_fl_config_h_
#define _FL_fl_config_h_

/*
* FL_ABI_VERSION (ABI version)
*
* define FL_ABI_VERSION: 1xxyy for 1.x.y (xx,yy with leading zero)
*/

/* #undef FL_ABI_VERSION */


/*
* FLTK_HAVE_CAIRO
*
* Do we have the Cairo library available?
*/

/* #undef FLTK_HAVE_CAIRO */


/*
* FLTK_HAVE_CAIROEXT
*
* Do we have the Cairo library available and want extended Cairo use in FLTK ?
* This implies to link cairo.lib in all FLTK based apps.
*/

/* #undef FLTK_HAVE_CAIROEXT */


/*
* FLTK_USE_X11
*
* Do we use X11 for the current platform?
*
*/

#define FLTK_USE_X11 1


/*
* FLTK_USE_CAIRO
*
* Do we use Cairo to draw to the display?
*
*/

/* #undef FLTK_USE_CAIRO */


/*
* FLTK_USE_WAYLAND
*
* Do we use Wayland for the current platform?
*
*/

/* #undef FLTK_USE_WAYLAND */


/*
* FLTK_USE_STD
*
* May we use std::string and std::vector for the current build?
*
* This is a build configuration option which allows FLTK to add some
* features based on std::string and std::vector in FLTK 1.4.x
*
*/

#define FLTK_USE_STD 0

#endif /* _FL_fl_config_h_ */
Binary file added lib/openbsd/arm64/libfltk.a
Binary file not shown.
Binary file added lib/openbsd/arm64/libfltk_forms.a
Binary file not shown.
Binary file added lib/openbsd/arm64/libfltk_gl.a
Binary file not shown.
Binary file added lib/openbsd/arm64/libfltk_images.a
Binary file not shown.
Binary file added lib/openbsd/arm64/libfltk_jpeg.a
Binary file not shown.
Binary file added lib/openbsd/arm64/libfltk_png.a
Binary file not shown.
Binary file added lib/openbsd/arm64/libfltk_z.a
Binary file not shown.

0 comments on commit 5313f8a

Please sign in to comment.