Teach the internal dep generator about OCaml
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 6 Oct 2009 09:34:44 +0000 (12:34 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 6 Oct 2009 09:34:44 +0000 (12:34 +0300)
- OCaml seems to have fairly well detectable magic in its files, nice
- Dont call the regular find-requires from the scripts now that internal
  is working

build/rpmfc.c
build/rpmfc.h
macros.in
scripts/ocaml-find-requires.sh

index 308d7da..f215b82 100644 (file)
@@ -471,6 +471,8 @@ static const struct rpmfcTokens_s const rpmfcTokens[] = {
   { "libtool library ",         RPMFC_LIBTOOL|RPMFC_INCLUDE },
   { "pkgconfig ",               RPMFC_PKGCONFIG|RPMFC_INCLUDE },
 
+  { "Objective caml ",         RPMFC_OCAML|RPMFC_INCLUDE },
+
   /* XXX .NET executables and libraries.  file(1) cannot differ from win32 
    * executables unfortunately :( */
   { "Mono/.Net assembly",       RPMFC_MONO|RPMFC_INCLUDE },
@@ -770,6 +772,10 @@ static int rpmfcSCRIPT(rpmfc fc)
         xx = rpmfcHelper(fc, 'P', "mono");
         if (is_executable)
             xx = rpmfcHelper(fc, 'R', "mono");
+    } else
+    if (fc->fcolor->vals[fc->ix] & RPMFC_OCAML) {
+       xx = rpmfcHelper(fc, 'P', "ocaml");
+       xx = rpmfcHelper(fc, 'R', "ocaml");
     }
 
     return 0;
@@ -1115,7 +1121,7 @@ typedef const struct rpmfcApplyTbl_s {
 static const struct rpmfcApplyTbl_s const rpmfcApplyTable[] = {
     { rpmfcELF,                RPMFC_ELF },
     { rpmfcSCRIPT,     (RPMFC_SCRIPT|RPMFC_BOURNE|
-                        RPMFC_PERL|RPMFC_PYTHON|RPMFC_MONO|
+                        RPMFC_PERL|RPMFC_PYTHON|RPMFC_MONO|RPMFC_OCAML|
                         RPMFC_PKGCONFIG|RPMFC_LIBTOOL) },
     { rpmfcMISC,       RPMFC_FONT|RPMFC_TEXT },
     { NULL, 0 }
index 84808a3..96cb93f 100644 (file)
@@ -33,7 +33,8 @@ enum FCOLOR_e {
 #define        RPMFC_ELF       (RPMFC_ELF32|RPMFC_ELF64|RPMFC_ELFMIPSN32)
        /* (1 << 3) leaks into package headers, reserved */
 
-       /* bits 4-7 unused */
+       /* bits 4-6 unused */
+    RPMFC_OCAML                        = (1 <<  7),
     RPMFC_PKGCONFIG            = (1 <<  8),
     RPMFC_LIBTOOL              = (1 <<  9),
     RPMFC_BOURNE               = (1 << 10),
index d21b042..6b64690 100644 (file)
--- a/macros.in
+++ b/macros.in
@@ -496,6 +496,9 @@ print (t)\
 %__pkgconfig_provides   %{_rpmconfigdir}/pkgconfigdeps.sh --provides
 %__pkgconfig_requires   %{_rpmconfigdir}/pkgconfigdeps.sh --requires
 
+%__ocaml_provides       %{_rpmconfigdir}/ocaml-find-provides.sh
+%__ocaml_requires       %{_rpmconfigdir}/ocaml-find-requires.sh
+
 %__fontconfig_provides %{_rpmconfigdir}/fontconfig.prov
 %__desktop_provides    %{_rpmconfigdir}/desktop-file.prov
 
index 654747f..6ab0fa9 100644 (file)
@@ -39,7 +39,7 @@ done
 files=`sed "s/['\"]/\\\&/g"`
 
 # Use ordinary find-requires first.
-echo $files | tr [:blank:] '\n' | /usr/lib/rpm/find-requires
+echo $files | tr [:blank:] '\n' | /usr/lib/rpm/find-requires
 
 # Get list of .cmi, .cmo and .cma files.
 files=`echo $files | tr [:blank:] '\n' | grep '\.cm[ioa]$'`