Commit Graph

103 Commits (1634461bd208f4bd108ea5c3d3f1cf9eb56d4a7e)

Author SHA1 Message Date
Roman Yeryomin 2ca084ccaa build: improve ccache support
Set CCACHE_DIR to $(TOPDIR)/.ccache and CCACHE_BASEDIR to $(TOPDIR).
This allows to do clean and dirclean. Cache hit rate for test build
after dirclean is ~65%.
If CCACHE is enabled stats are printed out at the end of building process.
CCACHE_DIR config variable allows to override default, which could be useful
when sharing cache with many builds.
cacheclean make target allows to clean the cache.

Changes from v1:
- remove ccache directory using CCACHE_DIR variable
- remove ccache leftovers from sdk and toolchain make files
- introduce CONFIG_CCACHE_DIR variable
- introduce cacheclean make target

Signed-off-by: Roman Yeryomin <roman@advem.lv>
4 years ago
Andre Heider 02330a6556 build: call Host/Uninstall before wiping the host build dir
Uninstall targets may depend on build artefacts, like `make uninstall`
or `ninja uninstall`.

Signed-off-by: Andre Heider <a.heider@gmail.com>
5 years ago
Jo-Philipp Wich 991c7a4f69 build: do not override CCACHE_DIR when ccache is disabled
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
6 years ago
Felix Fietkau a1c65b41cb build: pass HOSTCXX to host builds as CXX
Fixes cmake build on some systems that also have an older clang++

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau 905bbc96ef build: allow PKG_PREPARED_DEPENDS and PKG_CONFIG_DEPENDS to be changed after including package.mk
Reverts commit a9c96ef0ac and replaces it
with a different approach

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau 603900ef82 build: add a darwin sitefile to deal with macOS 10.12 + Xcode 9 build errors
Certain functions are available in system headers, but only work on
macOS 10.13

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau f62f4b3c5c build: stop overriding STAGING_DIR_HOST for toolchain build
This causes various issues in other places that assume that host
binaries are staged in STAGING_DIR_HOST.
Since all the right places use HOST_BUILD_PREFIX, override that instead.
This fixes some issues with quilt on toolchain dirs

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 89118da865 build: fix STAMP_PREPARED with quilt
quilt.mk needs to be included first, to ensure that STAMP_PREPARED does
not include the hash if quilt is used.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau a9c96ef0ac build: improve performance by avoiding lazy-eval for make shell calls
Avoids lots of redundant calls to mkhash on things like
package/kernel/linux

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 9467ce42da build: get rid of host.mk
Defined required host related variables in toplevel.mk instead

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau fe1e3622a2 build: make Host/Install/Default use Host/Compile/Default with an extra argument
Allows parallelizing compile steps that might be necessary during install

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 849ced84f6 build: support make tools/<name>/install again
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 0e22d63775 build: fix CONFIG_AUTOREMOVE for packages with multiple variants
Calling the clean target removes all .ipk files and un-stages the
package. Add a new target just for clearing the build dir and call that
one instead of the full clean target

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 5aa03e16a7 build: disable CONFIG_AUTOREMOVE for packages/tools where QUILT is used
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau bc73a7fd98 build: include CONFIG_AUTOREMOVE in HOST_STAMP_PREPARED
Fixes build issues when changing the CONFIG_AUTOREMOVE setting

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau d98bb7e6b9 build: extend CONFIG_AUTOREMOVE to tools/
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 131db366a3 build: remove separate /install step for host builds
Reduces the number of recursive make invocations

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 9228d1c066 build: introduce extra targets that contain only proper dependencies
This can be used to check if targets like prepare or compile are up to date

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 6cf067d084 build: define common subdir targets in rules.mk
Reduce build system clutter and enable further rework

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Matthias Schiffer 3d71786154
build: move STAGING_DIR_HOSTPKG and BUILD_DIR_HOST back to a common directory for all targets
Using a single host package staging dir (and build dir) significantly speeds up
builds when multiple targets are built in succession, especially for large host
packages like NodeJS.

$(STAGING_DIR)/host is kept in addition to $(STAGING_DIR_HOSTPKG) in most
places; it is still used as destination for host files in Build/InstallDev.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
7 years ago
Jo-Philipp Wich 5faad30d5d build: properly pass CPP and CXX flags in HOST_MAKE_VARS
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
7 years ago
Alexandru Ardelean e9d20f1f87 build: introduce default HOST_MAKE_VARS for host-builds
Inspired/adapted from `package-defaults.mk` MAKE_VARS.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years ago
Jo-Philipp Wich 83b6bfc235 build: fix HOST_CONFIGURE_VARS placement
Instead of passing HOST_CONFIGURE_VARS as arguments to the configure script,
pass it as environment variables which brings the logic in line with the
behaviour of package-defaults.mk.

The change is needed since passing environment variables as configure
parameters only works with GNU autoconf which evaluates command line arguments
looking like variable assignments. Doing the same with non-autoconf configure
scripts is not guaranteed to work since such scripts might terminate due to
unknown argument errors.

One example case is the cmake configure script which bails out when called
as "./configure LDFLAGS=..." but not when called as "LDFLAGS=... ./configure".

Also change the SHELL override to CONFIG_SHELL in the default
HOST_CONFIGURE_VARS as the former is not properly propagated through the
various GNU configure invocations since it gets lost when configure re-
executes itself.

A prior attempt to change the variable placement had to be reverted due to
the missing SHELL -> CONFIG_SHELL change, leading to misgenerated libtool
executables in various packages.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
7 years ago
Felix Fietkau 1e1d735e52 build: remove obsolete parallel build related options
Always use the main make jobserver, which has been the default for ages

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Jo-Philipp Wich 267b05f273 Revert "build: fix HOST_CONFIGURE_VARS placement"
This reverts commit 8395b63aac616f72fd835c59240fc2a4a6b28106.

Various host builds currently rely on the broken behaviour of
HOST_CONFIGURE_VARS so roll back to the previous state.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
7 years ago
Jo-Philipp Wich 28f9df62f5 build: fix HOST_CONFIGURE_VARS placement
Ensure that HOST_CONFIGURE_VARS are set before the actual configure command
instead of passing them as configure command arguments.

This change brings host-build.mk in line with package-defaults.mk and makes
host configure environment variables work as expected.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
7 years ago
Felix Fietkau bdaa138c0d host-build: remove openssl include path from host cflags
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau ffb0181a87 build: add defaults for PKG_SOURCE, PKG_SOURCE_SUBDIR, PKG_VERSION
This makes it easier to unify versioning of git based package downloads.
PKG_SOURCE_DATE along with an 8-character abbreviation of the git hash
is used as PKG_VERSION, PKG_RELEASE should be used like normal packages.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 7a315b0b5d build: implement make check and make package/X/check
This is intended to be used for a wide array of package sanity checks.

The first check that is implemented is for the hash of downloaded files.
It checks:
  - Missing hash
  - Use of SHA256 instead of MD5
  - dl/<file> hash not matching hash in makefile
  - deprecated MD5SUM variable

The deprecated MD5SUM variable check is skipped for feeds/ until OpenWrt
is updated as well

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 881c5b47ec build: remove duplicate Download/default definition from include/host-build.mk
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Jo-Philipp Wich b7f7e9fe42 include/host-build.mk: use STAGING_DIR_HOSTPKG
Instead of hardcoding $(STAGING_DIR)/host, use the new $(STAGING_DIR_HOSTPKG)
variable to refer to the directory.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years ago
Alexandru Ardelean 7c8c3226dc build: copy contents of 'src' folder to build dirs (if present)
The normal Prepare step for a build is unpack, apply patches.
But for certain packages, patches contain whole files, which
would be nice to have separately and copied over as a last step
in the Prepare phase.

We need it for some other packages + patches, but I think
the 'hostapd' package can be used as a test for this.

As a quick note:
the reason the condition is being evaluated as
`[ ! -d ./src/ ] || $(CP) ./src/* $(HOST_BUILD_DIR)`
and not with
`[ -d ./src/ ] && $(CP) ./src/* $(HOST_BUILD_DIR)`
is that the latter would translate in a build failure if the `src`
folder is not present (the exit code would be 1).
The first one, succeeds for both cases (if `src` present or not).

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
8 years ago
Matthias Schiffer cb718eb34b
include/host-build.mk: set Host/Exports for Host/Install step
Having a different PATH in Host/Install than in other steps like Host/Build
is confusing and easily leads to mistakes. Setting all of Host/Exports
makes host builds match target builds (Build/Install is part of
$(STAMP_BUILT), which has Build/Exports set).

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
8 years ago
Matthias Schiffer 4ada2fd276
include/host-build.mk: fix ACLOCAL_INCLUDE
It seems the intention was to add both $(STAGING_DIR_HOST)/... and
$(STAGING_DIR)/host/... instead of passing $(STAGING_DIR_HOST) twice. This
makes the definition match HOST_CPPFLAGS and HOST_LDFLAGS.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
8 years ago
Matthias Schiffer 7064a849ce
include/host-build.mk: pass HOST_BUILD_PREFIX to Host/install
Using HOST_BUILD_PREFIX instead of STAGING_DIR_HOST will make the argument
work as expected from packages.

Nothing changes for tools, for which HOST_BUILD_PREFIX and STAGING_DIR_HOST
are equivalent.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
8 years ago
Felix Fietkau 4170267f5a build: pass $(STAGING_DIR_HOST) to Host/Install
makes it more consistent with package builds

Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Matthias Schiffer 6fb212f293
build: don't add -j for parallel builds with Make 4.2+
Make usually passes -j and jobserver arguments as part of MAKEFLAGS. LEDE
removes MAKEFLAGS to have better control of the build, and re-adds the
jobserver arguments with -j to the Make commandline where desired.

Make 4.2+ behave differently with these arguments passed on the commandline
than in MAKEFLAGS: -j will override the jobserver argument and the job
count will be unlimited.

Moving the flags to MAKEFLAGS will need many packages to be changed and
tested; therefore, we opt for a less invasive change for now and just
remove -j for Make 4.2+, as the jobserver argument alone is enough to
enable parallel builds for these Make versions.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
8 years ago
Felix Fietkau 03bc8d94f0 host-build.mk: change default installation prefix of package/* host builds to staging_dir/target-*/host
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48401
8 years ago
Felix Fietkau 48374a3a9c build: include homebrew include/library directory in cflags/ldflags on mac os x
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 47139
9 years ago
Felix Fietkau c99c9f875e build: set CCACHE_DIR for host builds
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 45427
9 years ago
Jo-Philipp Wich 60eef7aefd include: use SHELL, not BASH for HOST_CONFIGURE_VARS
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 44295
9 years ago
Jo-Philipp Wich 971ec0283c include: remove static tool linking support
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 44286
9 years ago
Felix Fietkau f6f0984c43 build: prevent spurious host-build re-builds by touching .built after the install command before touching .installed
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43721
10 years ago
Felix Fietkau 1f77bfff96 build: BSD compile fixes
following patch allows to build images for Qemu ARM on
OpenBSD 5.2 amd64 and FreeBSD 9.1 amd64.

Mostly small pieces of code changes to get things right on the
specific platform.

Updated the README to describe better, which tools on the host
are required. Added some kind of prepare scripts to install needed
tools on BSD via packages.

Signed-off-by: Waldemar Brodkorb <mail@waldemar-brodkorb.de>

SVN-Revision: 35900
11 years ago
Felix Fietkau 6d1884c583 build: fix host build stampfile usage, fixes spurious errors with missing opkg host binary after deleting the staging dir
SVN-Revision: 33776
12 years ago
Felix Fietkau ed2bf29be5 build: add the + token to any commands that can pass through the jobserver, fixes parallel build on some systems
SVN-Revision: 33523
12 years ago
Felix Fietkau 1c108d3318 host-build: add HOST_MAKE_FLAGS similar to package MAKE_FLAGS
SVN-Revision: 33509
12 years ago
Felix Fietkau b086475e1e build: ensure that package/host-build build system code does not run in parallel, fixes rare spurious parallel build failures
SVN-Revision: 33445
12 years ago
Felix Fietkau f19dbfff91 build: add jobserver support for host builds
SVN-Revision: 33423
12 years ago
Jo-Philipp Wich 8726a422cd do not pass optimization flags in HOST_CPPFLAGS (#12153)
SVN-Revision: 33351
12 years ago