From 810d7cbe683b2b441e1b864edad6b51a032fa6ab Mon Sep 17 00:00:00 2001 From: Pedro Maciel Xavier <31925649+pedromxavier@users.noreply.github.com> Date: Mon, 6 Oct 2025 18:04:23 -0300 Subject: [PATCH 1/6] Create build_tarballs.jl --- G/GridLABD/build_tarballs.jl | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 G/GridLABD/build_tarballs.jl diff --git a/G/GridLABD/build_tarballs.jl b/G/GridLABD/build_tarballs.jl new file mode 100644 index 00000000000..4bab45eb0d9 --- /dev/null +++ b/G/GridLABD/build_tarballs.jl @@ -0,0 +1,45 @@ +# Note that this script can accept some limited command-line arguments, run +# `julia build_tarballs.jl --help` to see a usage message. +using BinaryBuilder, Pkg + +name = "GridLABD" +version = v"5.3.0" + +# Collection of sources required to complete build +sources = [ + GitSource("https://github.com/gridlab-d/gridlab-d.git", "1b2e463d3c149e999a2c5f04213477f545e01dc6") +] + +# Bash recipe for building across all platforms +script = raw""" +cd $WORKSPACE/srcdir/gridlab-d/ + +git submodule update --init + +mkdir cmake-build +cd cmake-build/ + +cmake -S ${WORKSPACE}/srcdir/gridlab-d -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_BUILD_TYPE=Release +cmake --build . -j${nproc} --target install + +mkdir ${prefix}/share/licenses +cp ${WORKSPACE}/srcdir/gridlab-d/LICENSE ${prefix}/share/licenses/ + +exit +""" + +# These are the platforms we will build for by default, unless further +# platforms are passed in on the command line +platforms = supported_platforms() + +# The products that we will ensure are always built +products = [ + ExecutableProduct("gridlabd", :gridlabd) +] + +# Dependencies that must be installed before this package can be built +dependencies = Dependency[ +] + +# Build the tarballs, and possibly a `build.jl` as well. +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version = v"9.1.0") From 569a07a776a835e6308c2d4e25f4f75232fe463f Mon Sep 17 00:00:00 2001 From: Pedro Maciel Xavier <31925649+pedromxavier@users.noreply.github.com> Date: Mon, 6 Oct 2025 17:59:44 -0400 Subject: [PATCH 2/6] Update G/GridLABD/build_tarballs.jl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mosè Giordano <765740+giordano@users.noreply.github.com> --- G/GridLABD/build_tarballs.jl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/G/GridLABD/build_tarballs.jl b/G/GridLABD/build_tarballs.jl index 4bab45eb0d9..9b6afb9d3c6 100644 --- a/G/GridLABD/build_tarballs.jl +++ b/G/GridLABD/build_tarballs.jl @@ -22,10 +22,7 @@ cd cmake-build/ cmake -S ${WORKSPACE}/srcdir/gridlab-d -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_BUILD_TYPE=Release cmake --build . -j${nproc} --target install -mkdir ${prefix}/share/licenses -cp ${WORKSPACE}/srcdir/gridlab-d/LICENSE ${prefix}/share/licenses/ - -exit +install_license ${WORKSPACE}/srcdir/gridlab-d/LICENSE """ # These are the platforms we will build for by default, unless further From 21ced9e6e214ccb88a75c21e10467b730fcd8730 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Xavier Date: Tue, 7 Oct 2025 18:40:36 -0400 Subject: [PATCH 3/6] Add Patch --- G/GridLABD/build_tarballs.jl | 30 ++++++++++++++++--- G/GridLABD/bundled/patches/apple-soname.patch | 28 +++++++++++++++++ 2 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 G/GridLABD/bundled/patches/apple-soname.patch diff --git a/G/GridLABD/build_tarballs.jl b/G/GridLABD/build_tarballs.jl index 9b6afb9d3c6..8f0506dd07a 100644 --- a/G/GridLABD/build_tarballs.jl +++ b/G/GridLABD/build_tarballs.jl @@ -7,13 +7,16 @@ version = v"5.3.0" # Collection of sources required to complete build sources = [ - GitSource("https://github.com/gridlab-d/gridlab-d.git", "1b2e463d3c149e999a2c5f04213477f545e01dc6") + GitSource("https://github.com/gridlab-d/gridlab-d.git", "1b2e463d3c149e999a2c5f04213477f545e01dc6"), + DirectorySource("./bundled"), ] # Bash recipe for building across all platforms script = raw""" cd $WORKSPACE/srcdir/gridlab-d/ +atomic_patch ../patches/apple-soname.patch + git submodule update --init mkdir cmake-build @@ -27,7 +30,27 @@ install_license ${WORKSPACE}/srcdir/gridlab-d/LICENSE # These are the platforms we will build for by default, unless further # platforms are passed in on the command line -platforms = supported_platforms() +# platforms = supported_platforms() +platforms = [ + # Platform("i686", "Linux"; libc="glibc"), + # Platform("x86_64", "Linux"; libc="glibc"), + # Platform("aarch64", "Linux"; libc="glibc"), + # Platform("armv6l", "Linux"; call_abi="eabihf", libc="glibc"), + # Platform("armv7l", "Linux"; call_abi="eabihf", libc="glibc"), + # Platform("powerpc64le", "Linux"; libc="glibc"), + # Platform("riscv64", "Linux"; libc="glibc"), + Platform("i686", "Linux"; libc="musl"), + Platform("x86_64", "Linux"; libc="musl"), + Platform("aarch64", "Linux"; libc="musl"), + Platform("armv6l", "Linux"; call_abi="eabihf", libc="musl"), + Platform("armv7l", "Linux"; call_abi="eabihf", libc="musl"), + Platform("x86_64", "macOS"), + Platform("aarch64", "macOS"), + Platform("x86_64", "FreeBSD"), + Platform("aarch64", "FreeBSD"), + Platform("i686", "Windows"), + Platform("x86_64", "Windows"), +] # The products that we will ensure are always built products = [ @@ -35,8 +58,7 @@ products = [ ] # Dependencies that must be installed before this package can be built -dependencies = Dependency[ -] +dependencies = Dependency[] # Build the tarballs, and possibly a `build.jl` as well. build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version = v"9.1.0") diff --git a/G/GridLABD/bundled/patches/apple-soname.patch b/G/GridLABD/bundled/patches/apple-soname.patch new file mode 100644 index 00000000000..838d0aef033 --- /dev/null +++ b/G/GridLABD/bundled/patches/apple-soname.patch @@ -0,0 +1,28 @@ +--- CMakeLists.txt 2025-10-07 18:13:40 ++++ CMakeLists.txt 2025-10-07 18:15:42 +@@ -109,6 +109,13 @@ + + # Compiler/Linker flags for all build types + add_compile_options(${FORCE_ERROR} ${DISABLED_OPTIMIZATIONS}) ++ ++# Detect MacOSX ++if (APPLE OR "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") ++ set(MACOSX TRUE) ++else () ++ set(MACOSX FALSE) ++endif () + + ## Set up platform specific library linking and platform identification + if (WIN32 OR MSYS OR MINGW OR CYGWIN) +@@ -127,9 +134,10 @@ + add_compile_options(-static-libgcc -static-libstdc++ -static) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++ -static") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++ -static") +-elseif (APPLE) ++elseif (MACOSX) + set(OS_SPECIFIC_LIBRARIES ${CMAKE_DL_LIBS}) + set(FOUND_MACOS yes CACHE INTERNAL "Tell script generator we're MacOS") ++ string(REPLACE "-soname" "-install_name" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") + else () + set(OS_SPECIFIC_LIBRARIES ${CMAKE_DL_LIBS}) + endif () From f353fc2924e5424c3bd83898d6599ad05038aa30 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Xavier <31925649+pedromxavier@users.noreply.github.com> Date: Tue, 7 Oct 2025 18:44:23 -0400 Subject: [PATCH 4/6] Restore working Platforms [no ci] --- G/GridLABD/build_tarballs.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/G/GridLABD/build_tarballs.jl b/G/GridLABD/build_tarballs.jl index 8f0506dd07a..288ee8c3ec5 100644 --- a/G/GridLABD/build_tarballs.jl +++ b/G/GridLABD/build_tarballs.jl @@ -32,13 +32,13 @@ install_license ${WORKSPACE}/srcdir/gridlab-d/LICENSE # platforms are passed in on the command line # platforms = supported_platforms() platforms = [ - # Platform("i686", "Linux"; libc="glibc"), - # Platform("x86_64", "Linux"; libc="glibc"), - # Platform("aarch64", "Linux"; libc="glibc"), - # Platform("armv6l", "Linux"; call_abi="eabihf", libc="glibc"), - # Platform("armv7l", "Linux"; call_abi="eabihf", libc="glibc"), - # Platform("powerpc64le", "Linux"; libc="glibc"), - # Platform("riscv64", "Linux"; libc="glibc"), + Platform("i686", "Linux"; libc="glibc"), + Platform("x86_64", "Linux"; libc="glibc"), + Platform("aarch64", "Linux"; libc="glibc"), + Platform("armv6l", "Linux"; call_abi="eabihf", libc="glibc"), + Platform("armv7l", "Linux"; call_abi="eabihf", libc="glibc"), + Platform("powerpc64le", "Linux"; libc="glibc"), + Platform("riscv64", "Linux"; libc="glibc"), Platform("i686", "Linux"; libc="musl"), Platform("x86_64", "Linux"; libc="musl"), Platform("aarch64", "Linux"; libc="musl"), From 71a8828cfce3be510c8d155837414376c2f2bf15 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Xavier Date: Sun, 12 Oct 2025 09:47:01 -0400 Subject: [PATCH 5/6] Add CMake Flag for Apple Systems --- G/GridLABD/build_tarballs.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/G/GridLABD/build_tarballs.jl b/G/GridLABD/build_tarballs.jl index 8f0506dd07a..6891fe0e7c3 100644 --- a/G/GridLABD/build_tarballs.jl +++ b/G/GridLABD/build_tarballs.jl @@ -22,7 +22,12 @@ git submodule update --init mkdir cmake-build cd cmake-build/ -cmake -S ${WORKSPACE}/srcdir/gridlab-d -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_BUILD_TYPE=Release +if [[ ${target} == *apple* ]]; then + cmake -S ${WORKSPACE}/srcdir/gridlab-d -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Darwin +else + cmake -S ${WORKSPACE}/srcdir/gridlab-d -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_BUILD_TYPE=Release +fi + cmake --build . -j${nproc} --target install install_license ${WORKSPACE}/srcdir/gridlab-d/LICENSE From adfd886bbe598ee1a128327c45e907d3a4b9be27 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Xavier Date: Sun, 12 Oct 2025 12:07:17 -0400 Subject: [PATCH 6/6] Add Patches --- G/GridLABD/build_tarballs.jl | 51 ++++++++++--------- G/GridLABD/bundled/patches/apple-soname.patch | 4 +- .../bundled/patches/gldcore-exec-wait.patch | 10 ++++ .../patches/gldcore-platform-unistd.patch | 11 ++++ 4 files changed, 49 insertions(+), 27 deletions(-) create mode 100644 G/GridLABD/bundled/patches/gldcore-exec-wait.patch create mode 100644 G/GridLABD/bundled/patches/gldcore-platform-unistd.patch diff --git a/G/GridLABD/build_tarballs.jl b/G/GridLABD/build_tarballs.jl index e27d389c932..ecf73515aeb 100644 --- a/G/GridLABD/build_tarballs.jl +++ b/G/GridLABD/build_tarballs.jl @@ -15,12 +15,13 @@ sources = [ script = raw""" cd $WORKSPACE/srcdir/gridlab-d/ -atomic_patch ../patches/apple-soname.patch - git submodule update --init -mkdir cmake-build -cd cmake-build/ +atomic_patch ../patches/apple-soname.patch +atomic_patch -p0 ../patches/gldcore-platform-unistd.patch +atomic_patch -p0 ../patches/gldcore-exec-wait.patch + +mkdir cmake-build && cd cmake-build if [[ ${target} == *apple* ]]; then cmake -S ${WORKSPACE}/srcdir/gridlab-d -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Darwin @@ -35,27 +36,27 @@ install_license ${WORKSPACE}/srcdir/gridlab-d/LICENSE # These are the platforms we will build for by default, unless further # platforms are passed in on the command line -# platforms = supported_platforms() -platforms = [ - Platform("i686", "Linux"; libc="glibc"), - Platform("x86_64", "Linux"; libc="glibc"), - Platform("aarch64", "Linux"; libc="glibc"), - Platform("armv6l", "Linux"; call_abi="eabihf", libc="glibc"), - Platform("armv7l", "Linux"; call_abi="eabihf", libc="glibc"), - Platform("powerpc64le", "Linux"; libc="glibc"), - Platform("riscv64", "Linux"; libc="glibc"), - Platform("i686", "Linux"; libc="musl"), - Platform("x86_64", "Linux"; libc="musl"), - Platform("aarch64", "Linux"; libc="musl"), - Platform("armv6l", "Linux"; call_abi="eabihf", libc="musl"), - Platform("armv7l", "Linux"; call_abi="eabihf", libc="musl"), - Platform("x86_64", "macOS"), - Platform("aarch64", "macOS"), - Platform("x86_64", "FreeBSD"), - Platform("aarch64", "FreeBSD"), - Platform("i686", "Windows"), - Platform("x86_64", "Windows"), -] +platforms = supported_platforms() +# platforms = [ +# # Platform("i686", "Linux"; libc="glibc"), +# # Platform("x86_64", "Linux"; libc="glibc"), +# # Platform("aarch64", "Linux"; libc="glibc"), +# # Platform("armv6l", "Linux"; call_abi="eabihf", libc="glibc"), +# # Platform("armv7l", "Linux"; call_abi="eabihf", libc="glibc"), +# # Platform("powerpc64le", "Linux"; libc="glibc"), +# # Platform("riscv64", "Linux"; libc="glibc"), +# Platform("i686", "Linux"; libc="musl"), +# Platform("x86_64", "Linux"; libc="musl"), +# Platform("aarch64", "Linux"; libc="musl"), +# Platform("armv6l", "Linux"; call_abi="eabihf", libc="musl"), +# Platform("armv7l", "Linux"; call_abi="eabihf", libc="musl"), +# Platform("x86_64", "macOS"), +# # Platform("aarch64", "macOS"), +# # Platform("x86_64", "FreeBSD"), +# # Platform("aarch64", "FreeBSD"), +# Platform("i686", "Windows"), +# Platform("x86_64", "Windows"), +# ] # The products that we will ensure are always built products = [ diff --git a/G/GridLABD/bundled/patches/apple-soname.patch b/G/GridLABD/bundled/patches/apple-soname.patch index 838d0aef033..ba15fa66845 100644 --- a/G/GridLABD/bundled/patches/apple-soname.patch +++ b/G/GridLABD/bundled/patches/apple-soname.patch @@ -1,5 +1,5 @@ ---- CMakeLists.txt 2025-10-07 18:13:40 -+++ CMakeLists.txt 2025-10-07 18:15:42 +--- CMakeLists.txt ++++ CMakeLists.txt @@ -109,6 +109,13 @@ # Compiler/Linker flags for all build types diff --git a/G/GridLABD/bundled/patches/gldcore-exec-wait.patch b/G/GridLABD/bundled/patches/gldcore-exec-wait.patch new file mode 100644 index 00000000000..2691728638d --- /dev/null +++ b/G/GridLABD/bundled/patches/gldcore-exec-wait.patch @@ -0,0 +1,10 @@ +--- gldcore/exec.cpp ++++ gldcore/exec.cpp +@@ -96,6 +96,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/G/GridLABD/bundled/patches/gldcore-platform-unistd.patch b/G/GridLABD/bundled/patches/gldcore-platform-unistd.patch new file mode 100644 index 00000000000..36bc4063871 --- /dev/null +++ b/G/GridLABD/bundled/patches/gldcore-platform-unistd.patch @@ -0,0 +1,11 @@ +--- gldcore/platform.h ++++ gldcore/platform.h +@@ -30,7 +30,7 @@ + #else + #define __WORDSIZE__ __WORDSIZE + #endif +- #include ++ #include + #if __WORDSIZE__ == 64 + #define X64 + #define int64 long long /**< standard 64-bit integers on 64-bit machines */