Skip to content

Commit

Permalink
Move pcre to stdlib to make sure we never link on pcre. (#3835)
Browse files Browse the repository at this point in the history
  • Loading branch information
toots authored Apr 26, 2024
1 parent ccc5483 commit 485d746
Show file tree
Hide file tree
Showing 38 changed files with 10 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/opam/liquidsoap-core-windows.opam
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ depends: [
"camomile-windows" {>= "2.0.0"}
"camomile" {>= "2.0.0"}
"dtools-windows" {>= "0.4.5"}
"duppy-windows" {>= "0.9.3"}
"duppy-windows" {>= "0.9.4"}
"mm-windows" {>= "0.8.4"}
"re-windows" {>= "1.11.0"}
"cry-windows" {>= "1.0.1"}
Expand Down
1 change: 1 addition & 0 deletions .github/scripts/build-win32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ opam repository set-url windows https://github.com/ocaml-cross/opam-cross-window
opam update windows
# shellcheck disable=SC2046
opam upgrade -y $(echo "$OPAM_DEPS" | sed -e 's#,# #g') ffmpeg-windows ffmpeg-avutil-windows
opam remove -y pcre-windows

# Debug
opam reinstall -y cry-windows
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ jobs:
image: savonet/liquidsoap-win32-ocaml-5-deps-${{ matrix.system }}
options: --user root -v ${{ github.workspace }}/${{ github.run_number }}:/tmp/${{ github.run_number }}
env:
OPAM_DEPS: ao-windows,lastfm-windows,camomile-windows,cry-windows,dtools-windows,duppy-windows,ffmpeg-windows,ffmpeg-avutil-windows,mm-windows,pcre-windows,portaudio-windows,samplerate-windows,sedlex-windows,ssl-windows,srt-windows,winsvc-windows,mem_usage-windows
OPAM_DEPS: ao-windows,lastfm-windows,camomile-windows,cry-windows,dtools-windows,duppy-windows,ffmpeg-windows,ffmpeg-avutil-windows,mm-windows,re-windows,portaudio-windows,samplerate-windows,sedlex-windows,ssl-windows,srt-windows,winsvc-windows,mem_usage-windows
IS_SNAPSHOT: ${{ needs.build_details.outputs.is_snapshot == 'true' }}
steps:
- name: Get number of CPU cores
Expand Down
2 changes: 0 additions & 2 deletions doc/gen_dune.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module Pcre = Re.Pcre

let generated_md =
[
("protocols.md", "--list-protocols-md", None);
Expand Down
2 changes: 0 additions & 2 deletions doc/subst_md.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module Pcre = Re.Pcre

let variables = [("LIQUIDSOAP_VERSION", Liquidsoap_lang.Build_config.version)]

let () =
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
(inotify (< 1.0))
(ladspa (< 0.2.0))
(lame (< 0.3.7))
(lastfm (< 0.3.0))
(lastfm (< 0.3.4))
(lo (< 0.2.0))
(mad (< 0.5.0))
(magic (< 0.6))
Expand Down
2 changes: 1 addition & 1 deletion liquidsoap-core.opam
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ conflicts: [
"inotify" {< "1.0"}
"ladspa" {< "0.2.0"}
"lame" {< "0.3.7"}
"lastfm" {< "0.3.0"}
"lastfm" {< "0.3.4"}
"lo" {< "0.2.0"}
"mad" {< "0.5.0"}
"magic" {< "0.6"}
Expand Down
2 changes: 0 additions & 2 deletions src/core/builtins/builtins_files.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module Pcre = Re.Pcre

module Filename = struct
include Filename

Expand Down
2 changes: 0 additions & 2 deletions src/core/builtins/builtins_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*****************************************************************************)

module Pcre = Re.Pcre

let _ =
Lang.add_builtin ~base:Modules.server "register" ~category:`Interaction
~descr:
Expand Down
2 changes: 0 additions & 2 deletions src/core/builtins/builtins_sqlite.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*****************************************************************************)

module Pcre = Re.Pcre

let error fmt =
Printf.ksprintf
(fun message -> Runtime_error.raise ~pos:[] ~message "sqlite")
Expand Down
1 change: 0 additions & 1 deletion src/core/builtins/builtins_sys.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*****************************************************************************)

open Extralib
module Pcre = Re.Pcre

let configure = Modules.configure

Expand Down
2 changes: 0 additions & 2 deletions src/core/encoder/formats/ffmpeg_format.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*****************************************************************************)

module Pcre = Re.Pcre

type opt_val =
[ `String of string | `Int of int | `Int64 of int64 | `Float of float ]

Expand Down
1 change: 0 additions & 1 deletion src/core/encoder/lang/lang_ffmpeg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

open Value
open Ground
module Pcre = Re.Pcre

type decode_type = [ `Raw | `Internal ]
type content_type = [ `Audio | `Video ]
Expand Down
1 change: 0 additions & 1 deletion src/core/harbor/harbor.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*****************************************************************************)

open Harbor_base
module Pcre = Re.Pcre
module Monad = Duppy.Monad
module Type = Liquidsoap_lang.Type
module Http_base = Http
Expand Down
2 changes: 0 additions & 2 deletions src/core/io/ffmpeg_io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

exception Not_connected

module Pcre = Re.Pcre

module Metadata = struct
include Map.Make (struct
type t = string
Expand Down
2 changes: 0 additions & 2 deletions src/core/io/srt_io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

(** SRT input *)

module Pcre = Re.Pcre

exception Done
exception Not_connected

Expand Down
1 change: 0 additions & 1 deletion src/core/operators/chord.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

open Mm
open Source
module Pcre = Re.Pcre

let chan = 0

Expand Down
1 change: 0 additions & 1 deletion src/core/operators/frei0r_op.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
open Mm
open Source
open Extralib
module Pcre = Re.Pcre

let video_frei0r = Lang.add_module ~base:Modules.video "frei0r"

Expand Down
1 change: 0 additions & 1 deletion src/core/operators/ladspa_op.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
open Mm
open Source
open Ladspa
module Pcre = Re.Pcre

module String = struct
include String
Expand Down
2 changes: 0 additions & 2 deletions src/core/outputs/pipe_output.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

(** base class *)

module Pcre = Re.Pcre

let output = Modules.output

let encoder_factory ?format format_val =
Expand Down
2 changes: 0 additions & 2 deletions src/core/playlists/playlist_basic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*****************************************************************************)

module Pcre = Re.Pcre

let log = Log.make ["playlist"; "basic"]
let split_lines buf = Pcre.split ~rex:(Pcre.regexp "[\r\n]+") buf

Expand Down
2 changes: 0 additions & 2 deletions src/core/request.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
(** Plug for resolving, that is obtaining a file from an URI. [src/protocols]
plugins provide ways to resolve URIs: fetch, generate, ... *)

module Pcre = Re.Pcre

let conf =
Dtools.Conf.void ~p:(Configure.conf#plug "request") "requests configuration"

Expand Down
1 change: 0 additions & 1 deletion src/core/source.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*****************************************************************************)

open Mm
module Pcre = Re.Pcre

exception Unavailable

Expand Down
2 changes: 0 additions & 2 deletions src/core/sources/harbor_input.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*****************************************************************************)

module Pcre = Re.Pcre

let address_resolver s =
let s = Harbor.file_descr_of_socket s in
Utils.name_of_sockaddr ~rev_dns:Harbor_base.conf_revdns#get
Expand Down
1 change: 0 additions & 1 deletion src/core/stream/ffmpeg_raw_content.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*****************************************************************************)

open Avutil
module Pcre = Re.Pcre

type 'a frame = {
stream_idx : Int64.t;
Expand Down
1 change: 0 additions & 1 deletion src/core/synth/dssi_op.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
open Mm
open Source
open Dssi
module Pcre = Re.Pcre

let log = Log.make ["DSSI synthesizer"]

Expand Down
2 changes: 0 additions & 2 deletions src/core/tools/http.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module Pcre = Re.Pcre

type uri = {
protocol : string;
host : string;
Expand Down
2 changes: 0 additions & 2 deletions src/core/tools/liqcurl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*****************************************************************************)

module Pcre = Re.Pcre

let () = Curl.global_init Curl.CURLINIT_GLOBALALL

let string_of_curl_code = function
Expand Down
2 changes: 0 additions & 2 deletions src/core/tools/sandbox.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*****************************************************************************)

module Pcre = Re.Pcre

let log = Log.make ["sandbox"]

let conf_sandbox =
Expand Down
2 changes: 0 additions & 2 deletions src/core/tools/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*****************************************************************************)

module Pcre = Re.Pcre

let ( let* ) = Duppy.Monad.bind

exception Bind_error of string
Expand Down
2 changes: 0 additions & 2 deletions src/core/tools/tutils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*****************************************************************************)

module Pcre = Re.Pcre

let conf_scheduler =
Dtools.Conf.void
~p:(Configure.conf#plug "scheduler")
Expand Down
1 change: 0 additions & 1 deletion src/core/tools/utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*****************************************************************************)

module Pcre = Re.Pcre
include Liquidsoap_lang.Utils

let select = if Sys.win32 then Unix.select else Duppy.poll
Expand Down
1 change: 1 addition & 0 deletions src/runtime/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
(pps ppx_string))
(libraries
liquidsoap_core
liquidsoap_stdlib
liquidsoap_optionals
liquidsoap_builtins
(select
Expand Down
1 change: 0 additions & 1 deletion src/runtime/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*****************************************************************************)

module Pcre = Re.Pcre
module Runtime = Liquidsoap_lang.Runtime
module Doc = Liquidsoap_lang.Doc
module Environment = Liquidsoap_lang.Environment
Expand Down
1 change: 1 addition & 0 deletions src/stdlib/pcre.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include Re.Pcre
1 change: 1 addition & 0 deletions src/stdlib/pcre.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include module type of Re.Pcre
2 changes: 1 addition & 1 deletion tests/check_output.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let () =
let stdout = Unix.open_process_in process in
let output = read_all stdout in
ignore (Unix.close_process_in stdout);
if not (Pcre.pmatch ~pat:expected output) then (
if not (Pcre.pmatch ~rex:(Pcre.regexp expected) output) then (
Printf.eprintf
{|Error running command: %s %s
- Expected output:
Expand Down
2 changes: 1 addition & 1 deletion tests/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(executable
(name check_output)
(modules check_output)
(libraries unix pcre liquidsoap-lang))
(libraries unix liquidsoap_stdlib liquidsoap-lang))

(executable
(name run_test)
Expand Down

0 comments on commit 485d746

Please sign in to comment.