Skip to content

Commit 139f7b8

Browse files
Merge pull request #30 from foss-for-synopsys-dwc-arc-processors/luis_custom_src_parent_wip
Option for specifying custom parent source path
2 parents e118429 + c1660cf commit 139f7b8

File tree

3 files changed

+65
-39
lines changed

3 files changed

+65
-39
lines changed

Makefile.in

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,33 @@ LINUX_BRANCH := arc64
2323

2424

2525
BINUTILS_SRCDIR := @with_binutils_src@
26-
ifeq ($(BINUTILS_SRCDIR),)
27-
BINUTILS_SRCDIR := $(srcdir)/binutils-gdb
28-
endif
2926
NEWLIB_SRCDIR := @with_newlib_src@
30-
ifeq ($(NEWLIB_SRCDIR),)
31-
NEWLIB_SRCDIR := $(srcdir)/newlib
32-
endif
3327
GCC_SRCDIR := @with_gcc_src@
34-
ifeq ($(GCC_SRCDIR),)
35-
GCC_SRCDIR := $(srcdir)/gcc
36-
endif
3728
GLIBC_SRCDIR := @with_glibc_src@
38-
ifeq ($(GLIBC_SRCDIR),)
39-
GLIBC_SRCDIR := $(srcdir)/glibc
40-
endif
4129
LINUX_SRCDIR := @with_linux_src@
42-
ifeq ($(LINUX_SRCDIR),)
43-
LINUX_SRCDIR := $(srcdir)/linux
44-
endif
4530
QEMU_SRCDIR := @with_qemu_src@
46-
ifeq ($(QEMU_SRCDIR),)
47-
QEMU_SRCDIR := $(srcdir)/qemu
31+
32+
PARENT_SRCDIR = @with_src@
33+
34+
ifneq ($(PARENT_SRCDIR),)
35+
ifeq ($(BINUTILS_SRCDIR),$(srcdir)/binutils-gdb)
36+
BINUTILS_SRCDIR = $(PARENT_SRCDIR)/binutils-gdb
37+
endif
38+
ifeq ($(NEWLIB_SRCDIR),$(srcdir)/newlib)
39+
NEWLIB_SRCDIR = $(PARENT_SRCDIR)/newlib
40+
endif
41+
ifeq ($(GCC_SRCDIR),$(srcdir)/gcc)
42+
GCC_SRCDIR = $(PARENT_SRCDIR)/gcc
43+
endif
44+
ifeq ($(GLIBC_SRCDIR),$(srcdir)/glibc)
45+
GLIBC_SRCDIR = $(PARENT_SRCDIR)/glibc
46+
endif
47+
ifeq ($(LINUX_SRCDIR),$(srcdir)/linux)
48+
LINUX_SRCDIR = $(PARENT_SRCDIR)/linux
49+
endif
50+
ifeq ($(QEMU_SRCDIR),$(srcdir)/qemu)
51+
QEMU_SRCDIR = $(PARENT_SRCDIR)/qemu
52+
endif
4853
endif
4954

5055
SYSROOT := $(INSTALL_DIR)/sysroot

README.md

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,22 @@ newlib
1717
glibc
1818
```
1919

20-
If they do not exist, it will clone them. You can link your source directories
21-
from other palces as well:
20+
If they do not exist, it will clone them.
2221

23-
```sh
24-
cd /repos/arc-gnu-toolchain
25-
ln -s /repos/tools/binutils binutils-gdb
26-
ln -s /repos/tools/gcc gcc
27-
ln -s /repos/tools/newlib newlib
28-
ln -s /repos/tools/glibc glibc
22+
The `arc-gnu-toolchain` also provides the capability to build the toolchain using source code located outside of the main repository. There are specific configuration options available to define the source directory for each component or for a parent directory.
23+
24+
As an example, if you have an external GCC source, you can use the `--with-gcc-src` option to specify it:
25+
26+
```bash
27+
28+
./configure --with-gcc-src=/path/to/gcc
29+
```
30+
31+
Similarly, if you have an external parent directory that encompasses all the sources, you can use the `--with-src` option to inicate its location:
32+
33+
```bash
2934

30-
cd /build/arc64
31-
/repos/arc-gnu-toolchain/configure ...
35+
./configure --with-src=/path/to/parent
3236
```
3337

3438
For a 64-bit linux build, you will need the following branches:
@@ -122,17 +126,24 @@ make install
122126

123127
Some of parameters you can pass to the configure script:
124128

125-
| parameter | default | values |
126-
|---------------------|---------|---------------------------------------------------------------------------------|
127-
| --target | | arc64, arc32, arc |
128-
| --prefix | | any path string for installation |
129-
| --enable-linux | no | yes, no (--disable-linux) |
130-
| --enable-multilib | no | yes, no (--disable-multilib) |
131-
| --enable-qemu | no | yes, no (--disable-qemu) |
132-
| --enable-debug-info | no | yes, no (--disable-debug-info) |
133-
| --with-fpu | none | none, fpus, fpud |
134-
| --with-cpu | none | none, hs6x, hs68, hs5x, hs58, archs, (more at binutils/include/elf/arc-cpu.def) |
135-
| --with-sim | qemu | qemu, nsim |
129+
| parameter | default | values |
130+
|---------------------|-------------------|---------------------------------------------------------------------------------|
131+
| --target | | arc64, arc32, arc |
132+
| --prefix | | any path string for installation |
133+
| --enable-linux | no | yes, no (--disable-linux) |
134+
| --enable-multilib | no | yes, no (--disable-multilib) |
135+
| --enable-qemu | no | yes, no (--disable-qemu) |
136+
| --enable-debug-info | no | yes, no (--disable-debug-info) |
137+
| --with-fpu | none | none, fpus, fpud |
138+
| --with-cpu | none | none, hs6x, hs68, hs5x, hs58, archs, (more at binutils/include/elf/arc-cpu.def) |
139+
| --with-sim | qemu | qemu, nsim |
140+
| --with-src | arc-gnu-toolchain | /path/to/parent |
141+
| --with-binutils-src | ./binutils-gdb | /path/to/binutils-gdb |
142+
| --with-newlib-src | ./newlib | /path/to/newlib |
143+
| --with-gcc-src | ./gcc | /path/to/gcc |
144+
| --with-glibc-src | ./glibc | /path/to/glibc |
145+
| --with-linux-src | ./linux | /path/to/linux |
146+
| --with-qemu-src | ./qemu | /path/to/qemu |
136147

137148
### Advanced Options
138149

configure.ac

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,23 @@ AC_DEFUN([AX_ARG_WITH_SRC],
177177
m4_popdef([opt_name])
178178
}])
179179

180-
AX_ARG_WITH_SRC(binutils, binutils)
180+
AX_ARG_WITH_SRC(binutils, binutils-gdb)
181181
AX_ARG_WITH_SRC(newlib, newlib)
182182
AX_ARG_WITH_SRC(gcc, gcc)
183183
AX_ARG_WITH_SRC(glibc, glibc)
184184
AX_ARG_WITH_SRC(linux, linux)
185185
AX_ARG_WITH_SRC(qemu, qemu)
186186

187+
AC_ARG_WITH(src,
188+
[AS_HELP_STRING([--with-src],
189+
[Select parent source path, use `arc-gnu-toolchain` as parent source path by default])],
190+
[],
191+
[]
192+
)
193+
AS_IF([test "x$with_src" != x],
194+
[AC_SUBST(with_src, $with_src)],
195+
[AC_SUBST(with_src, "")])
196+
187197

188198
AC_ARG_WITH(target_cflags,
189199
[AS_HELP_STRING([--with-target-cflags],

0 commit comments

Comments
 (0)