[Dlang-internal] druntime: proposed changes in code organization

Denis Feklushkin feklushkin.denis at gmail.com
Sat Dec 2 14:02:07 UTC 2023


On Saturday, 2 December 2023 at 12:30:31 UTC, IGotD- wrote:
> On Saturday, 2 December 2023 at 08:10:57 UTC, Denis Feklushkin 
> wrote:
>>
>>> Also one question if the tags are visible inside the D code 
>>> or just outside the code in the build system?
>>
>> Tags are visible only for druntime build system
>>
>
> The tags, how are they injected into the build system?

Tags defined in the build script. For DMD, druntime/posix.mak:
```make
# TODO: implement tags table
ifeq ($(MODEL), 64)
	ARCH=x86_64
else
	ARCH=x86
endif

ifeq ($(OS), Win_64)
	# Tags order doesn't matter
	TAGS:=windows,default,$(ARCH)
else
	TAGS:=$(ARCH),posix,$(OS),default
endif
```

In the future it will be trivial to add environment variable or 
option for manual setting tags and dir(s) to expand ability of 
builds for various platforms

> Keep in mind that we have several types of build systems in the 
> D project. I think DMD uses traditional make files. LDC uses 
> Cmake.

Yes. (+I use Meson for druntime builds for experimental embedded 
targets)

ldc/runtime/CMakeLists.txt contains:
```make
# only include core/sys/ modules matching the platform
file(GLOB_RECURSE DRUNTIME_D_BIONIC  
${RUNTIME_DIR}/src/core/sys/bionic/*.d)
file(GLOB_RECURSE DRUNTIME_D_DARWIN  
${RUNTIME_DIR}/src/core/sys/darwin/*.d)
file(GLOB_RECURSE DRUNTIME_D_DRAGONFLYBSD 
${RUNTIME_DIR}/src/core/sys/dragonflybsd/*.d)
```

I don't know CMake deeply, but it looks like it is not too 
difficult to adopt proposed changes into LDC build facility

> Are they going to be a separate file where you just define 
> variables for build system?

Most likely, this will not be done due to the fact that all build 
systems are too different (Although I just found similar idea in 
my comment "TODO: implement tags table")


More information about the Dlang-internal mailing list