Ticket #18786: lang--ocaml.patch
File lang--ocaml.patch, 10.1 KB (added by Damien.Pollet@…, 16 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 4 6051 2009-01-28 01:23:55Z mcalhoun@macports.org$1 # $Id: Portfile 41305 2008-10-30 08:01:18Z pguyot@kallisys.net $ 2 2 3 PortSystem 3 PortSystem 1.0 4 4 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}/ 5 name ocaml 6 version 3.11.0 7 revision 1 8 set major_vers [join [lrange [split ${version} .] 0 1] .] 9 platforms darwin 10 maintainers pguyot@kallisys.net openmaintainer 11 categories lang ml 12 description Objective Caml is an implementation of the ML language 13 homepage http://www.ocaml.org/ 14 master_sites http://caml.inria.fr/pub/distrib/ocaml-${major_vers}/ 14 15 checksums ocaml-${version}.tar.bz2 \ 15 md56ed1c3ed660a15408362242fa8fa4668 \16 sha1fed19b82828789b8c509049590f0b82f8e5e6eb3 \17 rmd16006f367eacfa3f4d413138fc2386bf3b1ee822cf6 \18 19 md5bfb4ed960974159f4224014a979baf6d \20 sha197159cf3d4ea64d0ca03f04997fdfc00982d22b0 \21 rmd1608d77630ee0c3dcdae1ef142a59eb876271f1c33516 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 22 23 23 24 long_description \ 24 25 26 systemand 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. 27 28 28 use_bzip2 29 use_parallel_build 29 use_bzip2 yes 30 use_parallel_build no 30 31 universal_variant no 31 32 32 set doc_distname ${name}-${major_vers}-refman 33 set docdir ${prefix}/share/doc/${name}-${version} 33 set doc_distname ${name}-${major_vers}-refman 34 set docdir ${prefix}/share/doc/${name}-${version} 35 36 patchfiles ocaml-threads-fork.diff 37 38 platform darwin 9 { 39 macosx_deployment_target 10.4 40 } 34 41 35 42 # Configure. 36 configure.pre_args 37 configure.args -no-tk -cc ${configure.cc} -aspp \"${configure.cc} -c\"43 configure.pre_args -prefix ${prefix} 44 configure.args -no-tk 38 45 39 46 # Building. 40 build.target 47 build.target world.opt 41 48 build.cmd "unset LD_PREBIND LD_PREBIND_ALLOW_OVERLAP && ${build.cmd}" 42 49 43 50 # Install. 44 destroot.target 45 destroot.destdir 46 47 51 destroot.target install 52 destroot.destdir BINDIR=${destroot}${prefix}/bin \ 53 LIBDIR=${destroot}${prefix}/lib/ocaml \ 54 MANDIR=${destroot}${prefix}/share/man 48 55 49 56 post-destroot { 50 51 57 # Change "ld.conf" to remove ${destroot} in paths. 58 reinplace "s:${destroot}::g" ${destroot}${prefix}/lib/ocaml/ld.conf 52 59 } 53 60 54 61 # Variants. 55 62 variant labltk { 56 depends_liblib:tcl8.4:tcl lib:tk8.4:tk57 configure.args-delete-no-tk63 depends_lib lib:tcl8.4:tcl lib:tk8.4:tk 64 configure.args-delete -no-tk 58 65 } 59 66 60 67 variant doc description {Install extra documentation} { 61 62 68 extract.only ${distfiles} 69 distfiles-append ${doc_distname}.html.tar.gz 63 70 64 65 66 67 68 69 70 71 72 73 74 75 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 } 77 84 } 78 85 79 livecheck.check 80 livecheck.url 81 livecheck.regex 86 livecheck.check regex 87 livecheck.url http://caml.inria.fr/news.en.rss 88 livecheck.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