This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to release a codec package with only head files and lib files

In  “codec engine algorithm creator userguide”   2.2.3  package.bld File  section ,it  said that  through

Pkg.attrs.exportAll = true;

var SRCS = ["imgenc_copy"];

Pkg.addLibrary("lib/viddec_copy", targ).addObjects(SRCS);

you can release  a package that include the file you want to.  after we  input  the  “gmake release"  command ,a file named :ti_sdo_ce_examples_codecs_imgenc_copy.tar  was generated .open  it and we could see that all the files in  current  path  were included :

but  I don't want to release the source file :for example "imgenc_copy.c" and "imgenc_copy_ti_priv.h"; and I also don't want this package could be "rebuildable".

I had tried to set

Pkg.attrs.exportAll = false;

var SRCS = ["imgenc_copy_ti.h"];  // only  "imgenc_copy_ti.h"  should be released.

but the generated file ti_sdo_ce_examples_codecs_imgenc_copy.tar  was like this :

may be this was the ultimate package ,but why the head file is not included? or should we manually   add the needed head  files in this package ?

  • Aaron,

    You can include the header files (and any other files that you want) in the release by adding something like the following line to your package.bld:

    Pkg.otherFiles = ["imgenc_copy_ti.h", "imgenc_copy_ti_priv.h", "makefile"];

    Regards,

        Janet

  • thanks a lot.  it really works..well I have the following questions:

    1、in package.bld files ,there are the following codes:

    var SRCS = ["imgenc_copy"];

    ......

    Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(SRCS);

    Q:  does SRCS stand for the current codec directory?

    2、in the xdc help document, there 's an configuration in the Pkg:config PackageContents.otherSrcs

    when I use it like this :

    Pkg.attrs.exportAll = false;

    Pkg.otherFiles = ["imgenc_copy_ti.h"];

    Pkg.otherSrcs=["aa.c"] ; aa.c is a  test file.

    Q :the generated tar file didn't include the aa.c file. why?

    well, I also didn't completely understand the explaination of the pkg.otherSrcs  in xdc help document:“This array only needs to specify files that are not implicitly specidied via any of the addObjects function; e.g., script files, hand-creafted headers, etc.”

  • Aaron,

    1.  SRCS is just the name of the array containing the files that you are going to add to your library.  You can name it differently, if you like.  The following code would also have worked:

        Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(["imgenc_copy.c"])

    2.  Just as your source files do not get included in your tar file (because you have "exportAll" set to false), the same holds for "otherSrcs".  The files in "otherSrcs" get post-processed by the xdc-documentation tools according to xdctools documentation.

    Regards,

        Janet

  • thans for your reply, but the situation of the runtime is  not  so:

    for example :  to add  "imgenc_copy_ti.h" , "aa.c" and the lib files,

    1  when config the package.bld as this:

    var SRCS = ["imgenc_copy"];
    Pkg.otherFiles =["imgenc_copy_ti.h"]
    Pkg.otherSrcs=["aa.c"]

    Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(SRCS);               or  
    Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(Pkg.otherSrcs); or //  I had tried in these three ways

    Pkg.addLibrary("lib/imgenc_copy", targ).addO bjects(["aa.c"]);

     Only  "imgenc_copy_ti.h" and the lib files was inclued in relased tar file.

    2 when config the package.bld as this:

    //var SRCS = ["imgenc_copy"];
    Pkg.otherFiles =["imgenc_copy_ti.h","aa.c"]
    //Pkg.otherSrcs=["aa.c"]

    Pkg.addLibrary("lib/imgenc_copy", targ);

    //Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(SRCS);

    noticed that  some  I had commented some lines.

    the files (imgenc_copy, aa.c ,lib files )was correctly inclued in the relased tar file.

    Does there are any wrong configurations in the first example? hope you can give an example of how to correctly use these configurations.

    the following is the  entire contents of my package.bld :

    /*
     *  ======== package.bld ========
     */

    var Build = xdc.useModule('xdc.bld.BuildEnvironment');
    var Pkg = xdc.useModule('xdc.bld.PackageContents');

    /* when constructing a release, release everything */
    //Pkg.attrs.exportAll = true;
    Pkg.attrs.exportAll = false;
    // Uncomment this to build debug binaries
    //Pkg.attrs.profile = "debug";

    /*
     * Create an array containing the files to include in this package.  Note
     * that the extension is added by XDC, so it need not be explicitly specified.
     */

    //var SRCS = ["imgenc_copy"];
    Pkg.otherFiles =["imgenc_copy_ti.h","aa.c","imgenc_copy.c"]
    //Pkg.otherSrcs=["aa.c"]

    for (var i = 0; i < Build.targets.length; i++) {
        var targ = Build.targets[i];

        print("building for target " + targ.name + " ...");

        /*
         * Add a library to this package and add the files described in
         * SRCS to the library.
         */
         Pkg.addLibrary("lib/imgenc_copy", targ);
        //Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(SRCS);
        //Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(Pkg.otherSrcs);
        //Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(["aa.c"]);
    }

  • Aaron,

    In the following case:

    1  when config the package.bld as this:

    var SRCS = ["imgenc_copy"];
    Pkg.otherFiles =["imgenc_copy_ti.h"]
    Pkg.otherSrcs=["aa.c"]

    Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(SRCS);               or  
    Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(Pkg.otherSrcs); or //  I had tried in these three ways

    Pkg.addLibrary("lib/imgenc_copy", targ).addO bjects(["aa.c"]);

     Only  "imgenc_copy_ti.h" and the lib files was inclued in relased tar file.

    you only get "imgenc_copy_ti.h" and the lib files in the tar file, because Pkg.otherFiles only contains "imgenc_copy_ti.h".  If you also want the file, "aa.c", added to the tar file, you need to add it to Pkg.otherFiles[], as you have in the second case.

    Best regards,

        Janet

  • AaronYang said:

    1  when config the package.bld as this:

    var SRCS = ["imgenc_copy"];
    Pkg.otherFiles =["imgenc_copy_ti.h"]
    Pkg.otherSrcs=["aa.c"]

    Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(SRCS);               or  
    Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(Pkg.otherSrcs); or //  I had tried in these three ways

    Pkg.addLibrary("lib/imgenc_copy", targ).addO bjects(["aa.c"]);

     Only  "imgenc_copy_ti.h" and the lib files was inclued in relased tar file.

    Right.  Adding a file to Pkg.otherSrcs does not add the file to the package _if_ the package does not export sources (Pkg.exportSrc == false, which is the default).  Similarly, adding a source file to a library does not add the the source to the package; only the compiled source in the library is added. 

    To unconditionally include any file (or directory) to a package, you should add it to the Pkg.otherFiles array. See http://rtsc.eclipse.org/cdoc-tip/index.html#xdc/bld/PackageContents.html#other.Files.

    Setting Pkg.exportSrc to true, will result in all sources added to any library _and_ any files listed in Pkg.otherSrcs to be added to the package's release archive file.

    AaronYang said:

    2 when config the package.bld as this:

    //var SRCS = ["imgenc_copy"];
    Pkg.otherFiles =["imgenc_copy_ti.h","aa.c"]
    //Pkg.otherSrcs=["aa.c"]

    Pkg.addLibrary("lib/imgenc_copy", targ);

    //Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(SRCS);

    noticed that  some  I had commented some lines.

    the files (imgenc_copy, aa.c ,lib files )was correctly inclued in the relased tar file.

    In this case, the library was added but did not contain the compiled version of imgenc_copy.c or aac.c (because they were not added with addObjects).  But aa.c and imgenc_copy_ti.h are included because you added them to the Pkg.otherFiles array.

    AaronYang said:

    Does there are any wrong configurations in the first example? hope you can give an example of how to correctly use these configurations.

    the following is the  entire contents of my package.bld :

    /*
     *  ======== package.bld ========
     */

    var Build = xdc.useModule('xdc.bld.BuildEnvironment');
    var Pkg = xdc.useModule('xdc.bld.PackageContents');

    /* when constructing a release, release everything */
    //Pkg.attrs.exportAll = true;
    Pkg.attrs.exportAll = false;
    // Uncomment this to build debug binaries
    //Pkg.attrs.profile = "debug";

    /*
     * Create an array containing the files to include in this package.  Note
     * that the extension is added by XDC, so it need not be explicitly specified.
     */

    //var SRCS = ["imgenc_copy"];
    Pkg.otherFiles =["imgenc_copy_ti.h","aa.c","imgenc_copy.c"]
    //Pkg.otherSrcs=["aa.c"]

    for (var i = 0; i < Build.targets.length; i++) {
        var targ = Build.targets[i];

        print("building for target " + targ.name + " ...");

        /*
         * Add a library to this package and add the files described in
         * SRCS to the library.
         */
         Pkg.addLibrary("lib/imgenc_copy", targ);
        //Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(SRCS);
        //Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(Pkg.otherSrcs);
        //Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(["aa.c"]);
    }

    The following is, I think, what you want:

    /*
     *  ======== package.bld ========
     */

    var Build = xdc.useModule('xdc.bld.BuildEnvironment');
    var Pkg = xdc.useModule('xdc.bld.PackageContents');

    // Uncomment this to build debug binaries
    //Pkg.attrs.profile = "debug";

    /* Create an array containing the files to include in this package.  */

    Pkg.otherFiles =["imgenc_copy_ti.h", "aa.c"];

    for (var i = 0; i < Build.targets.length; i++) {
        var targ = Build.targets[i];

        print("building for target " + targ.name + " ...");

        /*
         * Add a library to this package and add the files described in
         * SRCS to the library.
         */
        Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(["aa.c",
    "imgenc_copy.c"]);
    }

    In this case, the files imgenc_copy.c and aa.c will be compiled and added to the library but  imgenc_copy.c will _not_ be included in the package's release archive.

  • thank you very much。while the last question is :

    Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(SRCS);

    does the addObjects function  means that to compiled the src files in the library 。no matter Pkg.attrs.exportAll is true or false?

    if true ,then the src files will included in the package ;if false they wouldn't 。

    Am I right?


  • AaronYang said:

    thank you very much。while the last question is :

    Pkg.addLibrary("lib/imgenc_copy", targ).addObjects(SRCS);

    does the addObjects function  means that to compiled the src files in the library 。no matter Pkg.attrs.exportAll is true or false?

    The addObjects function means: "compile the specified sources and add only the _compiled object files_ to the library (or executable)".

    AaronYang said:

    if true ,then the src files will included in the package ;if false they wouldn't 。

    Am I right?

    The inclusion of source files is controlled independently of the object files derived from the sources.  By default, when you build a package's release, _only_ compiled object files are included. 

    To get sources in the package's release, you must explicitly specify (for example, via Pkg.attrs.export* properties or Pkg.other* lists)  the sources to include.


     

  • Hi,

    Janet.

    Could you help me with the problem here.

    Hope for your help.

    Regards,

    Yang