Will this features be accepted for DUB?

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Fri Dec 16 09:21:13 PST 2016


On Friday, 16 December 2016 at 15:09:02 UTC, Ilya Yaroshenko 
wrote:
> On Friday, 16 December 2016 at 13:55:55 UTC, Guillaume Piolat 
> wrote:
>> Trying to answer with the existing dub.
>>
>> On Friday, 16 December 2016 at 13:21:53 UTC, Ilya Yaroshenko 
>> wrote:
>>> We need
>>> 1. a post fetch (build) options. GLAS should be builded only 
>>> in release, and in single file mode. It is a betterC library 
>>> with extern C interface.
>>
>> --combined -b release-nobounds
>>
>>> 2. ability to build C/C++ code, run makefiles.
>>
>> As Rikki said.
>>
>>> 3. ability to compose libraries.
>>
>> Not sure what you mean.
>>
>>> 4. ability to override a compiler for betterC libraries.
>>
>> Not sure what you mean. The selected compiler is outside the 
>> dub configurations with --compiler.
>> You probably know can have special LDC flags:
>>
>>
>>> DUB allows to set only compiler flags. I want to define how 
>>> betterC libraries should be builded inside their dub configs 
>>> instead of unified compiler/build options for all libs like 
>>> it works now.
>>
>> Dub configurations and dependencies sub-configurations let you 
>> define version identifiers from outside the library, and can 
>> have different "dflags" too.
>>
>> Example from product:
>>
>> ----------------
>>
>>         "configurations": [
>>         {
>>             "name": "VST-EE",
>>             "versions": ["VST", "full"],
>>             "targetType": "dynamicLibrary",
>>             "lflags-osx": [ "-exported_symbols_list", 
>> "source/module-vst.lst", "-dead_strip" ]
>>         },
>>
>> ----------------
>>
>> The tricky thing is to recognize where "lflags" or "dflags" 
>> are needed, and how this interact with --combined (dflags and 
>> lflags get merged then).
>>
>> Investment in dub pays dividend by being unified and makes 
>> sense after a while.
>
> This approach does not work for Mir GLAS.
> http://forum.dlang.org/post/dfqcgdfnxmnkreywoyhl@forum.dlang.org
>
> I can build a Mir GLAS library with DUB. But I can not do it 
> automatically with DUB, but want to do it.
>
> For example:
> ---
> "dependencies": {
>     "mir-glas": "<its recent version>"
> }
> ---
> will not work for a user because mir-glas should be prebuilded 
> with the following command:
>
> dub build --config=static --build=target-native 
> --compiler=ldmd2 --build-mode=singleFile --parallel
>
> And it should be builded this way whatever compiler and dub 
> options user use for his project.
>
> Ilya

Do you actually mean extern(C) or extern(D)? You said both at 
different points in this thread.

Perhaps this will give you an idea to start from:

name "mir-glas"
sourcePaths "folderWithDiFiles"
importPaths "folderWithDiFiles"
targetType "sourceLibrary"
preBuildCommands "dub build mir-glas-impl --config=static 
--build=target-native --compiler=ldmd2 --build-mode=singleFile 
--parallel"
libs "mir-glas-impl"
lflags "-L$MIR_GLAS_IMPL_PACKAGE_DIR"

$MIR_GLAS_IMPL_PACKAGE_DIR is defined by dub, as described in the 
docs at https://code.dlang.org/package-format?lang=sdl (search 
for $<name>_PACKAGE_DIR)


More information about the Digitalmars-d mailing list