Split ocaml out

This commit is contained in:
Aoran Zeng 2024-08-15 21:00:08 +08:00
parent 89646983ab
commit 79e7296b63
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
4 changed files with 60 additions and 50 deletions

View File

@ -184,15 +184,6 @@ pl_haskell_sources[] = {
},
/**
* @time 2023-09-15
*/
pl_ocaml_sources[] = {
{&Upstream, NULL},
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/git/opam-repository.git"}
},
/**
@ -733,7 +724,6 @@ wr_tex_sources[] = {
def_sources_n(pl_clojure);
def_sources_n(pl_dotnet); def_sources_n(pl_dart); def_sources_n(pl_haskell);
def_sources_n(pl_ocaml);
def_sources_n(pl_r); def_sources_n(pl_julia);
def_sources_n(os_ubuntu); def_sources_n(os_mint);

View File

@ -175,45 +175,7 @@ pl_haskell_setsrc (char *option)
}
void
pl_ocaml_check_cmd ()
{
chsrc_ensure_program ("opam");
}
void
pl_ocaml_getsrc(char *option)
{
pl_ocaml_check_cmd ();
chsrc_run ("opam repo get-url default", RunOpt_Default);
}
/**
* : https://mirrors.sjtug.sjtu.edu.cn/docs/git/opam-repository.git
*/
void
pl_ocaml_setsrc(char *option)
{
pl_ocaml_check_cmd ();
SourceInfo source;
chsrc_yield_source (pl_ocaml);
chsrc_confirm_source (&source);
char *cmd = xy_strjoin (3, "opam repo set-url default ",
source.url,
" --all --set-default");
chsrc_run (cmd, RunOpt_Default);
chsrc_note2 ("如果是首次使用 opam ,请使用以下命令进行初始化");
puts (xy_2strjoin ("opam init default ", source.url));
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
}
#include "recipe/lang/ocaml.c"
void
pl_r_getsrc (char *option)

View File

@ -8,7 +8,7 @@
* ------------------------------------------------------------*/
/* Begin Target Matrix */
def_target(pl_dart); def_target(pl_ocaml);
def_target(pl_dart);
def_target(pl_r); def_target(pl_julia);
def_target_noget (pl_clojure);
def_target_noget (pl_dotnet);

58
src/recipe/lang/ocaml.c Normal file
View File

@ -0,0 +1,58 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org>
* Created on : <2023-09-15>
* Last modified : <2024-08-15>
* ------------------------------------------------------------*/
/**
* @time 2023-09-15
*/
static SourceInfo
pl_ocaml_sources[] = {
{&Upstream, NULL},
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/git/opam-repository.git"}
};
def_sources_n(pl_ocaml);
void
pl_ocaml_check_cmd ()
{
chsrc_ensure_program ("opam");
}
void
pl_ocaml_getsrc(char *option)
{
pl_ocaml_check_cmd ();
chsrc_run ("opam repo get-url default", RunOpt_Default);
}
/**
* : https://mirrors.sjtug.sjtu.edu.cn/docs/git/opam-repository.git
*/
void
pl_ocaml_setsrc(char *option)
{
pl_ocaml_check_cmd ();
SourceInfo source;
chsrc_yield_source (pl_ocaml);
chsrc_confirm_source (&source);
char *cmd = xy_strjoin (3, "opam repo set-url default ",
source.url,
" --all --set-default");
chsrc_run (cmd, RunOpt_Default);
chsrc_note2 ("如果是首次使用 opam ,请使用以下命令进行初始化");
puts (xy_2strjoin ("opam init default ", source.url));
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
}
def_target(pl_ocaml);