From patchwork Sat Aug 26 18:50:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Faiz X-Patchwork-Id: 53232 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id AC90727BBEA; Sat, 26 Aug 2023 19:51:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 089A427BBE2 for ; Sat, 26 Aug 2023 19:51:10 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZyN8-0002Ro-Ub; Sat, 26 Aug 2023 14:50:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZyN6-0002Rf-Jg for guix-patches@gnu.org; Sat, 26 Aug 2023 14:50:57 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qZyN6-0006OK-BN for guix-patches@gnu.org; Sat, 26 Aug 2023 14:50:56 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qZyNB-0007S8-KJ for guix-patches@gnu.org; Sat, 26 Aug 2023 14:51:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65553] [PATCH 1/6] gnu: Add arrayfire-glad. References: In-Reply-To: Resent-From: Adam Faiz Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 26 Aug 2023 18:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65553 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65553@debbugs.gnu.org Received: via spool by 65553-submit@debbugs.gnu.org id=B65553.169307585128627 (code B ref 65553); Sat, 26 Aug 2023 18:51:01 +0000 Received: (at 65553) by debbugs.gnu.org; 26 Aug 2023 18:50:51 +0000 Received: from localhost ([127.0.0.1]:43403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZyN0-0007Rd-6Y for submit@debbugs.gnu.org; Sat, 26 Aug 2023 14:50:50 -0400 Received: from layka.disroot.org ([178.21.23.139]:53016) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZyMy-0007RV-CH for 65553@debbugs.gnu.org; Sat, 26 Aug 2023 14:50:49 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 6144541312 for <65553@debbugs.gnu.org>; Sat, 26 Aug 2023 20:50:42 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Bvi44GwjjpQW for <65553@debbugs.gnu.org>; Sat, 26 Aug 2023 20:50:40 +0200 (CEST) Message-ID: <3e855e76-45ce-bf7d-9ba5-bbe6a7e2072a@disroot.org> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1693075840; bh=ug08FLpnZrYGWJdBTifS2kGkXd4vgR1+PfMj1vJVBQQ=; h=Date:To:From:Subject; b=SrgemXZRgXTsf8jiM+ztX0Mo+tMf5jqQTmSGQGiOzrsErkyEyOS4TaoZqMo0iCQF/ T01as1RrRdBWE25UzQGKH8HgeL7HrlIp5XIK/ThtLkG9EOFws9nVbPpA7NeCEeDMCU uVfvFjIYTcfOLluHo1fKLEDq8hzo1PZtkZOdsSVu/UT0Uyk43isycwi6b+wNbqiJs/ zxXOLSQKnFsV1vx62qg0Vd1LN4Ao4+JRBM29i6r/jRRqKqgNwR0WPGNjdYgjWcccZH JU/QMid19QrPC/U1fwEqXBbrNM9tirVOhK1O+l8WUT066XGHg7Smhmrj9rH1Y14i9Z naH7tociQjxjg== Date: Sun, 27 Aug 2023 02:50:37 +0800 MIME-Version: 1.0 Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Adam Faiz X-ACL-Warn: , Adam Faiz via Guix-patches X-Patchwork-Original-From: Adam Faiz via Guix-patches via From: Adam Faiz Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From 668b7978a7dd2e6daece5209621601575eaad900 Mon Sep 17 00:00:00 2001 Message-ID: <668b7978a7dd2e6daece5209621601575eaad900.1693075221.git.adam.faiz@disroot.org> In-Reply-To: References: From: AwesomeAdam54321 Date: Sun, 27 Aug 2023 01:59:48 +0800 Subject: [PATCH 1/6] gnu: Add arrayfire-glad. * gnu/packages/patches/arrayfire-glad-add-packaging-support.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it here. * gnu/packages/gl.scm (arrayfire-glad): New variable. --- gnu/local.mk | 1 + gnu/packages/gl.scm | 42 +++++ ...arrayfire-glad-add-packaging-support.patch | 145 ++++++++++++++++++ 3 files changed, 188 insertions(+) create mode 100644 gnu/packages/patches/arrayfire-glad-add-packaging-support.patch diff --git a/gnu/local.mk b/gnu/local.mk index adda02d410..3c1f7665ff 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -902,6 +902,7 @@ dist_patch_DATA = \ %D%/packages/patches/akonadi-not-relocatable.patch \ %D%/packages/patches/akonadi-timestamps.patch \ %D%/packages/patches/allegro-mesa-18.2.5-and-later.patch \ + %D%/packages/patches/arrayfire-glad-add-packaging-support.patch \ %D%/packages/patches/ibus-anthy-fix-tests.patch \ %D%/packages/patches/ibus-table-paths.patch \ %D%/packages/patches/anki-mpv-args.patch \ diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm index b53b42a9ba..7476aba06f 100644 --- a/gnu/packages/gl.scm +++ b/gnu/packages/gl.scm @@ -108,6 +108,48 @@ (define-public glu as ASCII text.") (license (license:x11-style "http://directory.fsf.org/wiki/License:SGIFreeBv2")))) +(define-public arrayfire-glad + (let ((commit "ef8c5508e72456b714820c98e034d9a55b970650") + (revision "0")) + (package + (name "arrayfire-glad") + (version (git-version "0" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/arrayfire/glad.git") + (commit commit))) + (sha256 + (base32 "0yln2mrymhb6ni6gb1vc0vrzbrkzmsxk7wyvbgqlv16bnmrmxmdv")) + (patches (search-patches "arrayfire-glad-add-packaging-support.patch")) + (modules '((guix build utils))) + (snippet + #~(begin + (substitute* "CMakeLists.txt" + (("OBJECT") "SHARED") + (("af_glad_obj_lib") "glad") + (("target_include_directories.*)\n" all) + (string-append all "\n\n" + "configure_file(glad.pc.in glad.pc @ONLY)\n" + "install(DIRECTORY include/\n" + "DESTINATION include/)\n" + "\n\n" + "install(TARGETS glad\n" + "DESTINATION lib/)\n" + "install(FILES ${CMAKE_CURRENT_BINARY_DIR}/glad.pc\n" + "DESTINATION lib/pkgconfig/)\n" + "install(FILES gladConfig.cmake\n" + "DESTINATION lib/cmake/glad/)\n"))))) + (file-name (git-file-name name version)))) + (build-system cmake-build-system) + (arguments + (list #:tests? #f)) ; no tests + (home-page "https://github.com/arrayfire/glad") + (synopsis "OpenGL(3.3) Loader Library") + (description "OpenGL(3.3) Loader Library, a dependency of ArrayFire.") + (license license:bsd-3)))) + (define-public freeglut (package (name "freeglut") diff --git a/gnu/packages/patches/arrayfire-glad-add-packaging-support.patch b/gnu/packages/patches/arrayfire-glad-add-packaging-support.patch new file mode 100644 index 0000000000..a7591eee7b --- /dev/null +++ b/gnu/packages/patches/arrayfire-glad-add-packaging-support.patch @@ -0,0 +1,145 @@ +From ceaa23fd1834ad56fe5f74d544b650be9a55360b Mon Sep 17 00:00:00 2001 +From: AwesomeAdam54321 +Date: Sat, 26 Aug 2023 16:38:13 +0800 +Subject: [PATCH] glad: Add package configuration files. + +* glad.pc.in: Add pkg-config file. +* gladConfig.cmake: Add CMake package file for detection by external packages. +--- + glad.pc.in | 11 +++++ + gladConfig.cmake | 104 +++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 115 insertions(+) + create mode 100644 glad.pc + create mode 100644 gladConfig.cmake + +diff --git a/glad.pc.in b/glad.pc.in +new file mode 100644 +index 0000000..5c29fcd +--- /dev/null ++++ b/glad.pc.in +@@ -0,0 +1,11 @@ ++prefix=@CMAKE_INSTALL_PREFIX@ # this defines a variable ++exec_prefix=${prefix} # defining another variable with a substitution ++libdir=${exec_prefix}/lib ++includedir=${prefix}/include ++ ++Name: glad ++Description: OpenGL(3.3) Loader Library ++Version: 0 ++URL: https://github.com/arrayfire/glad ++Libs: -L${libdir} -lglad ++Cflags: -I${includedir}/glad +\ No newline at end of file +diff --git a/gladConfig.cmake b/gladConfig.cmake +new file mode 100644 +index 0000000..1213d3e +--- /dev/null ++++ b/gladConfig.cmake +@@ -0,0 +1,104 @@ ++# Finds the glad libraries ++# ++# Sets the following variables: ++# glad_FOUND ++# glad_INCLUDE_DIR ++# glad_DYNAMIC_LIBRARY ++# glad_STATIC_LIBRARY ++# ++# Usage: ++# find_package(glad) ++# if (glad_FOUND) ++# target_link_libraries(mylib PRIVATE glad::glad) ++# endif (glad_FOUND) ++# ++# OR if you want to link against the static library: ++# ++# find_package(glad) ++# if (glad_FOUND) ++# target_link_libraries(mylib PRIVATE glad::glad_STATIC) ++# endif (glad_FOUND) ++# ++# NOTE: You do not need to include the glad include directories since they ++# will be included as part of the target_link_libraries command ++ ++set(PX ${CMAKE_STATIC_LIBRARY_PREFIX}) ++set(SX ${CMAKE_STATIC_LIBRARY_SUFFIX}) ++ ++# use pkg-config to get the directories and then use these values ++# in the find_path() and find_library() calls ++if (NOT WIN32) ++ find_package(PkgConfig) ++ pkg_check_modules(gladPkg REQUIRED glad) ++endif (NOT WIN32) ++ ++find_path(glad_INCLUDE_DIR ++ NAMES glad.h ++ PATHS ++ /usr/include ++ /usr/local/include ++ /sw/include ++ /opt/local/include ++ HINTS ++ ${gladPkg_INCLUDE_DIRS} # Generated by pkg-config ++ ) ++ ++find_library(glad_DYNAMIC_LIBRARY ++ NAMES glad fontconfig ${gladPkg_LIBRARY} ++ PATHS ++ /usr/local ++ /usr/X11 ++ /usr ++ /sw ++ /opt/local ++ /usr/lib/x86_64-linux-gnu ++ HINTS ++ ${gladPkg_LIBRARY_DIRS} # Generated by pkg-config ++ PATH_SUFFIXES ++ lib64 ++ lib ++ ) ++ ++find_library(glad_STATIC_LIBRARY ++ NAMES ${PX}fontconfig${SX} ${PX}glad${SX} ${PX}${gladPkg_LIBRARY}${SX} ++ PATHS ++ /usr/local ++ /usr/X11 ++ /usr ++ /sw ++ /opt/local ++ /usr/lib/x86_64-linux-gnu ++ HINTS ++ ${gladPkg_LIBRARY_DIRS} # Generated by pkg-config ++ PATH_SUFFIXES ++ lib64 ++ lib ++ ) ++ ++mark_as_advanced( ++ glad_INCLUDE_DIR ++ glad_DYNAMIC_LIBRARY ++ glad_STATIC_LIBRARY ++ ) ++ ++include(FindPackageHandleStandardArgs) ++ ++find_package_handle_standard_args(glad ++ REQUIRED_VARS glad_DYNAMIC_LIBRARY glad_INCLUDE_DIR ++ ) ++ ++if (glad_FOUND AND NOT TARGET glad::glad) ++ add_library(glad::glad UNKNOWN IMPORTED) ++ set_target_properties(glad::glad PROPERTIES ++ IMPORTED_LINK_INTERFACE_LANGUAGE "C" ++ IMPORTED_LOCATION ${glad_DYNAMIC_LIBRARY} ++ INTERFACE_INCLUDE_DIRECTORIES ${glad_INCLUDE_DIR}) ++ ++ if (glad_STATIC_LIBRARY) ++ add_library(glad::glad_STATIC UNKNOWN IMPORTED) ++ set_target_properties(glad::glad_STATIC PROPERTIES ++ IMPORTED_LINK_INTERFACE_LANGUAGE "C" ++ IMPORTED_LOCATION "${glad_STATIC_LIBRARY}" ++ INTERFACE_INCLUDE_DIRECTORIES "${glad_INCLUDE_DIR}") ++ endif (glad_STATIC_LIBRARY) ++endif () +-- +2.41.0 +