coapp / coapp.powershell

ClrPlus Signing
52 stars 43 forks source link

Include-like treatment for groups of libs #71

Open swn1 opened 10 years ago

swn1 commented 10 years ago

I'm packaging a bunch of third-party SDKs and often they have a fairly large number of .lib files with headers controlling which ones the linker looks for. In this situation I want to add the folder containing the libs to the linker's include path (AddtionalLibraryDirectories) rather than forcing it to scan all of the libs.

I hacked it together by following the pattern from the default rules document and it works great. Suggested feature.

Also, as a new user, correlating the checkin history with the releases is kind of hard. Especially when the only keys to the update process seem to be -beta and -developer. And it won't let you go back, I had to uninstall/reinstall to go back to the stable release.

Still, it's doing what it says on the tin. It's taken me a few days work to get up to a level of productivity with it but it's rolling now.

swn1 commented 10 years ago

Here's the (somewhat redacted) logic.... files{

defines{

        F32 = ........\Program Files (x86)\Fortran...;
        F64 = ........\Program Files (x86)\Fortran...;
        d_adlib = ${lib_root}\adlib\${conditionFolder};
    }
            // pivot-conditional blocks for bin (_.dll) and adlib (_.lib)
    adlib += {
        #output {
            package = default;
        }
        #add-folder : ::nuget.targets.[${condition}].LibDirs;
        #destination = ${d_adlib};
    }
}
targets {
    @alias LibDirs = ItemDefinitionGroup.Link.AdditionalLibraryDirectories;
}
props {
    @alias LibDirs = ItemDefinitionGroup.Link.AdditionalLibraryDirectories;
}

I imagine a better name than "adlib" should be chosen if this suggestion is adopted :-)

swn1 commented 10 years ago

I was unable to use the environment variable giving the compiler's installation path to pick up the redist files because the resulting string is an absolute path complete with drive letter and the packager simply would not pick up files specified that way. As soon as I made it relative it started working.

Another even more esoteric issue came up here: the compiler vendor provides a text file listing the names of the component files that are licensed for redistribution. In my old msbuild script I passed the file to the copy command and ignored missing files, thus ensuring by construction that i did not put unlicensed files into our output folder. Converting to autopkg I had to paste the list in, decorate each entry with the appropriate path prefix macro and trailing comma, and comment out the ones that aren't there.

MSBuild item lists are a Turing-complete basis; in particular you can do set intersection with them. So I'm pretty sure I could find a way to pass the needed logic through the packager if I tried hard enough. Just mentioning this as a use case that came up in real life.