1SUMMARY="Assembler, linker and binary tools for Atmel AVR"
2DESCRIPTION="The GNU Binutils are a collection of binary tools.
3
4The main ones are:
5- ld - the GNU linker.
6- as - the GNU assembler.
7
8But they also include:
9- addr2line - converts addresses into filenames and line numbers.
10- ar - a utility for creating, modifying and extracting of archives.
11- c++filt - filter to demangle encoded C++ symbols.
12- nm - lists symbols from object files.
13- objcopy - copys and translates object files.
14- objdump - displays information from object files.
15- ranlib - generates an index to the contents of an archive.
16- readelf - displays information from any ELF format object file.
17- size - lists the section sizes of an object or archive file.
18- strings - lists printable strings from files.
19- strip - discards symbols.
20
21The tools of this package can be used for cross-builds to Atmel AVR."
22HOMEPAGE="https://www.gnu.org/software/binutils"
23COPYRIGHT="1988-2023 Free Software Foundation, Inc."
24LICENSE="GNU GPL v3
25	GNU LGPL v3"
26REVISION="1"
27SOURCE_URI="https://ftp.gnu.org/gnu/binutils/binutils-$portVersion.tar.xz"
28SOURCE_DIR="binutils-$portVersion"
29CHECKSUM_SHA256="0f8a4c272d7f17f369ded10a4aca28b8e304828e95526da482b0ccc4dfc9d8e1"
30
31ARCHITECTURES="all !x86_gcc2"
32SECONDARY_ARCHITECTURES="x86"
33
34PROVIDES="
35	avr_binutils$secondaryArchSuffix = $portVersion compat >= 2.23
36	cmd:avr_addr2line = $portVersion compat >= 2.23
37	cmd:avr_ar = $portVersion compat >= 2.23
38	cmd:avr_as = $portVersion compat >= 2.23
39	cmd:avr_c++filt = $portVersion compat >= 2.23
40	cmd:avr_elfedit = $portVersion compat >= 2.23
41	cmd:avr_gprof = $portVersion compat >= 2.23
42	cmd:avr_ld = $portVersion compat >= 2.23
43	cmd:avr_ld.bfd = $portVersion compat >= 2.23
44	cmd:avr_nm = $portVersion compat >= 2.23
45	cmd:avr_objcopy = $portVersion compat >= 2.23
46	cmd:avr_objdump = $portVersion compat >= 2.23
47	cmd:avr_ranlib = $portVersion compat >= 2.23
48	cmd:avr_readelf = $portVersion compat >= 2.23
49	cmd:avr_size = $portVersion compat >= 2.23
50	cmd:avr_strings = $portVersion compat >= 2.23
51	cmd:avr_strip = $portVersion compat >= 2.23
52	lib:avr_libbfd_$portVersion = $portVersion compat >= 2.23
53	lib:avr_libopcodes_$portVersion = $portVersion compat >= 2.23
54	lib:libctf_nobfd = 0.0.0 compat >= 0
55	lib:libctf = 0.0.0 compat >= 0
56	lib:libsframe = 0.0.0 compat >= 0
57	devel:libctf_nobfd = 0.0.0 compat >= 0
58	devel:libctf = 0.0.0 compat >= 0
59	devel:libsframe = 0.0.0 compat >= 0
60	"
61
62REQUIRES="
63	binutils$secondaryArchSuffix
64	haiku$secondaryArchSuffix
65	"
66BUILD_REQUIRES="
67	haiku${secondaryArchSuffix}_devel
68	cmd:find
69	cmd:xargs
70	"
71BUILD_PREREQUIRES="
72	cmd:autoconf
73	cmd:awk
74	cmd:bison
75	cmd:find
76	cmd:flex
77	cmd:gcc$secondaryArchSuffix
78	cmd:ld$secondaryArchSuffix
79	cmd:make
80	cmd:makeinfo
81	cmd:sed
82	cmd:strip
83	cmd:tar
84	cmd:xargs
85	"
86
87BUILD_PACKAGE_ACTIVATION_PHASE=INSTALL
88
89sourceDir=$(pwd)
90relativeInstallDir="develop/tools/avr"
91installDir="$prefix/$relativeInstallDir"
92objectsDir=$(pwd)/../${portVersionedName}-obj
93
94BUILD()
95{
96	rm -rf $objectsDir
97
98	mkdir -p $objectsDir
99	cd $objectsDir
100
101	CFLAGS=-O2 CXXFLAGS=-O2 runConfigure --omit-dirs binDir \
102		"$sourceDir/configure" \
103		--exec-prefix=$installDir \
104		--includedir=$includeDir/binutils \
105		--docdir=$docDir --with-sysroot=$installDir \
106		--enable-deterministic-archives --enable-shared=yes \
107		--disable-nls --bindir=$prefix/bin --target=avr
108
109	make $jobArgs LEXLIB=
110}
111
112INSTALL()
113{
114	cd $objectsDir
115
116	make install
117
118	# no info documentation
119	rm -r $infoDir
120
121	### Strip #################################################
122
123	echo "Strip debug info"
124
125	strip --strip-debug $prefix/bin/*
126
127	### Symlinks ##############################################
128
129	echo "Creating required symlinks"
130
131	# There are copies of a subset of the commands below installDir. We
132	# overwrite those with symlinks to the ones in binDir.
133	for file in $installDir/avr/bin/*; do
134		symlinkRelative -sfn $prefix/bin/avr-$(basename $file) $file
135	done
136
137	### Cleanup #################################################
138
139	echo "Cleanup"
140
141	# delete man pages for commands that we aren't including
142	cd $manDir
143	for cmd in dlltool nlmconv windmc windres; do
144		rm -f man1/$cmd.1
145	done
146
147	rm $libDir/*.la $libDir/*.a
148	prepareInstalledDevelLibs libctf libsframe
149}
150