mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-01-18 10:46:26 +00:00
stat: determine whether it is BSD or GNU flavor
Seems like MacOS may have either in the path. Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
parent
41ba1d99c8
commit
f9bec4ed7c
21
configure.ac
21
configure.ac
@ -216,7 +216,6 @@ ACX_CHECK_PROGS_REQ([bison], [bison])
|
||||
ACX_CHECK_PROGS_REQ([flex], [flex])
|
||||
ACX_CHECK_PROGS_REQ([makeinfo], [makeinfo])
|
||||
ACX_CHECK_PROGS_REQ([cut], [cut])
|
||||
ACX_CHECK_PROGS_REQ([stat], [stat])
|
||||
ACX_CHECK_PROGS_REQ([readlink], [readlink])
|
||||
ACX_CHECK_PROGS_REQ([tar], [tar])
|
||||
ACX_CHECK_PROGS_REQ([gzip], [gzip])
|
||||
@ -233,6 +232,26 @@ AC_CHECK_PROGS([curl], [curl])
|
||||
ACX_SET_KCONFIG_OPTION([curl])
|
||||
AC_SUBST([curl])
|
||||
|
||||
ACX_CHECK_PROGS_REQ([stat], [stat])
|
||||
AC_CACHE_CHECK([whether stat takes GNU or BSD format],
|
||||
[acx_cv_stat_flavor],
|
||||
[touch conftest
|
||||
chmod 642 conftest
|
||||
attr_bsd=`stat -f '%Lp' conftest 2>/dev/null`
|
||||
attr_gnu=`stat -c '%a' conftest 2>/dev/null`
|
||||
rm -f conftest
|
||||
AS_IF([test "$attr_bsd" = "642"],
|
||||
[acx_cv_stat_flavor=BSD],
|
||||
[test "$attr_gnu" = "642"],
|
||||
[acx_cv_stat_flavor=GNU],
|
||||
[AC_MSG_ERROR([cannot determine stat(1) format option])])])
|
||||
|
||||
# FIXME: support SET_KCONFIG_OPTION with string values? But then
|
||||
# again, these checks may be moved into ct-ng script.
|
||||
test "$acx_cv_stat_flavor" = "BSD" && stat_flavor_BSD=y
|
||||
ACX_SET_KCONFIG_OPTION([stat_flavor_BSD])
|
||||
test "$acx_cv_stat_flavor" = "GNU" && stat_flavor_GNU=y
|
||||
ACX_SET_KCONFIG_OPTION([stat_flavor_GNU])
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Still boring, but remember the path, now...
|
||||
|
@ -567,15 +567,15 @@ CT_DoForceRmdir() {
|
||||
local mode
|
||||
for dir in "${@}"; do
|
||||
[ -d "${dir}" ] || continue
|
||||
case "$CT_SYS_OS" in
|
||||
Linux|CYGWIN*)
|
||||
case "${CT_CONFIGURE_has_stat_flavor_GNU},${CT_CONFIGURE_has_stat_flavor_BSD}" in
|
||||
y,*)
|
||||
mode="$(stat -c '%a' "$(dirname "${dir}")")"
|
||||
;;
|
||||
Darwin|*BSD)
|
||||
*,y)
|
||||
mode="$(stat -f '%Lp' "$(dirname "${dir}")")"
|
||||
;;
|
||||
*)
|
||||
CT_Abort "Unhandled host OS $CT_SYS_OS"
|
||||
CT_Abort "Unknown stat format options"
|
||||
;;
|
||||
esac
|
||||
CT_DoExecLog ALL chmod u+w "$(dirname "${dir}")"
|
||||
|
64
scripts/scripts.mk
Executable file
64
scripts/scripts.mk
Executable file
@ -0,0 +1,64 @@
|
||||
# Makefile for the scripts/ sub-directory
|
||||
|
||||
# Here, we can update the config.* scripts.
|
||||
# If we're in CT_LIB_DIR, then CT_LIB_DIR == CT_TOP_DIR, and we can update those
|
||||
# scripts for later inclusion mainline. If CT_LIB_DIR != CT_TOP_DIR, then those
|
||||
# scripts are downloaded only for use in CT_TOP_DIR.
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# The tools help entry
|
||||
|
||||
help-distrib::
|
||||
@echo ' updatetools - Update the config tools'
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# Where to get tools from, and where to store them into
|
||||
# The tools are: config.guess and config.sub
|
||||
|
||||
CONFIG_SUB_SRC="http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD"
|
||||
CONFIG_SUB_DEST=scripts/config.sub
|
||||
CONFIG_GUESS_SRC="http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD"
|
||||
CONFIG_GUESS_DEST=scripts/config.guess
|
||||
|
||||
PHONY += updatetools
|
||||
updatetools: $(CONFIG_SUB_DEST) $(CONFIG_GUESS_DEST)
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# How to retrieve the tools
|
||||
|
||||
ifneq ($(strip $(V)),2)
|
||||
wget_silent_opt = -o /dev/null
|
||||
curl_silent_opt = --silent
|
||||
endif
|
||||
|
||||
ifneq (wget,)
|
||||
download_cmd = wget --passive-ftp $(wget_silent_opt) -O $@
|
||||
else
|
||||
ifneq (curl,)
|
||||
download_cmd = curl --ftp-pasv $(curl_silent_opt) -o $@
|
||||
else
|
||||
download_cmd = $(error wget or curl needed for downloads)
|
||||
endif
|
||||
endif
|
||||
|
||||
PHONY += scripts
|
||||
scripts:
|
||||
@$(CT_ECHO) ' MKDIR $@'
|
||||
$(SILENT)mkdir -p $@
|
||||
|
||||
$(CONFIG_SUB_DEST): scripts FORCE
|
||||
@$(CT_ECHO) ' DOWNLOAD $@'
|
||||
$(SILENT)$(download_cmd) $(CONFIG_SUB_SRC)
|
||||
$(SILENT)chmod u+rwx,go+rx-w $@
|
||||
|
||||
$(CONFIG_GUESS_DEST): scripts FORCE
|
||||
@$(CT_ECHO) ' DOWNLOAD $@'
|
||||
$(SILENT)$(download_cmd) $(CONFIG_GUESS_SRC)
|
||||
$(SILENT)chmod u+rwx,go+rx-w $@
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# Clean up the mess
|
||||
|
||||
distclean::
|
||||
@$(CT_ECHO) " CLEAN scripts"
|
||||
$(SILENT)[ $(CT_TOP_DIR) = $(CT_LIB_DIR) ] || rm -rf $(CT_TOP_DIR)/scripts
|
Loading…
Reference in New Issue
Block a user