Added build scripts for FreeBSD, Solaris and MacOS X platforms.
This commit is contained in:
parent
e4d9fc9162
commit
3fcaa5f40c
21
etc/utils/freebsd/mk-release.sh
Executable file
21
etc/utils/freebsd/mk-release.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
cd -- "$(dirname -- "${0}")/../../.."
|
||||||
|
|
||||||
|
if [ -z "${cc_path}" ]; then
|
||||||
|
cc_path="/usr/local/bin/gcc12"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mk_slunk() {
|
||||||
|
gmake -B CC="${cc_path}" CPU=${1} MARCH=${3} MTUNE=${4} STATIC=1 STRIP=1
|
||||||
|
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-${2}"
|
||||||
|
}
|
||||||
|
|
||||||
|
rm -rf "out" && mkdir -p "out"
|
||||||
|
|
||||||
|
gmake CC="${cc_path}" clean
|
||||||
|
|
||||||
|
mk_slunk 32 "i686" "pentiumpro" "pentium3"
|
||||||
|
mk_slunk 64 "x86_64" "x86-64" "nocona"
|
||||||
|
|
||||||
|
echo "Build completed successfully."
|
1
etc/utils/macosx/hdiutil.txt
Normal file
1
etc/utils/macosx/hdiutil.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
sudo hdiutil create archive.dmg -ov -volname "CRC-64" -fs HFS+ -srcfolder out
|
21
etc/utils/macosx/mk-release.sh
Executable file
21
etc/utils/macosx/mk-release.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
set -e
|
||||||
|
cd -- "$(dirname -- "${(%):-%N}")/../../.."
|
||||||
|
|
||||||
|
if [ -z "${cc_path}" ]; then
|
||||||
|
cc_path="/usr/bin/cc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mk_slunk() {
|
||||||
|
make -B CC="${cc_path}" TARGET="${1}-apple-macos" FLTO=1
|
||||||
|
strip -o "out/slunkcrypt-${1}" "frontend/bin/slunkcrypt"
|
||||||
|
}
|
||||||
|
|
||||||
|
rm -rf "out" && mkdir -p "out"
|
||||||
|
|
||||||
|
make CC="${cc_path}" clean
|
||||||
|
|
||||||
|
mk_slunk "x86_64"
|
||||||
|
mk_slunk "arm64"
|
||||||
|
|
||||||
|
echo "Build completed successfully."
|
21
etc/utils/solaris/mk-release.sh
Executable file
21
etc/utils/solaris/mk-release.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.."
|
||||||
|
|
||||||
|
if [ -z "${cc_path}" ]; then
|
||||||
|
cc_path="/usr/gcc/11/bin/gcc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mk_slunk() {
|
||||||
|
gmake -B CC="${cc_path}" CPU=${1} MARCH=${3} MTUNE=${4} FLTO=1 STRIP=1
|
||||||
|
cp -f "frontend/bin/slunkcrypt" "out/slunkcrypt-${2}"
|
||||||
|
}
|
||||||
|
|
||||||
|
rm -rf "out" && mkdir -p "out"
|
||||||
|
|
||||||
|
gmake CC="${cc_path}" clean
|
||||||
|
|
||||||
|
mk_slunk 32 "i686" "pentiumpro" "pentium3"
|
||||||
|
mk_slunk 64 "x86_64" "x86-64" "nocona"
|
||||||
|
|
||||||
|
echo "Build completed successfully."
|
@ -32,6 +32,11 @@ static INLINE size_t MIN_SIZE(const size_t a, const size_t b) { return (a > b) ?
|
|||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <sched.h>
|
# include <sched.h>
|
||||||
|
# include <strings.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
|
# include <sys/random.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* detect compiler destructor support */
|
/* detect compiler destructor support */
|
||||||
@ -45,7 +50,7 @@ static INLINE size_t MIN_SIZE(const size_t a, const size_t b) { return (a > b) ?
|
|||||||
#undef HAVE_WIN32RTLGENRANDOM
|
#undef HAVE_WIN32RTLGENRANDOM
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
# define HAVE_WIN32RTLGENRANDOM 1
|
# define HAVE_WIN32RTLGENRANDOM 1
|
||||||
#elif (defined(__linux__) && !defined(__UCLIBC__)) || (defined(__FreeBSD__) && (__FreeBSD__ >= 12)) || defined(__DragonFly__) || defined(__OpenBSD__) || (defined(__sun) && defined(__SVR4))
|
#elif (defined(__linux__) && !defined(__UCLIBC__)) || (defined(__FreeBSD__) && (__FreeBSD__ >= 12)) || defined(__DragonFly__) || defined(__OpenBSD__) || (defined(__sun) && defined(__SVR4)) || (defined(__APPLE__) && defined(__MACH__))
|
||||||
# define HAVE_GETENTROPY 1
|
# define HAVE_GETENTROPY 1
|
||||||
#else
|
#else
|
||||||
# pragma message("Function getentropy() is *not* available -> using fallback!")
|
# pragma message("Function getentropy() is *not* available -> using fallback!")
|
||||||
@ -63,9 +68,9 @@ static INLINE size_t MIN_SIZE(const size_t a, const size_t b) { return (a > b) ?
|
|||||||
|
|
||||||
/* detect sched_yield() or Sleep() support */
|
/* detect sched_yield() or Sleep() support */
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define SCHED_YIELD() Sleep(0)
|
# define THREAD_YIELD() Sleep(0)
|
||||||
#else
|
#else
|
||||||
# define SCHED_YIELD() sched_yield()
|
# define THREAD_YIELD() sched_yield()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@ -74,27 +79,29 @@ static INLINE size_t MIN_SIZE(const size_t a, const size_t b) { return (a > b) ?
|
|||||||
|
|
||||||
/* atomic memory access */
|
/* atomic memory access */
|
||||||
#if defined(_MSC_VER) && (!defined(__GNUC__))
|
#if defined(_MSC_VER) && (!defined(__GNUC__))
|
||||||
|
# define ONCE_FLAG_T LONG
|
||||||
# define ATOMIC_COMPARE_EXCHANGE(X,Y,Z) InterlockedCompareExchange((X),(Y),(Z))
|
# define ATOMIC_COMPARE_EXCHANGE(X,Y,Z) InterlockedCompareExchange((X),(Y),(Z))
|
||||||
# define ATOMIC_EXCHANGE(X,Y) InterlockedExchange((X),(Y))
|
# define ATOMIC_EXCHANGE(X,Y) InterlockedExchange((X),(Y))
|
||||||
#else
|
#else
|
||||||
|
# define ONCE_FLAG_T int
|
||||||
# define ATOMIC_COMPARE_EXCHANGE(X,Y,Z) __sync_val_compare_and_swap((X),(Z),(Y))
|
# define ATOMIC_COMPARE_EXCHANGE(X,Y,Z) __sync_val_compare_and_swap((X),(Z),(Y))
|
||||||
# define ATOMIC_EXCHANGE(X,Y) __sync_lock_test_and_set((X),(Y))
|
# define ATOMIC_EXCHANGE(X,Y) __sync_lock_test_and_set((X),(Y))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* execute initialization function once */
|
/* execute init routine once */
|
||||||
static INLINE void initialize_once(volatile long *const once_flag, void (*const init_routine)(void))
|
static INLINE void initialize_once(volatile ONCE_FLAG_T *const once_control, void (*const init_routine)(void))
|
||||||
{
|
{
|
||||||
long state;
|
ONCE_FLAG_T state;
|
||||||
while ((state = ATOMIC_COMPARE_EXCHANGE(once_flag, -1, 0)) != 0)
|
while ((state = ATOMIC_COMPARE_EXCHANGE(once_control, -1, 0)) != 0)
|
||||||
{
|
{
|
||||||
if (state > 0)
|
if (state > 0)
|
||||||
{
|
{
|
||||||
return; /*already initialized*/
|
return; /*already initialized*/
|
||||||
}
|
}
|
||||||
SCHED_YIELD();
|
THREAD_YIELD();
|
||||||
}
|
}
|
||||||
init_routine();
|
init_routine();
|
||||||
ATOMIC_EXCHANGE(once_flag, 1);
|
ATOMIC_EXCHANGE(once_control, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@ -104,7 +111,7 @@ static INLINE void initialize_once(volatile long *const once_flag, void (*const
|
|||||||
#define MAX_COUNT 1048576U
|
#define MAX_COUNT 1048576U
|
||||||
|
|
||||||
/* Global state */
|
/* Global state */
|
||||||
static volatile long s_random_is_initialized = 0L;
|
static volatile ONCE_FLAG_T s_random_is_initialized = 0;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
typedef BOOLEAN(WINAPI *ptr_genrandom_t)(void *buffer, ULONG length);
|
typedef BOOLEAN(WINAPI *ptr_genrandom_t)(void *buffer, ULONG length);
|
||||||
static HMODULE s_advapi32 = NULL;
|
static HMODULE s_advapi32 = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user