Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No multiarch out of tree #32

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6424716
[sb2] Fix implicit declaration of function ‘i_virtualize_struct_statx’
Thaodan Oct 9, 2024
1721869
[sb2] Fix expected ‘;’ before ‘typedef’
Thaodan Oct 9, 2024
b6b159d
Include missing type headers
Thaodan Oct 9, 2024
0d6d722
preload: Mark internal stat func as static, fix compiler warning
Thaodan Oct 14, 2024
ff72d63
[sb2] Avoid errors in out of tree builds for files from $(OBJDIR)
Thaodan Sep 9, 2023
1ca780d
[utils] Use va_args in open_nomap_nolog to match wrappers
Thaodan Sep 9, 2023
33b2565
[preload] Adapt glibc in open ignore 'mode' with O_TMPFILE in flags
Thaodan Sep 10, 2023
1c7fd7f
[sb2] Don't run make twice
Thaodan Sep 10, 2023
deafd1e
[preload] Ensure exported.h is generated first to fix parallel builds
Thaodan Mar 28, 2024
fdc1d23
[llbuild] Refactor import_dir to match other Makefiles
Thaodan Mar 28, 2024
5035a04
[sb2] Remove multilib for x86_64 and use autotools variables. JB#61868
Thaodan Mar 28, 2024
56abe8b
[sb2] Use autotools builtin system to rerun configure instead of our own
Thaodan Mar 29, 2024
eb02d92
[sb2] Automatically detect out of tree builds
Thaodan Mar 29, 2024
c5dbc12
packaging: Cleanup spec file
Thaodan Mar 29, 2024
52791fd
sb2: Fix errors found shellcheck SC2166, SC2181, SC2048 and SC2012
Thaodan Mar 29, 2024
582b0b1
[sb2] Check if default mode for target exists, error out earlier
Thaodan Mar 29, 2024
3f0fe72
[sb2] Take directory variables from configure. JB#61868
Thaodan Mar 29, 2024
80e9a3a
sb2: Remove trailing slash
Thaodan Nov 24, 2024
6214691
[sb2] Take version from autoconf to avoid unintended rebuilds
Thaodan Nov 24, 2024
c7a726d
[sb2] Clean correctly without breaking builds and keeping the tree dirty
Thaodan Nov 24, 2024
9970be1
[sb2] Make sure config.h is updated and cleaned
Thaodan Nov 24, 2024
5dc216e
[sb2] Avoid rebuilds when configure.ac changes but not it's output
Thaodan Nov 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
config.log
include/config.h
include/config.h.in
stamp-h
stamp-h.in
configure
config.guess
config.status
Expand All @@ -17,6 +19,8 @@ autom4te.cache
aclocal.*
*.a
config.mak
stamp-mak
stamp-mak.in
preload/exported.h
preload/ldexportlist
preload/wrappers.c
Expand All @@ -27,7 +31,10 @@ utils/sb2-show
utils/sb2-monitor
utils/sb2-interp-wrapper
.version
.tarball-version
preload/privatewrappers.c
preload/privatewrappers.h
preload/export.map
include/scratchbox2_version.h
build/
compile_commands.json
342 changes: 142 additions & 200 deletions Makefile

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
#automake_version=1.9

rm -rf configure autom4te.cache
autoreconf --verbose --force --install --make
autoreconf --verbose --force --install

echo > stamp-h.in
echo > stamp-mak.in
227 changes: 227 additions & 0 deletions build-aux/git-version-gen
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
#!/bin/sh
# Print a version string.
scriptversion=2024-07-04.10; # UTC

# Copyright (C) 2007-2024 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

# This script is derived from GIT-VERSION-GEN from GIT: https://git-scm.com/.
# It may be run two ways:
# - from a git repository in which the "git describe" command below
# produces useful output (thus requiring at least one signed tag)
# - from a non-git-repo directory containing a .tarball-version file, which
# presumes this script is invoked like "./git-version-gen .tarball-version".

# In order to use intra-version strings in your project, you will need two
# separate generated version string files:
#
# .tarball-version - present only in a distribution tarball, and not in
# a checked-out repository. Created with contents that were learned at
# the last time autoconf was run, and used by git-version-gen. Must not
# be present in either $(srcdir) or $(builddir) for git-version-gen to
# give accurate answers during normal development with a checked out tree,
# but must be present in a tarball when there is no version control system.
# Therefore, it cannot be used in any dependencies. GNUmakefile has
# hooks to force a reconfigure at distribution time to get the value
# correct, without penalizing normal development with extra reconfigures.
#
# .version - present in a checked-out repository and in a distribution
# tarball. Usable in dependencies, particularly for files that don't
# want to depend on config.h but do want to track version changes.
# Delete this file prior to any autoconf run where you want to rebuild
# files to pick up a version string change; and leave it stale to
# minimize rebuild time after unrelated changes to configure sources.
#
# As with any generated file in a VC'd directory, you should add
# /.version to .gitignore, so that you don't accidentally commit it.
# .tarball-version is never generated in a VC'd directory, so needn't
# be listed there.
#
# Use the following line in your configure.ac, so that $(VERSION) will
# automatically be up-to-date each time configure is run (and note that
# since configure.ac no longer includes a version string, Makefile rules
# should not depend on configure.ac for version updates).
#
# AC_INIT([GNU project],
# m4_esyscmd([build-aux/git-version-gen .tarball-version]),
# [bug-project@example])
#
# Then use the following lines in your Makefile.am, so that .version
# will be present for dependencies, and so that .version and
# .tarball-version will exist in distribution tarballs.
#
# EXTRA_DIST = $(top_srcdir)/.version
# BUILT_SOURCES = $(top_srcdir)/.version
# $(top_srcdir)/.version:
# echo '$(VERSION)' > $@-t
# mv $@-t $@
# dist-hook:
# echo '$(VERSION)' > $(distdir)/.tarball-version


me=$0

year=`expr "$scriptversion" : '\([^-]*\)'`
version="git-version-gen $scriptversion

Copyright (C) ${year} Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law."

usage="\
Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT]
Print a version string.

Options:

--prefix PREFIX prefix of git tags (default 'v')
--fallback VERSION
fallback version to use if \"git --version\" fails

--help display this help and exit
--version output version information and exit

Send patches and bug reports to <[email protected]>."

prefix=v
fallback=

while test $# -gt 0; do
case $1 in
--help) echo "$usage"; exit 0;;
--version) echo "$version"; exit 0;;
--prefix) shift; prefix=${1?};;
--fallback) shift; fallback=${1?};;
-*)
echo "$0: Unknown option '$1'." >&2
echo "$0: Try '--help' for more information." >&2
exit 1;;
*)
if test "x$tarball_version_file" = x; then
tarball_version_file="$1"
elif test "x$tag_sed_script" = x; then
tag_sed_script="$1"
else
echo "$0: extra non-option argument '$1'." >&2
exit 1
fi;;
esac
shift
done

if test "x$tarball_version_file" = x; then
echo "$usage"
exit 1
fi

tag_sed_script="${tag_sed_script:-s/x/x/}"

nl='
'

# Avoid meddling by environment variable of the same name.
v=
v_from_git=

# First see if there is a tarball-only version file.
# then try "git describe", then default.
if test -f $tarball_version_file
then
v=`cat $tarball_version_file` || v=
case $v in
*$nl*) v= ;; # reject multi-line output
esac
test "x$v" = x \
&& echo "$0: WARNING: $tarball_version_file is damaged" 1>&2
fi

if test "x$v" != x
then
: # use $v
# Otherwise, if there is at least one git commit involving the working
# directory, and "git describe" output looks sensible, use that to
# derive a version string.
elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
&& v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \
|| git describe --abbrev=4 HEAD 2>/dev/null` \
&& v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
&& case $v in
$prefix[0-9]*) ;;
*) (exit 1) ;;
esac
then
# Is this a new git that lists number of commits since the last
# tag or the previous older version that did not?
# Newer: v6.10-77-g0f8faeb
# Older: v6.10-g0f8faeb
vprefix=`expr "X$v" : 'X\(.*\)-g[^-]*$'` || vprefix=$v
case $vprefix in
*-*) : git describe is probably okay three part flavor ;;
*)
: git describe is older two part flavor
# Recreate the number of commits and rewrite such that the
# result is the same as if we were using the newer version
# of git describe.
vtag=`echo "$v" | sed 's/-.*//'`
commit_list=`git rev-list "$vtag"..HEAD 2>/dev/null` \
|| { commit_list=failed;
echo "$0: WARNING: git rev-list failed" 1>&2; }
numcommits=`echo "$commit_list" | wc -l`
v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;
test "$commit_list" = failed && v=UNKNOWN
;;
esac

# Change the penultimate "-" to ".", for version-comparing tools.
# Remove the "g" to save a byte.
v=`echo "$v" | sed 's/-\([^-]*\)-g\([^-]*\)$/.\1-\2/'`;
v_from_git=1
elif test "x$fallback" = x || git --version >/dev/null 2>&1; then
v=UNKNOWN
else
v=$fallback
fi

v=`echo "$v" |sed "s/^$prefix//"`

# Test whether to append the "-dirty" suffix only if the version
# string we're using came from git. I.e., skip the test if it's "UNKNOWN"
# or if it came from .tarball-version.
if test "x$v_from_git" != x; then
# Don't declare a version "dirty" merely because a timestamp has changed.
git update-index --refresh > /dev/null 2>&1

dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=
case "$dirty" in
'') ;;
*) # Append the suffix only if there isn't one already.
case $v in
*-dirty) ;;
*) v="$v-dirty" ;;
esac ;;
esac
fi

# Omit the trailing newline, so that m4_esyscmd can use the result directly.
printf %s "$v"

# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
6 changes: 6 additions & 0 deletions config.mak.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
datarootdir=@datarootdir@
datadir=@datadir@

CC=@CC@
CXX=@CXX@
CFLAGS=@CFLAGS@
Expand All @@ -8,3 +13,4 @@ LIBOBJS=@LIBOBJS@
LUA_LIBS=@LUA_LIBS@
LUA_CFLAGS=@LUA_CFLAGS@

PACKAGE_VERSION=@PACKAGE_VERSION@
20 changes: 17 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@


AC_PREREQ([2.59])
AC_INIT([sb2],[1.99b],[[email protected]])
AC_INIT([SB2],
m4_esyscmd([build-aux/git-version-gen --prefix '' .tarball-version]),
[[email protected]],
[scratchbox2],
[https://github.com/sailfishos/scratchbox2])
AC_CONFIG_AUX_DIR([build-aux])
#AC_CANONICAL_TARGET
#AM_INIT_AUTOMAKE
#AM_MAINTAINER_MODE
#AC_CONFIG_SRCDIR([src/libfakechroot.c])
AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_FILES([config.mak])
dnl Generate timestamp so that configure output files timestamps are in sync
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
AC_CONFIG_FILES([stamp-mak], [echo timestamp > stamp-mak])
AC_PROG_CC
AC_PROG_CXX

Expand Down Expand Up @@ -231,9 +239,15 @@ freebsd*)
esac

AC_C_BIGENDIAN()

AC_SUBST(WORDS_BIGENDIAN, ${WORDS_BIGENDIAN})
AC_SUBST(PREFIX, ${prefix})

AC_SUBST(prefix, ${prefix})
AC_SUBST(exec_prefix, ${exec_prefix})
AC_SUBST(bindir, ${bindir})
AC_SUBST(libdir, ${libdir})
AC_SUBST(datarootdir, ${datarootdir})
AC_SUBST(datadir, ${datadir})

AC_SUBST(CC, ${CC})
AC_SUBST(CXX, ${CXX})
AC_SUBST(CFLAGS, ${CFLAGS})
Expand Down
8 changes: 5 additions & 3 deletions execs/exec_map_script_interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
* Licensed under LGPL version 2.1, see top level LICENSE file for details.
*/

#include "mapping.h"
#include "sb2.h"
#include <config.h>

#include <mapping.h>
#include <sb2.h>

#include "libsb2.h"
#include "exported.h"

#include "sb2_execs.h"

/* A very straightforward conversion from Lua:
Expand Down
10 changes: 6 additions & 4 deletions execs/exec_policy_ruletree.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
* Licensed under LGPL version 2.1, see top level LICENSE file for details.
*/

#include "mapping.h"
#include "sb2.h"
#include "libsb2.h"
#include "exported.h"
#include <config.h>

#include <sys/mman.h>

#include <mapping.h>
#include <sb2.h>

#include "libsb2.h"
#include "exported.h"
#include "sb2_execs.h"

/* Functions for accessing exec policy settings in the rule tree db.
Expand Down
12 changes: 8 additions & 4 deletions execs/exec_policy_selection.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@
* { dir = "/directory/path", exec_policy_name = "policyname" }
*/

#include "mapping.h"
#include "sb2.h"
#include "libsb2.h"
#include "exported.h"
#include <config.h>

#include <sys/mman.h>

#include <mapping.h>
#include <sb2.h>

#include "libsb2.h"
#include "exported.h"
#include "sb2_execs.h"



/* FIXME: This is currently a slightly modified copy of ruletree_test_path_match()
*
* Returns min.path length if a match is found, otherwise returns -1 */
Expand Down
8 changes: 5 additions & 3 deletions execs/exec_postprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
* Licensed under LGPL version 2.1, see top level LICENSE file for details.
*/

#include "mapping.h"
#include "sb2.h"
#include <config.h>

#include <mapping.h>
#include <sb2.h>

#include "libsb2.h"
#include "exported.h"

#include "sb2_execs.h"

/* Exec postprocessing for native, dynamically linked binaries.
Expand Down
Loading