Skip to content

Commit

Permalink
[44_5] add_requires libgit2
Browse files Browse the repository at this point in the history
  • Loading branch information
da-liii authored Jan 9, 2024
1 parent 1e52004 commit ce0ea73
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 0 deletions.
11 changes: 11 additions & 0 deletions TeXmacs/tests/44_5.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

(define (test-libgit2-version)
(when (!= (libgit2-version) "1.7.1")
(display* "Result: " (libgit2-version))
(error "libgit2-version does not match"))
1)

(tm-define (test_44_5)
(let ((n (+ (test-libgit2-version))))
(display* "Total: " (object->string n) " tests.\n")
(display "Test suite of 44_5: ok\n")))
17 changes: 17 additions & 0 deletions src/Plugins/Git/git.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

/******************************************************************************
* MODULE : git.cpp
* DESCRIPTION: Interface with Git
* COPYRIGHT : (C) 2024 Darcy Shen
*******************************************************************************
* This software falls under the GNU general public license version 3 or later.
* It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
* in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
******************************************************************************/

#include "git.hpp"

string
libgit2_version() {
return string (LIBGIT2_VERSION);
}
19 changes: 19 additions & 0 deletions src/Plugins/Git/git.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

/******************************************************************************
* MODULE : git.hpp
* DESCRIPTION: Interface with Git
* COPYRIGHT : (C) 2024 Darcy Shen
*******************************************************************************
* This software falls under the GNU general public license version 3 or later.
* It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
* in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
******************************************************************************/

#ifndef PLUGIN_GIT_HPP
#define PLUGIN_GIT_HPP

#include "string.hpp"

string libgit2_version ();

#endif
26 changes: 26 additions & 0 deletions src/Scheme/Plugins/glue_git.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

-------------------------------------------------------------------------------
--
-- MODULE : glue_git.lua
-- DESCRIPTION : Generating glue on src/Plugins/Git
-- COPYRIGHT : (C) 2024 Darcy Shen
--
-- This software falls under the GNU general public license version 3 or later.
-- It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
-- in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.

function main()
return {
binding_object = "",
initializer_name = "initialize_glue_git",
glues = {
{
scm_name = "libgit2-version",
cpp_name = "libgit2_version",
ret_type = "string"
},
}
}
end


9 changes: 9 additions & 0 deletions src/Scheme/Plugins/init_glue_plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ supports_ghostscript () {
#include "glue_ghostscript.cpp"
#endif

#ifdef USE_PLUGIN_GIT
#include "Git/git.hpp"
#include "glue_git.cpp"
#endif

#include "glue_plugin.cpp"

void
Expand Down Expand Up @@ -135,4 +140,8 @@ initialize_glue_plugins () {
#ifdef USE_PLUGIN_PDF
initialize_glue_pdf ();
#endif

#ifdef USE_PLUGIN_GIT
initialize_glue_git ();
#endif
}
1 change: 1 addition & 0 deletions src/System/config.h.xmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ ${define USE_PLUGIN_TEX}
${define USE_PLUGIN_ISPELL}
${define USE_PLUGIN_SPARKLE}
${define USE_PLUGIN_HTML}
${define USE_PLUGIN_GIT}

${define QTPIPES}

Expand Down
1 change: 1 addition & 0 deletions src/System/tm_configure.hpp.xmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define TEXMACS_SOURCES ""
#define PDFHUMMUS_VERSION "${PDFHUMMUS_VERSION}"
#define LOLLY_VERSION "${LOLLY_VERSION}"
#define LIBGIT2_VERSION "${LIBGIT2_VERSION}"

#define BUILD_USER "${CONFIG_USER}"
#define BUILD_DATE "${VERSION_BUILD}"
Expand Down
5 changes: 5 additions & 0 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ local TM_CONFIGURE_VARS = {
tm_stable = "Texmacs-" .. STABLE_VERSION,
tm_stable_release = "Texmacs-" .. STABLE_VERSION .. "-" .. STABLE_RELEASE,
LOLLY_VERSION = LOLLY_VERSION,
LIBGIT2_VERSION = LIBGIT2_VERSION,
}


Expand Down Expand Up @@ -252,6 +253,7 @@ add_configfiles("src/System/config.h.xmake", {
USE_FONTCONFIG = is_plat("linux") and (not linuxos.name() == "uos"),
USE_STACK_TRACE = (not is_plat("mingw")) and (not is_plat("wasm")) and (not is_plat("windows")),
USE_PLUGIN_GS = not is_plat("wasm"),
USE_PLUGIN_GIT = not is_plat("wasm"),
}
})

Expand Down Expand Up @@ -361,6 +363,7 @@ plugin_latex_preview_srcs = {"src/Plugins/LaTeX_Preview/**.cpp"}
plugin_bibtex_srcs = { "src/Plugins/Bibtex/**.cpp" }
plugin_openssl_srcs = { "src/Plugins/Openssl/**.cpp" }
plugin_updater_srcs = { "src/Plugins/Updater/**.cpp" }
plugin_git_srcs = { "src/Plugins/Git/**.cpp" }


target("libmogan") do
Expand Down Expand Up @@ -389,6 +392,7 @@ target("libmogan") do
add_packages("freetype")
add_packages("pdfhummus")
add_packages("s7")
add_packages("libgit2")
if is_plat("linux") then
add_packages("fontconfig")
end
Expand Down Expand Up @@ -424,6 +428,7 @@ target("libmogan") do
add_files(plugin_xml_srcs)
add_files(plugin_html_srcs)
add_files(plugin_pdf_srcs)
add_files(plugin_git_srcs)

add_mxflags("-fno-objc-arc")
before_build(function (target)
Expand Down
7 changes: 7 additions & 0 deletions xmake/packages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ local FREETYPE_VERSION = "2.12.1"
local LIBPNG_VERSION = "1.6.37"
local LIBJPEG_VERSION = "v9e"
local LIBICONV_VERSION = "1.17"
local LIBGIT2_VERSION = "1.7.1"

-- https://xmake.io/#/manual/package_dependencies?id=inherit-package-configuration
package("lolly")
Expand Down Expand Up @@ -140,4 +141,10 @@ function add_requires_of_mogan()
add_requires("freetype "..FREETYPE_VERSION, {system=false})
add_requireconfs("pdfhummus.freetype", {version = FREETYPE_VERSION, system = false, override=true})
end

-- package: libgit2
set_configvar("LIBGIT2_VERSION", LIBGIT2_VERSION)
if not is_plat("wasm") then
add_requires("libgit2 "..LIBGIT2_VERSION, {system=false})
end
end

0 comments on commit ce0ea73

Please sign in to comment.