Changeset 7111

Show
Ignore:
Timestamp:
01/27/10 21:42:45 (7 weeks ago)
Author:
metamorph68
Message:

Ported liquidsoap and some bindings to Win32. Now liquidsoap should compile and run
using the native ocaml compiler (or the crosscompiler) !

Location:
trunk
Files:
15 modified

Legend:

Unmodified
Added
Removed
  • trunk/liquidsoap/Makefile

    r6857 r7111  
    22SUBDIRS= src examples doc gui scripts 
    33DISTFILES = CHANGES COPYING INSTALL README \ 
    4         bootstrap configure.ac configure config.h.in \ 
     4        bootstrap configure.ac configure config.h.in test_os.ml \ 
    55        Makefile Makefile.defs.in Makefile.rules install-sh 
    66 
  • trunk/liquidsoap/Makefile.defs.in

    r7072 r7111  
    2626LIBS = @LIBS@ 
    2727LDFLAGS = @LDFLAGS@ 
     28OS_EXEC_SUFFIX = @OS_EXEC_SUFFIX@ 
    2829 
    2930_OCAML_CFLAGS= @ocamlcflags@ 
  • trunk/liquidsoap/configure.ac

    r7110 r7111  
    6060if test "x$prefix" = "xNONE" ; then 
    6161  prefix=/usr/local 
     62  default_prefix=/usr 
    6263else 
    6364  # Add passed prefix to compilation variables. 
     
    6566  LDFLAGS="$LDFLAGS -L$prefix/lib" 
    6667  CPPFLAGS="$CPPFLAGS -I$prefix/include" 
     68  default_prefix=$prefix 
    6769fi 
    6870 
     
    9799  big endian]),[]) 
    98100 
    99 # opal 
    100  
    101 AC_ARG_WITH([opal-include], 
    102    AC_HELP_STRING( 
    103       [--with-opal-include=path], 
    104       [look for opal headers in path (defaults to /usr/include/opal)])) 
    105 AC_ARG_ENABLE([opal],AC_HELP_STRING([--disable-opal],["don't use opal"])) 
    106  
    107 W_OPAL="" 
    108 w_OPAL=no 
    109 if test "x$enable_opal" != "xno" ; then 
    110   AC_MSG_CHECKING(for libopal) 
    111  
    112   if test -z "$with_opal_include" ; then 
    113     OPAL_INCLUDE=/usr/include/opal 
    114   else 
    115     OPAL_INCLUDE=$with_opal_include 
    116   fi 
    117  
    118   if test \! -f ${OPAL_INCLUDE}/opal.h ; then 
    119     AC_MSG_RESULT(Header not found: ${OPAL_INCLUDE}/opal.h) 
    120     W_OPAL="" 
    121     w_OPAL=no 
    122   else 
    123     W_OPAL=yes 
    124     w_OPAL=yes 
    125     AC_MSG_RESULT(ok) 
    126   fi 
    127 else 
    128   AC_MSG_RESULT(no) 
    129 fi 
    130  
    131 AC_SUBST(W_OPAL) 
    132 AC_SUBST(OPAL_INCLUDE) 
    133  
    134 # V4L 
    135  
    136 AC_ARG_WITH([v4l-include], 
    137    AC_HELP_STRING( 
    138       [--with-v4l-include=path], 
    139       [look for v4l headers in path (defaults to /usr/include/linux)])) 
    140 AC_ARG_ENABLE([v4l],AC_HELP_STRING([--disable-v4l],["don't use v4l"])) 
    141  
    142 if test "x$enable_v4l" != "xno" ; then 
    143   AC_MSG_CHECKING(for v4l) 
    144  
    145   if test -z "$with_v4l_include" ; then 
    146     V4L_INCLUDE=/usr/include/linux 
    147   else 
    148     V4L_INCLUDE=$with_v4l_include 
    149   fi 
    150  
    151   if test \! -f ${V4L_INCLUDE}/videodev.h ; then 
    152     AC_MSG_RESULT(Header not found: ${V4L_INCLUDE}/videodev.h) 
    153     W_V4L="" 
    154     w_V4L=no 
    155   else 
    156     W_V4L=yes 
    157     w_V4L=yes 
    158     AC_MSG_RESULT(ok) 
    159   fi 
    160 else 
    161     W_V4L="" 
    162     w_V4L=no 
    163 fi 
    164  
    165 AC_SUBST(W_V4L) 
    166 AC_SUBST(V4L_INCLUDE) 
    167  
    168101# 
    169102# OCaml stuff 
     
    211144fi 
    212145 
     146# Check for OS 
     147OS_TYPE=`$OCAMLFIND ocamlc -config | grep os_type | tr -d ' ' | cut -d':' -f 2` 
     148if test "$OS_TYPE" \!= "Win32" ; then 
     149  OS_EXEC_SUFFIX="" 
     150else 
     151  OS_EXEC_SUFFIX=".exe" 
     152fi 
     153AC_SUBST(OS_EXEC_SUFFIX) 
     154 
    213155# Add -fPIC to CFLAGS for compatibility with x86_64 
    214 CFLAGS="$CFLAGS -fPIC" 
     156if test "$OS_TYPE" \!= "Win32" ; then 
     157  CFLAGS="$CFLAGS -fPIC" 
     158fi 
     159 
    215160# Optimize for local machine 
    216161AC_ARG_ENABLE([optimize], 
     
    297242 
    298243AC_SUBST(BYTE) 
     244 
     245# opal 
     246 
     247AC_ARG_WITH([opal-include], 
     248   AC_HELP_STRING( 
     249      [--with-opal-include=path], 
     250      [look for opal headers in path (defaults to /usr/include/opal)])) 
     251AC_ARG_ENABLE([opal],AC_HELP_STRING([--disable-opal],["don't use opal"])) 
     252 
     253W_OPAL="" 
     254w_OPAL=no 
     255if test "x$enable_opal" != "xno" ; then 
     256  AC_MSG_CHECKING(for libopal) 
     257 
     258  if test -z "$with_opal_include" ; then 
     259    OPAL_INCLUDE=$default_prefix/include/opal 
     260  else 
     261    OPAL_INCLUDE=$with_opal_include 
     262  fi 
     263 
     264  if test \! -f ${OPAL_INCLUDE}/opal.h ; then 
     265    AC_MSG_RESULT(Header not found: ${OPAL_INCLUDE}/opal.h) 
     266    W_OPAL="" 
     267    w_OPAL=no 
     268  else 
     269    W_OPAL=yes 
     270    w_OPAL=yes 
     271    AC_MSG_RESULT(ok) 
     272  fi 
     273else 
     274  AC_MSG_RESULT(no) 
     275fi 
     276 
     277AC_SUBST(W_OPAL) 
     278AC_SUBST(OPAL_INCLUDE) 
     279 
     280# V4L 
     281 
     282AC_ARG_WITH([v4l-include], 
     283   AC_HELP_STRING( 
     284      [--with-v4l-include=path], 
     285      [look for v4l headers in path (defaults to /usr/include/linux)])) 
     286AC_ARG_ENABLE([v4l],AC_HELP_STRING([--disable-v4l],["don't use v4l"])) 
     287 
     288if test "x$enable_v4l" != "xno" ; then 
     289  AC_MSG_CHECKING(for v4l) 
     290 
     291  if test -z "$with_v4l_include" ; then 
     292    V4L_INCLUDE=$default_prefix/include/linux 
     293  else 
     294    V4L_INCLUDE=$with_v4l_include 
     295  fi 
     296 
     297  if test \! -f ${V4L_INCLUDE}/videodev.h ; then 
     298    AC_MSG_RESULT(Header not found: ${V4L_INCLUDE}/videodev.h) 
     299    W_V4L="" 
     300    w_V4L=no 
     301  else 
     302    W_V4L=yes 
     303    w_V4L=yes 
     304    AC_MSG_RESULT(ok) 
     305  fi 
     306else 
     307    W_V4L="" 
     308    w_V4L=no 
     309fi 
     310 
     311AC_SUBST(W_V4L) 
     312AC_SUBST(V4L_INCLUDE) 
    299313 
    300314AC_ARG_ENABLE([graphics], 
     
    17911805 Compiler       : $OCAMLC 
    17921806 Version        : $OCAML_MAJOR.$OCAML_MINOR.$OCAML_REVISION 
     1807 OS             : $OS_TYPE 
    17931808 OCAML_CFLAGS   : $ocamlcflags 
    17941809 OCAML_LFLAGS   : $ocamllflags 
  • trunk/liquidsoap/src/Makefile

    r7110 r7111  
    66DISTFILES = $(wildcard *.mli) Makefile $(wildcard *.ml) META.in 
    77 
    8 ocaml_progs= liquidsoap 
     8ocaml_progs= liquidsoap$(OS_EXEC_SUFFIX) 
    99 
    1010ogg_demuxer = \ 
  • trunk/liquidsoap/src/sources/playlist.ml

    r7057 r7111  
    109109    * Must be called within mylock critical section. *) 
    110110  method randomize_playlist = 
    111     assert (not (Mutex.try_lock mylock)) ; 
     111    (* This assertion does not work on 
     112     * win32 because a thread can double-lock 
     113     * the same mutex.. *) 
     114    if Sys.os_type <> "Win32" then 
     115      assert (not (Mutex.try_lock mylock)) ; 
    112116    Utils.randomize !playlist 
    113117 
     
    231235 
    232236  method reload_playlist_internal new_playlist_uri = 
    233  
    234     assert (not (Mutex.try_lock reloading)) ; 
     237     
     238    (* This assertion does not work on 
     239     * win32 because a thread can double-lock 
     240     * the same mutex.. *) 
     241    if Sys.os_type <> "Win32" then 
     242      assert (not (Mutex.try_lock reloading)) ; 
    235243 
    236244    self#load_playlist ?uri:new_playlist_uri true ; 
     
    248256  method reload_update round_done = 
    249257    (* Must be called by somebody who owns [mylock] *) 
    250     assert (not (Mutex.try_lock mylock)) ; 
     258    (* This assertion does not work on 
     259     * win32 because a thread can double-lock 
     260     * the same mutex.. *) 
     261    if Sys.os_type <> "Win32" then 
     262      assert (not (Mutex.try_lock mylock)) ; 
    251263    match reload with 
    252264      | Never -> () 
  • trunk/liquidsoap/src/sources/request_source.ml

    r7052 r7111  
    6969    * when there is no ready request. *) 
    7070  method private begin_track = 
    71     assert (not (Mutex.try_lock plock)) ; 
     71    (* This assertion does not work on 
     72     * win32 because a thread can double-lock 
     73     * the same mutex.. *) 
     74    if Sys.os_type <> "Win32" then 
     75      assert (not (Mutex.try_lock plock)) ; 
    7276    assert (current = None) ; 
    7377    match self#get_next_file with 
  • trunk/liquidsoap/src/tools/harbor.ml

    r7110 r7111  
    578578 
    579579let start () = 
    580   Sys.set_signal Sys.sigpipe Sys.Signal_ignore ; 
     580  if Sys.os_type <> "Win32" then 
     581    Sys.set_signal Sys.sigpipe Sys.Signal_ignore ; 
    581582  if Hashtbl.length sources > 0 then begin 
    582583    Tutils.need_non_blocking_queue () ; 
  • trunk/liquidsoap/src/tools/server.ml

    r6767 r7111  
    336336 
    337337let start () = 
    338   Sys.set_signal Sys.sigpipe Sys.Signal_ignore ; 
     338  if Sys.os_type <> "Win32" then 
     339    Sys.set_signal Sys.sigpipe Sys.Signal_ignore ; 
    339340  let telnet = conf_telnet#get in 
    340341  let socket = conf_socket#get in 
  • trunk/ocaml-dtools/CHANGES

    r6632 r7111  
     10.1.7 () 
     2===== 
     3* Use Thread.join instead of Thread.wait_signal 
     4  under Win32 (Thread.wait_signal is not implemented 
     5  in this case). Also do not use sigmask since it is  
     6  not implemented either. 
     7 
    180.1.6 (15-04-2008) 
    29===== 
  • trunk/ocaml-dtools/src/dtools.ml

    r6604 r7111  
    502502  let main f () = 
    503503    begin try exec start with e -> raise (StartError e) end; 
    504     let quit pid = Unix.kill pid Sys.sigterm in 
     504    let quit pid =  
     505      if Sys.os_type <> "Win32" then 
     506        Unix.kill pid Sys.sigterm  
     507    in 
    505508    let thread pid = 
    506509      begin try f (); quit pid with 
     
    513516      end 
    514517    in 
    515     ignore (Thread.create thread (Unix.getpid ())); 
    516     wait_signal (); 
     518    let th = Thread.create thread (Unix.getpid ()) in 
     519    if Sys.os_type <> "Win32" then 
     520      wait_signal () 
     521    else 
     522      Thread.join th ; 
    517523    begin try exec stop with e -> raise (StopError e) end 
    518524 
     
    606612    Sys.set_signal Sys.sigint (Sys.Signal_handle signal_h); 
    607613    (* We want to block those signals. *) 
    608     ignore (Unix.sigprocmask Unix.SIG_BLOCK [Sys.sigterm; Sys.sigint]); 
     614    if Sys.os_type <> "Win32" then 
     615      ignore (Unix.sigprocmask Unix.SIG_BLOCK [Sys.sigterm; Sys.sigint]); 
    609616    if conf_daemon#get 
    610617    then daemonize (main f) 
  • trunk/ocaml-duppy/CHANGES

    r6822 r7111  
     10.3.2 () 
     2===== 
     3* Switch from Thread.select to  
     4  Unix.select. They are the same on  
     5  POSIX and only Unix.select is available 
     6  on Win32.. 
     7* Do not use assertions on Mutex.try_lock 
     8  on Win32: on this plateform, a thread can 
     9  double-lock a mutex, making the assertion  
     10  inconsistent. 
     11 
    1120.3.1 (14-10-2009) 
    213===== 
  • trunk/ocaml-duppy/src/duppy.ml

    r6747 r7111  
    160160           (List.length e.r) (List.length e.w) (List.length e.x)) ; 
    161161    let r,w,x = 
    162       Thread.select e.r e.w e.x timeout 
     162      Unix.select e.r e.w e.x timeout 
    163163    in 
    164164      log (Printf.sprintf "Left select at %f (%d/%d/%d)." (time ()) 
     
    198198    * if some task was processed. *)  
    199199let exec s (priorities:'a->bool) = 
    200   assert(not (Mutex.try_lock s.ready_m)) ; 
     200  (* This assertion does not work on 
     201   * win32 because a thread can double-lock 
     202   * the same mutex.. *) 
     203  if Sys.os_type <> "Win32" then 
     204    assert(not (Mutex.try_lock s.ready_m)) ; 
    201205  try 
    202206    let (_,task),remaining = 
  • trunk/ocaml-taglib/CHANGES

    r6673 r7111  
     10.1.4 () 
     2===== 
     3* Reworked build system, now using pkg-config. 
     4 
    150.1.3 (20-06-2009) 
    26===== 
  • trunk/ocaml-taglib/configure.ac

    r6675 r7111  
    11 
    22# check for one particular file of the sources  
    3 AC_INIT(ocaml-taglib, 0.1.3, savonet-users@lists.sourceforge.net) 
     3AC_INIT(ocaml-taglib, 0.1.4, savonet-users@lists.sourceforge.net) 
    44 
    55VERSION=$PACKAGE_VERSION 
     
    99# if passed 
    1010if test "x$prefix" != "xNONE"; then 
    11         CFLAGS="$CFLAGS -I$prefix/include" 
    12         LDFLAGS="$LDFLAGS -L$prefix/lib" 
    13         CPPFLAGS="$CPPFLAGS -I$prefix/include" 
     11        CFLAGS="$CFLAGS -I$prefix/include" 
     12        LDFLAGS="$LDFLAGS -L$prefix/lib" 
     13        CPPFLAGS="$CPPFLAGS -I$prefix/include" 
    1414fi 
    1515 
     
    109109 
    110110AC_PROG_CC() 
    111 AC_CHECK_HEADER(taglib/tag_c.h, [], [AC_MSG_ERROR([taglib/tag_c.h, please 
    112 install the C taglib library, or put taglib/tag_c.h somewhere it can be found]);]) 
    113 AC_CHECK_LIB(tag_c, taglib_set_string_management_enabled, [], [AC_MSG_ERROR(Cannot find libtag_c.)]) 
    114 ACLIBS="-ltag_c $ACLIBS" 
     111PKG_PROG_PKG_CONFIG() 
     112#PKG_CHECK_MODULES(taglib, taglib_c, , [AC_MSG_ERROR(taglib not found.)]) 
     113 
     114# PKG_CHECK_MODULES loses when you need --libs-only-[lL] 
     115if ! $PKG_CONFIG --exists taglib_c; then 
     116        AC_MSG_ERROR([taglib not found]) 
     117fi 
     118taglib_CFLAGS=`$PKG_CONFIG --cflags taglib_c` 
     119AC_SUBST([taglib_CFLAGS]) 
     120taglib_LIBS=`$PKG_CONFIG --libs-only-l taglib_c` 
     121AC_SUBST([taglib_LIBS]) 
     122taglib_LDFLAGS=`$PKG_CONFIG --libs-only-L taglib_c` 
     123AC_SUBST([taglib_LDFLAGS]) 
    115124 
    116125if test "$OCAMLOPT" = no ; then 
     
    137146AC_SUBST(BEST) 
    138147AC_SUBST(INC) 
    139 AC_SUBST(ACLIBS) 
    140148AC_SUBST(requires) 
    141149 
  • trunk/ocaml-taglib/src/Makefile.in

    r6632 r7111  
    2828OCAMLDOCFLAGS = -stars 
    2929LIBINSTALL_FILES = $(wildcard *.mli *.cmi *.cma *.cmxa *.cmx *.a *.so) 
    30 ACLIBS = @LIBS@ 
    31 LDFLAGS = @LDFLAGS@ 
     30ACLIBS = @LIBS@ @taglib_LIBS@ 
     31LDFLAGS = @LDFLAGS@ @taglib_LDFLAGS@ 
    3232CLIBS = $(ACLIBS:-l%=%) 
    3333LIBDIRS = $(LDFLAGS:-L%=%) 
    3434CC = @CC@ 
    35 CFLAGS = @CFLAGS@ -Wall -DCAML_NAME_SPACE 
     35CFLAGS = @CFLAGS@ @taglib_CFLAGS@ -Wall -DCAML_NAME_SPACE 
    3636CPPFLAGS = @CPPFLAGS@ 
    3737INCDIRS = @INC@