Ticket #18786: lang--ocaml.patch

File lang--ocaml.patch, 10.1 KB (added by Damien.Pollet@…, 15 years ago)
  • lang/ocaml/Portfile

    diff -ruN /opt/local/var/macports/sources/rsync.macports.org/release/ports/lang/ocaml/Portfile lang/ocaml/Portfile
    old new  
    1 # $Id: Portfile 46051 2009-01-28 01:23:55Z mcalhoun@macports.org $
     1# $Id: Portfile 41305 2008-10-30 08:01:18Z pguyot@kallisys.net $
    22
    3 PortSystem              1.0
     3PortSystem      1.0
    44
    5 name                    ocaml
    6 version                 3.11.0
    7 set major_vers  [join [lrange [split ${version} .] 0 1] .]
    8 platforms               darwin
    9 maintainers             pguyot@kallisys.net openmaintainer
    10 categories              lang ml
    11 description             Objective Caml is an implementation of the ML language
    12 homepage                http://www.ocaml.org/
    13 master_sites    http://caml.inria.fr/pub/distrib/ocaml-${major_vers}/
     5name            ocaml
     6version         3.11.0
     7revision        1
     8set major_vers  [join [lrange [split ${version} .] 0 1] .]
     9platforms       darwin
     10maintainers     pguyot@kallisys.net openmaintainer
     11categories      lang ml
     12description     Objective Caml is an implementation of the ML language
     13homepage        http://www.ocaml.org/
     14master_sites    http://caml.inria.fr/pub/distrib/ocaml-${major_vers}/
    1415checksums       ocaml-${version}.tar.bz2 \
    15                                         md5 6ed1c3ed660a15408362242fa8fa4668 \
    16                                         sha1 fed19b82828789b8c509049590f0b82f8e5e6eb3 \
    17                                         rmd160 06f367eacfa3f4d413138fc2386bf3b1ee822cf6 \
    18                                 ocaml-3.11-refman.html.tar.gz \
    19                                         md5 bfb4ed960974159f4224014a979baf6d \
    20                                         sha1 97159cf3d4ea64d0ca03f04997fdfc00982d22b0 \
    21                                         rmd160 8d77630ee0c3dcdae1ef142a59eb876271f1c335
     16                    md5    6ed1c3ed660a15408362242fa8fa4668 \
     17                    sha1    fed19b82828789b8c509049590f0b82f8e5e6eb3 \
     18                    rmd160 06f367eacfa3f4d413138fc2386bf3b1ee822cf6 \
     19                ocaml-3.11-refman.html.tar.gz \
     20                    md5    bfb4ed960974159f4224014a979baf6d \
     21                    sha1    97159cf3d4ea64d0ca03f04997fdfc00982d22b0 \
     22                    rmd160 8d77630ee0c3dcdae1ef142a59eb876271f1c335
    2223
    2324long_description \
    24                         Objective Caml is an implementation of the ML language, based on \
    25                         the Caml Light dialect extended with a complete class-based object \
    26                         system  and a powerful module system in the style of Standard ML.
     25            Objective Caml is an implementation of the ML language, based on \
     26            the Caml Light dialect extended with a complete class-based object \
     27            system    and a powerful module system in the style of Standard ML.
    2728
    28 use_bzip2                       yes
    29 use_parallel_build      no
     29use_bzip2            yes
     30use_parallel_build    no
    3031universal_variant   no
    3132
    32 set doc_distname        ${name}-${major_vers}-refman
    33 set docdir                      ${prefix}/share/doc/${name}-${version}
     33set doc_distname    ${name}-${major_vers}-refman
     34set docdir            ${prefix}/share/doc/${name}-${version}
     35
     36patchfiles          ocaml-threads-fork.diff
     37
     38platform darwin 9 {
     39    macosx_deployment_target    10.4
     40}
    3441
    3542# Configure.
    36 configure.pre_args      -prefix ${prefix}
    37 configure.args          -no-tk -cc ${configure.cc} -aspp \"${configure.cc} -c\"
     43configure.pre_args    -prefix ${prefix}
     44configure.args        -no-tk
    3845
    3946# Building.
    40 build.target            world.opt
     47build.target        world.opt
    4148build.cmd           "unset LD_PREBIND LD_PREBIND_ALLOW_OVERLAP && ${build.cmd}"
    4249
    4350# Install.
    44 destroot.target         install
    45 destroot.destdir        BINDIR=${destroot}${prefix}/bin \
    46                                         LIBDIR=${destroot}${prefix}/lib/ocaml \
    47                                         MANDIR=${destroot}${prefix}/share/man
     51destroot.target        install
     52destroot.destdir    BINDIR=${destroot}${prefix}/bin \
     53                    LIBDIR=${destroot}${prefix}/lib/ocaml \
     54                    MANDIR=${destroot}${prefix}/share/man
    4855
    4956post-destroot {
    50         # Change "ld.conf" to remove ${destroot} in paths.
    51         reinplace "s:${destroot}::g" ${destroot}${prefix}/lib/ocaml/ld.conf
     57    # Change "ld.conf" to remove ${destroot} in paths.
     58    reinplace "s:${destroot}::g" ${destroot}${prefix}/lib/ocaml/ld.conf
    5259}
    5360
    5461# Variants.
    5562variant labltk {
    56         depends_lib             lib:tcl8.4:tcl lib:tk8.4:tk
    57         configure.args-delete   -no-tk
     63    depends_lib        lib:tcl8.4:tcl lib:tk8.4:tk
     64    configure.args-delete     -no-tk
    5865}
    5966
    6067variant doc description {Install extra documentation} {
    61         extract.only        ${distfiles}
    62         distfiles-append    ${doc_distname}.html.tar.gz
     68    extract.only        ${distfiles}
     69    distfiles-append    ${doc_distname}.html.tar.gz
    6370
    64         post-extract {
    65                 system "tar xzvf ${distpath}/${doc_distname}.html.tar.gz -C ${workpath}"
    66         }
    67 
    68         post-destroot {
    69                 xinstall -d ${destroot}${docdir}
    70                 xinstall -m 0644 -W ${worksrcpath} Changes LICENSE README ${destroot}${docdir}
    71                 xinstall -d ${destroot}${docdir}/html/libref
    72                 eval xinstall -m 0644 [glob ${workpath}/htmlman/libref/*] \
    73                         ${destroot}${docdir}/html/libref
    74                 eval xinstall -m 0644 [glob ${workpath}/htmlman/*.*] \
    75                         ${destroot}${docdir}/html
    76         }
     71    post-extract {
     72        system "tar xzvf ${distpath}/${doc_distname}.html.tar.gz -C ${workpath}"
     73    }
     74
     75    post-destroot {
     76        xinstall -d ${destroot}${docdir}
     77        xinstall -m 0644 -W ${worksrcpath} Changes LICENSE README ${destroot}${docdir}
     78        xinstall -d ${destroot}${docdir}/html/libref
     79        eval xinstall -m 0644 [glob ${workpath}/htmlman/libref/*] \
     80            ${destroot}${docdir}/html/libref
     81        eval xinstall -m 0644 [glob ${workpath}/htmlman/*.*] \
     82            ${destroot}${docdir}/html
     83    }
    7784}
    7885
    79 livecheck.check regex
    80 livecheck.url   http://caml.inria.fr/news.en.rss
    81 livecheck.regex "<title>Objective Caml (.*) released"
     86livecheck.check    regex
     87livecheck.url    http://caml.inria.fr/news.en.rss
     88livecheck.regex    "<title>Objective Caml (.*) released"
  • lang/ocaml/files/ocaml-threads-fork.diff

    diff -ruN /opt/local/var/macports/sources/rsync.macports.org/release/ports/lang/ocaml/files/ocaml-threads-fork.diff lang/ocaml/files/ocaml-threads-fork.diff
    old new  
     1--- otherlibs/systhreads/posix.c.orig   2008-09-27 11:46:55.000000000 +0100
     2+++ otherlibs/systhreads/posix.c        2009-03-02 21:30:34.000000000 +0000
     3@@ -11,7 +11,7 @@
     4 /*                                                                     */
     5 /***********************************************************************/
     6 
     7-/* $Id: posix.c,v 1.58 2008/09/27 10:46:55 xleroy Exp $ */
     8+/* $Id: posix.c,v 1.58.2.1 2008-12-14 18:16:38 xleroy Exp $ */
     9 
     10 /* Thread interface for POSIX 1003.1c threads */
     11 
     12@@ -111,6 +111,9 @@
     13 /* Condition signaled when caml_runtime_busy becomes 0 */
     14 static pthread_cond_t caml_runtime_is_free = PTHREAD_COND_INITIALIZER;
     15 
     16+/* Whether the ``tick'' thread is already running */
     17+static int caml_tick_thread_running = 0;
     18+
     19 /* The key used for storing the thread descriptor in the specific data
     20    of the corresponding Posix thread. */
     21 static pthread_key_t thread_descriptor_key;
     22@@ -332,8 +335,6 @@
     23 static void caml_thread_reinitialize(void)
     24 {
     25   caml_thread_t thr, next;
     26-  pthread_t tick_pthread;
     27-  pthread_attr_t attr;
     28   struct channel * chan;
     29 
     30   /* Remove all other threads (now nonexistent)
     31@@ -353,24 +354,21 @@
     32   pthread_cond_init(&caml_runtime_is_free, NULL);
     33   caml_runtime_waiters = 0;     /* no other thread is waiting for the RTS */
     34   caml_runtime_busy = 1;        /* normally useless */
     35+  /* Tick thread is not currently running in child process, will be
     36+     re-created at next Thread.create */
     37+  caml_tick_thread_running = 0;
     38   /* Reinitialize all IO mutexes */
     39   for (chan = caml_all_opened_channels;
     40        chan != NULL;
     41        chan = chan->next) {
     42     if (chan->mutex != NULL) pthread_mutex_init(chan->mutex, NULL);
     43   }
     44-  /* Fork a new tick thread */
     45-  pthread_attr_init(&attr);
     46-  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
     47-  pthread_create(&tick_pthread, &attr, caml_thread_tick, NULL);
     48 }
     49 
     50 /* Initialize the thread machinery */
     51 
     52 value caml_thread_initialize(value unit)   /* ML */
     53 {
     54-  pthread_t tick_pthread;
     55-  pthread_attr_t attr;
     56   value mu = Val_unit;
     57   value descr;
     58 
     59@@ -415,12 +413,6 @@
     60     caml_channel_mutex_lock = caml_io_mutex_lock;
     61     caml_channel_mutex_unlock = caml_io_mutex_unlock;
     62     caml_channel_mutex_unlock_exn = caml_io_mutex_unlock_exn;
     63-    /* Fork the tick thread */
     64-    pthread_attr_init(&attr);
     65-    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
     66-    caml_pthread_check(
     67-        pthread_create(&tick_pthread, &attr, caml_thread_tick, NULL),
     68-        "Thread.init");
     69     /* Set up fork() to reinitialize the thread machinery in the child
     70        (PR#4577) */
     71     pthread_atfork(NULL, NULL, caml_thread_reinitialize);
     72@@ -488,6 +480,7 @@
     73 {
     74   pthread_attr_t attr;
     75   caml_thread_t th;
     76+  pthread_t tick_pthread;
     77   value mu = Val_unit;
     78   value descr;
     79   int err;
     80@@ -526,12 +519,12 @@
     81     th->prev = curr_thread;
     82     curr_thread->next->prev = th;
     83     curr_thread->next = th;
     84-    /* Fork the new thread */
     85+    /* Create the new thread */
     86     pthread_attr_init(&attr);
     87     pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
     88     err = pthread_create(&th->pthread, &attr, caml_thread_start, (void *) th);
     89     if (err != 0) {
     90-      /* Fork failed, remove thread info block from list of threads */
     91+      /* Creation failed, remove thread info block from list of threads */
     92       th->next->prev = curr_thread;
     93       curr_thread->next = th->next;
     94 #ifndef NATIVE_CODE
     95@@ -541,6 +534,16 @@
     96       caml_pthread_check(err, "Thread.create");
     97     }
     98   End_roots();
     99+  /* Create the tick thread if not already done. 
     100+     Because of PR#4666, we start the tick thread late, only when we create
     101+     the first additional thread in the current process*/
     102+  if (! caml_tick_thread_running) {
     103+    caml_tick_thread_running = 1;
     104+    pthread_attr_init(&attr);
     105+    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
     106+    err = pthread_create(&tick_pthread, &attr, caml_thread_tick, NULL);
     107+    caml_pthread_check(err, "Thread.create");
     108+  }
     109   return descr;
     110 }
     111