/make (09f5414234482635076eab52d74453ec06d30e42) (7919 bytes) (mode 100755) (type blob)
#!/bin/sh
#this script is brutal and verbose, has no tricks and is quite linear, then
#quite easy to deal with
#for the moment, it's hardcoded for a gcc toolchain... BAD! Since now
#gcc is a c++ piece of shit
# stolen from ffmpeg configure like a pig
set -e
# prevent locale nonsense from breaking basic text processing
LC_ALL=C
export LC_ALL
# libtool versioning
libuuid_api=1
libuuid_rev=3
libuuid_age=0
libuuid_so_version=${libuuid_api}.${libuuid_rev}.${libuuid_age}
fake_root=fake_root
#-------------------------------------------------------------------------------
# it's benign here, but keep in mind it does define the order of static linking
# which is important for proper symbol selection
libuuid_src_files='
src/clear.c
src/compare.c
src/copy.c
src/gen_uuid.c
src/isnull.c
src/pack.c
src/parse.c
src/unpack.c
src/unparse.c
src/uuid_time.c
src/randutils.c
'
# it's benign here, but keep in mind it does define the order of static linking
# which is important for proper symbol selection
uuidgen_src_files='
src/uuidgen.c
'
#-------------------------------------------------------------------------------
sep_start()
{
printf '###############################################################################\n'
}
sep_end()
{
printf '###############################################################################\n\n'
}
subsep_start()
{
printf '*******************************************************************************\n'
}
subsep_end()
{
printf '*******************************************************************************\n'
}
################################################################################
if test -f make; then
src_path=.
else
src_path=$(cd $(dirname "$0"); pwd)
echo "$src_path" | grep -q '[[:blank:]]' &&
die "out of tree builds are impossible with whitespace in source path."
fi
################################################################################
is_in()
{
value=$1
shift
for var in $*; do
[ $var = $value ] && return 0
done
return 1
}
die_unknown()
{
echo "Unknown option \"$1\"."
echo "See $0 --help for available options."
exit 1
}
set_default()
{
for opt; do
eval : \${$opt:=\$${opt}_default}
done
}
spaces_concat()
{
printf "$1" | tr -s '[:space:]' ' '
}
CMDLINE_SET='
bin_cc
bin_ccld
libuuid_cc
libuuid_ar
dbin_cc
dbin_ccld
slibuuid_cc
slibuuid_ccld
prefix
bindir
libdir
includedir
localstatedir
version
'
################################################################################
#command line set defaults
#-------------------------------------------------------------------------------
bin_cc_default="gcc -Wall -Wextra \
-std=gnu99 -O2 -c"
bin_ccld_default="gcc -static"
libuuid_cc_default="gcc -Wall -Wextra \
-std=gnu99 -O2 -fPIC -c"
libuuid_ar_default="ar rcs"
dbin_cc_default="gcc -Wall -Wextra \
-std=gnu99 -O2 -c"
dbin_ccld_default="gcc -Wl,--as-needed"
slibuuid_cc_default="gcc -Wall -Wextra \
-std=gnu99 -O2 -fPIC -c"
slibuuid_ccld_default="gcc -shared \
-Wl,--version-script=$src_path/libuuid.sym \
-Wl,-soname,libuuid.so.$libuuid_api \
-Wl,--as-needed"
#-------------------------------------------------------------------------------
prefix_default=/usr/local
bindir_default='$prefix/bin'
libdir_default='$prefix/lib'
includedir_default='$prefix/include'
localstatedir_default='$prefix/var'
version_default=2.30.1
set_default $CMDLINE_SET
libuuid_only=no
disable_static=no
disable_dynamic=no
################################################################################
################################################################################
show_help(){
cat <<EOF
Usage: make [options]
default is to build libuuid and uuidgen
Options: [defaults in brackets after descriptions]
Help options:
--help print this message
Standard options:
--libuuid-only build only libblkid
--disable-static disable the build of static lib and static binary
--disable-dynamic disable the build of shared lib and dynamic binary
--prefix=PREFIX architecture independent prefix [$prefix_default]
--libdir=DIR object code libraries [$libdir_default]
--includedir=DIR C header files [$includedir_default]
--localstatedir=DIR modifiable single-machine data [$localstatedir_default]
--version=VERSION override the version number [$version_default]
Advanced options:
--bin-cc=CC use C compiler command line CC for static target uuidgen [$(spaces_concat "$bin_cc_default")]
--bin-ccld=CCLD use linker command line CCLD for static target uuidgen [$(spaces_concat "$bin_ccld_default")]
--dbin-cc=CC use C compiler command line CC for dynamic target uuidgen [$(spaces_concat "$dbin_cc_default")]
--dbin-ccld=CCLD use linker command line CCLD for dynamic target uuidgen [$(spaces_concat "$dbin_ccld_default")]
--libuuid-cc=CC use C compiler command line CC for static target libuuid [$(spaces_concat "$libuuid_cc_default")]
--libuuid-ar=AR use archive command line AR for static target libuuid [$(spaces_concat "$libuuid_ar_default")]
--slibuuid-cc=CC use C compiler command line CC for shared target libuuid [$(spaces_concat "$slibuuid_cc_default")]
--slibuuid-ccld=CCLD use linker command line CCLD for shared target libuuid [$(spaces_concat "$slibuuid_ccld_default")]
EOF
exit 0
}
################################################################################
for opt do
optval="${opt#*=}"
case "$opt" in
--help|-h) show_help
;;
--libuuid-only)
libuuid_only=yes
;;
--disable-static)
disable_static=yes
;;
--disable-dynamic)
disable_dynamic=yes
;;
*)
optname=${opt%%=*}
optname=${optname#--}
optname=$(echo "$optname" | sed 's/-/_/g')
if is_in $optname $CMDLINE_SET; then
eval $optname='$optval'
else
die_unknown $opt
fi
;;
esac
done
################################################################################
sep_start;echo "source code path is:$src_path";sep_end
path_expand()
{
e_v=$1
#we set a maximum expansion depth of 3
for d in 1 2 3
do
e_v=$(eval echo "$e_v")
done
#get rid of ugly double // in path
echo "$e_v" | sed -e 's%//%/%g'
}
sep_start;echo 'expanding final paths:'
e_prefix=$(path_expand "$prefix")
e_bindir=$(path_expand "$bindir")
e_libdir=$(path_expand "$libdir")
e_includedir=$(path_expand "$includedir")
e_localstatedir=$(path_expand "$localstatedir")
echo "prefix=$e_prefix"
echo "bin=$e_bindir"
echo "libdir=$e_libdir"
echo "includedir=$e_includedir"
echo "localstatedir=$e_localstatedir"
sep_end
################################################################################
mkdir -p -- ./src
printf "#ifndef PATH_H\n#define PATH_H\n#define _PATH_LOCALSTATEDIR \"%b\"\n#endif" "$e_localstatedir" >./src/uuid_paths.h
################################################################################
. $src_path/make.libuuid.sh
if test x$libuuid_only != xyes; then
. $src_path/make.uuidgen.sh
fi
################################################################################
sep_start;echo 'generating pkg-config file for uuid'
mkdir -p -- $fake_root/$e_libdir/pkgconfig
cp -f $src_path/uuid.pc.in $fake_root/$e_libdir/pkgconfig/uuid.pc
sed -i "s%@VERSION@%$version%" $fake_root/$e_libdir/pkgconfig/uuid.pc
sed -i "s%@prefix@%$e_prefix%" $fake_root/$e_libdir/pkgconfig/uuid.pc
sed -i "s%@exec_prefix@%$e_eprefix%" $fake_root/$e_libdir/pkgconfig/uuid.pc
sed -i "s%@libdir@%$e_libdir%" $fake_root/$e_libdir/pkgconfig/uuid.pc
sed -i "s%@includedir@%$e_includedir%" $fake_root/$e_libdir/pkgconfig/uuid.pc
sep_end
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
24 |
20ff7cb125a29d358b42d1030371e16c440fbaa0 |
LICENSE |
100644 |
blob |
368 |
39e75084147df4dfd7e64db20a2d3ef5686f9526 |
README |
100644 |
blob |
972 |
28a207684ae607e311aa177f41a52f681e78391d |
libuuid.sym |
100755 |
blob |
7919 |
09f5414234482635076eab52d74453ec06d30e42 |
make |
100644 |
blob |
2525 |
8504b1cac2353489a30c795e432dc8825043a341 |
make.libuuid.sh |
100644 |
blob |
2326 |
c287b3b49e71fcab240f09cc2cbcda4ad689782d |
make.uuidgen.sh |
040000 |
tree |
- |
59b9cbf5951fc364e45bae1a731b67bf08471a8b |
src |
100644 |
blob |
210 |
5b554ec18480e2d4b170a844b901e18948e9e10e |
uuid.pc.in |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/sylware/nyanuuid
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/sylware/nyanuuid
Clone this repository using git:
git clone git://git.rocketgit.com/user/sylware/nyanuuid
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main