-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,347 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Source: mustbuild | ||
Section: devel | ||
Priority: optional | ||
Maintainer: Oliver Reiche <[email protected]> | ||
Build-Depends: debhelper-compat (= COMPAT_LEVEL), BUILD_DEPENDS | ||
Standards-Version: 4.6.1.0 | ||
Homepage: https://github.com/oreiche/mustbuild | ||
Vcs-Browser: https://github.com/oreiche/mustbuild | ||
Vcs-Git: https://github.com/oreiche/mustbuild.git | ||
Rules-Requires-Root: no | ||
|
||
Package: mustbuild | ||
Architecture: any | ||
Depends: ${shlibs:Depends}, ${misc:Depends} | ||
Recommends: python3, bash-completion, git (>= 2.29) | ||
Description: mustbuild generic build system | ||
Mustbuild is a friendly fork of Justbuild. It is is maintained as a patch | ||
series. This fork introduces extensions that mainly focus on improving | ||
usability while being fully compatible with existing Justbuild projects. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
Upstream-Name: mustbuild | ||
Upstream-Contact: mustbuild developers <[email protected]> | ||
|
||
Files: * | ||
Copyright: 2024 Oliver Reiche <[email protected]> | ||
License: Apache-2.0 | ||
|
||
Files: debian/third_party/* | ||
Copyright and license contained in corresponding archive. | ||
|
||
License: Apache-2.0 | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
. | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
. | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
. | ||
On Debian systems, the complete text of the Apache License, Version 2 | ||
can be found in "/usr/share/common-licenses/Apache-2.0". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
PREFIX ?= /usr | ||
DATADIR ?= $(CURDIR)/debian | ||
BUILDDIR ?= $(DATADIR)/build | ||
DISTFILES ?= $(DATADIR)/third_party | ||
|
||
ifeq ($(shell uname -m),aarch64) | ||
ARCH ?= arm64 | ||
else | ||
ARCH ?= x86_64 | ||
endif | ||
TARGET_ARCH ?= $(ARCH) | ||
|
||
export LOCALBASE = /usr | ||
export NON_LOCAL_DEPS = $(shell cat $(DATADIR)/non_local_deps) | ||
export SOURCE_DATE_EPOCH = $(shell dpkg-parsechangelog -STimestamp) | ||
export VERSION_EXTRA_SUFFIX = $(shell cat $(DATADIR)/git_version_suffix) | ||
export INCLUDE_PATH = $(BUILDDIR)/include | ||
export PKG_CONFIG_PATH = $(BUILDDIR)/pkgconfig | ||
|
||
CFLAGS += -I$(INCLUDE_PATH) | ||
CXXFLAGS += -I$(INCLUDE_PATH) | ||
|
||
define JUST_BUILD_CONF | ||
{ "TOOLCHAIN_CONFIG": {"FAMILY": "gnu"} | ||
, "ARCH": "$(ARCH)" | ||
, "TARGET_ARCH": "$(TARGET_ARCH)" | ||
, "SOURCE_DATE_EPOCH": $(SOURCE_DATE_EPOCH) | ||
, "VERSION_EXTRA_SUFFIX": "$(VERSION_EXTRA_SUFFIX)" | ||
, "ADD_CFLAGS": [$(shell printf '"%s"\n' $(CFLAGS) | paste -sd,)] | ||
, "ADD_CXXFLAGS": [$(shell printf '"%s"\n' $(CXXFLAGS) | paste -sd,)] | ||
} | ||
endef | ||
export JUST_BUILD_CONF | ||
|
||
# set dummy proxy to prevent _any_ downloads from happening during bootstrap | ||
export http_proxy = http://8.8.8.8:3128 | ||
export https_proxy = http://8.8.8.8:3128 | ||
|
||
|
||
all: mustbuild | ||
|
||
$(INCLUDE_PATH): | ||
@mkdir -p $@ | ||
if [ -d $(DATADIR)/include ]; then \ | ||
cp -r $(DATADIR)/include/. $@; \ | ||
fi | ||
|
||
$(PKG_CONFIG_PATH): | ||
@mkdir -p $@ | ||
if [ -d $(DATADIR)/pkgconfig ]; then \ | ||
cp -r $(DATADIR)/pkgconfig/. $@; \ | ||
find $@ -type f -exec sed 's|GEN_INCLUDES|'$(INCLUDE_PATH)'|g' -i {} \;; \ | ||
fi | ||
|
||
$(BUILDDIR)/out/bin/must: $(PKG_CONFIG_PATH) $(INCLUDE_PATH) | ||
env PACKAGE=YES BOOTSTRAP_TARGET=ALL python3 ./bin/bootstrap.py . $(BUILDDIR) $(DISTFILES) | ||
@touch $@ | ||
|
||
mustbuild: $(BUILDDIR)/out/bin/must | ||
|
||
install: mustbuild | ||
mkdir -p $(DESTDIR)/$(PREFIX) | ||
cp -ra $(BUILDDIR)/out/. $(DESTDIR)/$(PREFIX)/. | ||
|
||
clean: | ||
rm -rf $(BUILDDIR)/* | ||
|
||
distclean: clean | ||
rm -rf $(BUILDDIR) | ||
|
||
.PHONY: all mustbuild install clean distclean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/make -f | ||
|
||
|
||
%: | ||
dh $@ | ||
|
||
override_dh_clean: | ||
make -f debian/mustbuild.makefile clean | ||
dh_clean | ||
|
||
override_dh_auto_build: | ||
dh_auto_build --buildsystem=makefile -- -f debian/mustbuild.makefile | ||
|
||
override_dh_auto_install: | ||
dh_auto_install --buildsystem=makefile -- -f debian/mustbuild.makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version=4 | ||
opts="searchmode=plain,\ | ||
filenamemangle=s%.*/v?@ANY_VERSION@%@PACKAGE@-$1.tar.xz%" \ | ||
https://api.github.com/repos/oreiche/mustbuild/releases?per_page=50 \ | ||
https://api.github.com/repos/[^/]+/[^/]+/tarball/v?@ANY_VERSION@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
PREFIX ?= /usr | ||
DATADIR ?= ./rpmbuild | ||
BUILDDIR ?= /tmp/build | ||
DISTFILES ?= $(DATADIR)/third_party | ||
|
||
ifeq ($(shell uname -m),aarch64) | ||
ARCH ?= arm64 | ||
else | ||
ARCH ?= x86_64 | ||
endif | ||
TARGET_ARCH ?= $(ARCH) | ||
|
||
export LOCALBASE = /usr | ||
export NON_LOCAL_DEPS = $(shell cat $(DATADIR)/non_local_deps) | ||
export SOURCE_DATE_EPOCH = $(shell cat $(DATADIR)/source_date_epoch) | ||
export VERSION_EXTRA_SUFFIX = $(shell cat $(DATADIR)/git_version_suffix) | ||
export INCLUDE_PATH = $(BUILDDIR)/include | ||
export PKG_CONFIG_PATH = $(BUILDDIR)/pkgconfig | ||
|
||
CFLAGS += -I$(INCLUDE_PATH) | ||
CXXFLAGS += -I$(INCLUDE_PATH) | ||
|
||
define JUST_BUILD_CONF | ||
{ "TOOLCHAIN_CONFIG": {"FAMILY": "gnu"} | ||
, "CC": "gcc" | ||
, "CXX": "g++" | ||
, "AR": "ar" | ||
, "ARCH": "$(ARCH)" | ||
, "TARGET_ARCH": "$(TARGET_ARCH)" | ||
, "SOURCE_DATE_EPOCH": $(SOURCE_DATE_EPOCH) | ||
, "VERSION_EXTRA_SUFFIX": "$(VERSION_EXTRA_SUFFIX)" | ||
, "ADD_CFLAGS": [$(shell printf '"%s"\n' $(CFLAGS) | paste -sd,)] | ||
, "ADD_CXXFLAGS": [$(shell printf '"%s"\n' $(CXXFLAGS) | paste -sd,)] | ||
} | ||
endef | ||
export JUST_BUILD_CONF | ||
|
||
# set dummy proxy to prevent _any_ downloads from happening during bootstrap | ||
export http_proxy = http://8.8.8.8:3128 | ||
export https_proxy = http://8.8.8.8:3128 | ||
|
||
|
||
all: mustbuild | ||
|
||
$(INCLUDE_PATH): | ||
@mkdir -p $@ | ||
if [ -d $(DATADIR)/include ]; then \ | ||
cp -r $(DATADIR)/include/. $@; \ | ||
fi | ||
|
||
$(PKG_CONFIG_PATH): | ||
@mkdir -p $@ | ||
if [ -d $(DATADIR)/pkgconfig ]; then \ | ||
cp -r $(DATADIR)/pkgconfig/. $@; \ | ||
find $@ -type f -exec sed 's|GEN_INCLUDES|'$(INCLUDE_PATH)'|g' -i {} \;; \ | ||
fi | ||
|
||
$(BUILDDIR)/out/bin/must: $(PKG_CONFIG_PATH) $(INCLUDE_PATH) | ||
env PACKAGE=YES BOOTSTRAP_TARGET=ALL python3 ./bin/bootstrap.py . $(BUILDDIR) $(DISTFILES) | ||
@touch $@ | ||
|
||
mustbuild: $(BUILDDIR)/out/bin/must | ||
|
||
install: mustbuild | ||
mkdir -p $(DESTDIR)/$(PREFIX) | ||
cp -ra $(BUILDDIR)/out/. $(DESTDIR)/$(PREFIX)/. | ||
|
||
clean: | ||
rm -rf $(BUILDDIR)/* | ||
|
||
distclean: clean | ||
rm -rf $(BUILDDIR) | ||
|
||
.PHONY: all mustbuild install clean distclean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Name: mustbuild | ||
Version: VERSION | ||
Release: 1%{?dist} | ||
Summary: Mustbuild generic build system | ||
|
||
License: Apache-2.0 | ||
URL: https://github.com/oreiche/mustbuild | ||
Source0: mustbuild-VERSION.tar.gz | ||
|
||
BuildRequires: make, BUILD_DEPENDS | ||
Recommends: python3, bash-completion, git >= 2.29 | ||
|
||
%description | ||
Mustbuild is a friendly fork of Justbuild. It is is maintained as a patch | ||
series. This fork introduces extensions that mainly focus on improving usability | ||
while being fully compatible with existing Justbuild projects. | ||
|
||
|
||
%global debug_package %{nil} | ||
%global _build_id_links none | ||
|
||
|
||
%prep | ||
%autosetup | ||
|
||
|
||
%build | ||
make -f rpmbuild/mustbuild.makefile clean | ||
make -f rpmbuild/mustbuild.makefile all | ||
|
||
|
||
%install | ||
make -f rpmbuild/mustbuild.makefile DESTDIR=$RPM_BUILD_ROOT install | ||
|
||
|
||
%files | ||
%license LICENSE | ||
%{_bindir}/* | ||
%{_datadir}/bash-completion/completions/* | ||
%{_mandir}/man1/* | ||
%{_mandir}/man5/* | ||
|
||
|
||
%changelog | ||
* Sun Apr 14 2024 Oliver Reiche <[email protected]> | ||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
: ${BUILDDIR:=/tmp/build} | ||
|
||
NAME=mustbuild-$VERSION-$TARGET_ARCH-linux | ||
OUTDIR=$(pwd)/../$NAME | ||
|
||
MI_CC="gcc" | ||
if [ "$TARGET_ARCH" = "aarch64" ]; then | ||
MI_CC="aarch64-linux-musl-gcc" | ||
TARGET_ARCH="arm64" | ||
fi | ||
|
||
mkdir -p "${BUILDDIR}" | ||
rm -rf "${BUILDDIR}"/* | ||
|
||
# build mimalloc.o from source | ||
( cd "${BUILDDIR}" | ||
export GIT_SSL_NO_VERIFY=true | ||
git clone --depth 1 -b v2.1.2 https://github.com/microsoft/mimalloc.git | ||
MI_CFLAGS="-std=gnu11 -O3 -DNDEBUG -DMI_MALLOC_OVERRIDE -I./mimalloc/include \ | ||
-fPIC -fvisibility=hidden -ftls-model=initial-exec -fno-builtin-malloc" | ||
${MI_CC} ${MI_CFLAGS} -c ./mimalloc/src/static.c -o mimalloc.o | ||
) | ||
|
||
MIMALLOC_OBJ="${BUILDDIR}/mimalloc.o" | ||
if [ ! -f "$MIMALLOC_OBJ" ]; then | ||
echo "Could not find mimalloc.o" | ||
exit 1 | ||
fi | ||
|
||
cat > build.conf << EOF | ||
{ "TOOLCHAIN_CONFIG": | ||
{ "FAMILY": "gnu" | ||
, "BUILD_STATIC": true | ||
} | ||
, "TARGET_ARCH": "$TARGET_ARCH" | ||
, "AR": "ar" | ||
, "SOURCE_DATE_EPOCH": $SOURCE_DATE_EPOCH | ||
, "VERSION_EXTRA_SUFFIX": "$GIT_VERSION_SUFFIX" | ||
, "FINAL_LDFLAGS": ["$MIMALLOC_OBJ"] | ||
, "PANDOC_ENV": {"HOME": "$HOME"} | ||
} | ||
EOF | ||
|
||
sed -i 's/"to_git": true/"to_git": false/g' etc/repos.json | ||
if ldd 2>&1 | grep musl >/dev/null; then | ||
sed -i 's/linux-gnu/linux-musl/g' etc/toolchain/CC/TARGETS | ||
fi | ||
|
||
if just-mr version >/dev/null 2>&1; then | ||
# build with justbuild | ||
just-mr --no-fetch-ssl-verify --local-build-root ${BUILDDIR}/.must install \ | ||
-c build.conf -o ${OUTDIR} ALL | ||
else | ||
# build via full bootstrap | ||
export JUST_BUILD_CONF="$(cat build.conf)" | ||
BOOTSTRAP_TARGET=ALL python3 ./bin/bootstrap.py . ${BUILDDIR} ${DISTFILES} | ||
mkdir -p ${OUTDIR} | ||
cp -ra ${BUILDDIR}/out/. ${OUTDIR}/. | ||
fi | ||
|
||
cd $OUTDIR/.. | ||
tar --sort=name --owner=root:0 --group=root:0 --mtime='UTC 1970-01-01' -czvf $NAME.tar.gz $NAME |
Oops, something went wrong.