From 681c61ad3203d3a560f85f548feb136cb93c57e1 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk Date: Sun, 19 May 2024 16:18:53 +0100 Subject: [PATCH 01/13] [libvpx] Fix scan-build 14 --- libs/libvpx/vp9/encoder/vp9_subexp.c | 3 +++ libs/libvpx/vpx_scale/generic/vpx_scale.c | 2 ++ libs/libvpx/vpx_scale/vpx_scale.h | 2 ++ 3 files changed, 7 insertions(+) diff --git a/libs/libvpx/vp9/encoder/vp9_subexp.c b/libs/libvpx/vp9/encoder/vp9_subexp.c index cf17fcdfce..b5a2390662 100644 --- a/libs/libvpx/vp9/encoder/vp9_subexp.c +++ b/libs/libvpx/vp9/encoder/vp9_subexp.c @@ -64,6 +64,9 @@ static int remap_prob(int v, int m) { 228, 229, 17, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 18, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 19, }; + + assert(m > 0); + v--; m--; if ((m << 1) <= MAX_PROB) diff --git a/libs/libvpx/vpx_scale/generic/vpx_scale.c b/libs/libvpx/vpx_scale/generic/vpx_scale.c index 958bb320fc..e20905e9ce 100644 --- a/libs/libvpx/vpx_scale/generic/vpx_scale.c +++ b/libs/libvpx/vpx_scale/generic/vpx_scale.c @@ -167,6 +167,8 @@ static void scale1d_c(const unsigned char *source, int source_step, (void)source_length; + assert(dest_scale); + /* These asserts are needed if there are boundary issues... */ /*assert ( dest_scale > source_scale );*/ /*assert ( (source_length-1) * dest_scale >= (dest_length-1) * source_scale diff --git a/libs/libvpx/vpx_scale/vpx_scale.h b/libs/libvpx/vpx_scale/vpx_scale.h index fd5ba7ccdc..96edb7af20 100644 --- a/libs/libvpx/vpx_scale/vpx_scale.h +++ b/libs/libvpx/vpx_scale/vpx_scale.h @@ -11,6 +11,8 @@ #ifndef VPX_VPX_SCALE_VPX_SCALE_H_ #define VPX_VPX_SCALE_VPX_SCALE_H_ +#include + #include "vpx_scale/yv12config.h" extern void vpx_scale_frame(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, From 85400015b7eed420f49bfde85cd08acc44f48b28 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 1 Jun 2022 00:09:48 +0300 Subject: [PATCH 02/13] [Core] VAD: Add a math sanity check to the switch_vad_process --- src/switch_vad.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/switch_vad.c b/src/switch_vad.c index 6118c0237e..74d131331b 100644 --- a/src/switch_vad.c +++ b/src/switch_vad.c @@ -206,7 +206,9 @@ SWITCH_DECLARE(switch_vad_state_t) switch_vad_process(switch_vad_t *vad, int16_t j += vad->channels; } - score = (uint32_t) (energy / (samples / vad->divisor)); + if (samples && vad->divisor && samples >= vad->divisor) { + score = (uint32_t)(energy / (samples / vad->divisor)); + } #ifdef SWITCH_HAVE_FVAD } #endif From 41bc763d800a9fef127d238e88a797470b1256f9 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk Date: Mon, 13 May 2024 12:25:47 +0100 Subject: [PATCH 03/13] [core] Fix scan-build 14 in port allocator --- src/switch_core_port_allocator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_core_port_allocator.c b/src/switch_core_port_allocator.c index 3bbed2a351..074ce5f5ea 100644 --- a/src/switch_core_port_allocator.c +++ b/src/switch_core_port_allocator.c @@ -150,7 +150,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_request_port(switch_c switch_mutex_lock(alloc->mutex); srand((unsigned) ((unsigned) (intptr_t) port_ptr + (unsigned) (intptr_t) switch_thread_self() + switch_micro_time_now())); - while (alloc->track_used < alloc->track_len) { + while (alloc->track_len && alloc->track_used < alloc->track_len) { uint32_t index; uint32_t tries = 0; From 72eef5681fc03a4405eab26545ff09953a999094 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 14 Aug 2023 18:14:28 +0300 Subject: [PATCH 04/13] [CI] Enable scan build 14 on Drone CI --- .drone.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 07ccb34f27..63838cfb73 100644 --- a/.drone.yml +++ b/.drone.yml @@ -97,13 +97,14 @@ name: scan-build steps: - name: bootstrap - image: signalwire/freeswitch-public-base:bullseye + image: signalwire/freeswitch-public-base:bookworm pull: always commands: + - apt-get update && apt-get -yq install autoconf - ./bootstrap.sh -j - name: configure - image: signalwire/freeswitch-public-base:bullseye + image: signalwire/freeswitch-public-base:bookworm pull: always environment: REPOTOKEN: @@ -140,7 +141,7 @@ steps: - ./configure - name: scan-build - image: signalwire/freeswitch-public-base:bullseye + image: signalwire/freeswitch-public-base:bookworm pull: always environment: REPOTOKEN: @@ -152,7 +153,7 @@ steps: - export REPOTOKEN='' - rm -rf /etc/apt/auth.conf - mkdir -p scan-build - - echo '#!/bin/bash\nscan-build-11 -o ./scan-build/ make -j`nproc --all` |& tee ./scan-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./scan-build-status.txt\n' > scan.sh + - echo '#!/bin/bash\nscan-build-14 --force-analyze-debug-code -o ./scan-build/ make -j`nproc --all` |& tee ./scan-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./scan-build-status.txt\n' > scan.sh - chmod +x scan.sh - ./scan.sh - exitstatus=`cat ./scan-build-status.txt` @@ -178,6 +179,6 @@ trigger: --- kind: signature -hmac: 780e4aaee61e3683ea4a8d6fe5131f7c9e62ebad727546013f18df0fca80d705 +hmac: 7e5f6cafc88da0be59243daf47a2a5607ff00b45f441ce4c1041d4b690e8a853 ... From a92c1e4c4739cd9b0f7a456c5baf045df3dc4066 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 7 Mar 2024 21:41:54 +0300 Subject: [PATCH 05/13] [Build-System] Fix crashing MSI packaging on Windows when Visual Studio 2022 is used. --- .gitignore | 2 +- w32/Setup/Setup.2017.wixproj | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0461c273de..135473c8df 100644 --- a/.gitignore +++ b/.gitignore @@ -187,7 +187,7 @@ ipch/ /w32/Setup/obj *dSYM* -/UpgradeLog.* +/UpgradeLog*.* /_UpgradeReport_Files/ *.aps /w32/Library/switch_version.inc diff --git a/w32/Setup/Setup.2017.wixproj b/w32/Setup/Setup.2017.wixproj index dd745e8438..bf0aae0498 100644 --- a/w32/Setup/Setup.2017.wixproj +++ b/w32/Setup/Setup.2017.wixproj @@ -1032,6 +1032,7 @@ SuppressRegistry="true" SuppressCom="true" SuppressFragments="true" + RunAsSeparateProcess="true" PreprocessorVariable="var.FreeSWITCHConfFilesDir"> From c7e793c345218158df4feda7326f5925da6cccab Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 6 Jun 2024 21:05:33 +0300 Subject: [PATCH 06/13] [Core] Add new switch_rand() a compliant random number generator API. Add a unit-test. * [Core] Add new switch_rand() a compliant random number generator API. Add a unit-test. * Fall back to rand() on unsupported platforms compile time. --- src/include/switch_utils.h | 5 ++++ src/switch_utils.c | 57 ++++++++++++++++++++++++++++++++++++++ tests/unit/switch_core.c | 21 ++++++++++++++ 3 files changed, 83 insertions(+) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 1d33939f4c..a0c91e6384 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -1514,6 +1514,11 @@ SWITCH_DECLARE(switch_status_t) switch_digest_string(const char *digest_name, ch SWITCH_DECLARE(char *) switch_must_strdup(const char *_s); SWITCH_DECLARE(const char *) switch_memory_usage_stream(switch_stream_handle_t *stream); +/** +/ Compliant random number generator. Returns the value between 0 and 0x7fff (RAND_MAX). +**/ +SWITCH_DECLARE(int) switch_rand(void); + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/switch_utils.c b/src/switch_utils.c index faffc1cc04..25d0bf76ee 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -4811,6 +4811,63 @@ done: return status; } +SWITCH_DECLARE(int) switch_rand(void) +{ + uint32_t random_number = 0; +#ifdef WIN32 + BCRYPT_ALG_HANDLE hAlgorithm = NULL; + NTSTATUS status = BCryptOpenAlgorithmProvider(&hAlgorithm, BCRYPT_RNG_ALGORITHM, NULL, 0); + + if (!BCRYPT_SUCCESS(status)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "BCryptOpenAlgorithmProvider failed with status %d\n", status); + + return 1; + } + + status = BCryptGenRandom(hAlgorithm, (PUCHAR)&random_number, sizeof(random_number), 0); + if (!BCRYPT_SUCCESS(status)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "BCryptGenRandom failed with status %d\n", status); + + return 1; + } + + BCryptCloseAlgorithmProvider(hAlgorithm, 0); + + /* Make sure we return from 0 to RAND_MAX */ + return (random_number & 0x7FFF); +#elif defined(__unix__) || defined(__APPLE__) + int random_fd = open("/dev/urandom", O_RDONLY); + ssize_t result; + char error_msg[100]; + + if (random_fd == -1) { + strncpy(error_msg, strerror(errno), sizeof(error_msg) - 1); + error_msg[sizeof(error_msg) - 1] = '\0'; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open failed: %s\n", error_msg); + + return 1; + } + + result = read(random_fd, &random_number, sizeof(random_number)); + if (result < 0) { + strncpy(error_msg, strerror(errno), sizeof(error_msg) - 1); + error_msg[sizeof(error_msg) - 1] = '\0'; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "read failed: %s\n", error_msg); + + return 1; + } + + close(random_fd); + + /* Make sure we return from 0 to RAND_MAX */ + return (random_number & 0x7FFF); +#else + return rand(); +#endif +} + /* For Emacs: * Local Variables: * mode:c diff --git a/tests/unit/switch_core.c b/tests/unit/switch_core.c index 2f06966582..295e4e0ff1 100644 --- a/tests/unit/switch_core.c +++ b/tests/unit/switch_core.c @@ -53,6 +53,27 @@ FST_CORE_BEGIN("./conf") } FST_TEARDOWN_END() + FST_TEST_BEGIN(test_switch_rand) + { + int i, c = 0; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "\nLet's generate a few random numbers.\n"); + + for (i = 0; i < 10; i++) { + uint32_t rnd = switch_rand(); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Random number %d\n", rnd); + + if (rnd == 1) { + c++; + } + } + + /* We do not expect all random numbers to be 1 all 10 times. That would mean we have an error OR we are lucky to have 10 random ones! */ + fst_check(c < 10); + } + FST_TEST_END() + FST_TEST_BEGIN(test_switch_uint31_t_overflow) { switch_uint31_t x; From 3b65e271164006affd327d2f42e39d76ac97c32d Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 16 May 2024 23:48:28 +0300 Subject: [PATCH 07/13] [mod_av] Fix use of switch_size_t in fs_rtp_parse_h263_rfc2190(). --- src/mod/applications/mod_av/avcodec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_av/avcodec.c b/src/mod/applications/mod_av/avcodec.c index 4f0057264e..0293b83446 100644 --- a/src/mod/applications/mod_av/avcodec.c +++ b/src/mod/applications/mod_av/avcodec.c @@ -906,7 +906,7 @@ static void fs_rtp_parse_h263_rfc2190(h264_codec_context_t *context, AVPacket *p #if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Should Not Happen!!! mb_info_pos=%d mb_info_count=%d mb_info_size=%d\n", mb_info_pos, mb_info_count, mb_info_size); #else - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Should Not Happen!!! mb_info_pos=%d mb_info_count=%d mb_info_size=%ld\n", mb_info_pos, mb_info_count, mb_info_size); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Should Not Happen!!! mb_info_pos=%d mb_info_count=%d mb_info_size=%"SWITCH_SIZE_T_FMT"\n", mb_info_pos, mb_info_count, mb_info_size); #endif } } From 0c8b5987f04ac3753ebb0d8680f30512d3593776 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 17 May 2024 16:44:51 +0300 Subject: [PATCH 08/13] [mod_fsv] Fix use of 2gb of memory. Fix compiler warnings preventing builds on Bookworm. --- src/mod/applications/mod_fsv/mod_fsv.c | 32 ++++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index 90d64972ad..37f413d6b2 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -40,6 +40,11 @@ SWITCH_MODULE_DEFINITION(mod_fsv, mod_fsv_load, NULL, NULL); #define VID_BIT (1 << 31) #define VERSION 4202 +typedef struct fsv_video_data_s { + uint32_t size; + uint8_t data[]; +} fsv_video_data_t; + struct file_header { int32_t version; char video_codec_name[32]; @@ -983,15 +988,16 @@ again: } if (size & VID_BIT) { /* video */ - uint8_t *video_data = malloc(sizeof(size) + size); + fsv_video_data_t *video_data; switch_size_t read_size; - switch_assert(video_data); size &= ~VID_BIT; + video_data = malloc(sizeof(fsv_video_data_t) + size); + switch_assert(video_data); read_size = size; - *(uint32_t *)video_data = size; + video_data->size = size; - status = switch_file_read(context->fd, video_data + sizeof(size), &read_size); + status = switch_file_read(context->fd, video_data->data, &read_size); if (status != SWITCH_STATUS_SUCCESS || read_size != size) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, @@ -1033,7 +1039,7 @@ static switch_status_t fsv_file_read_video(switch_file_handle_t *handle, switch_ fsv_file_context *context = handle->private_info; switch_image_t *dup = NULL; switch_status_t status = SWITCH_STATUS_SUCCESS; - void *video_packet = NULL; + fsv_video_data_t *video_packet = NULL; switch_time_t start = switch_time_now(); switch_status_t decode_status = SWITCH_STATUS_MORE_DATA; int new_img = 0; @@ -1047,8 +1053,9 @@ static switch_status_t fsv_file_read_video(switch_file_handle_t *handle, switch_ switch_rtp_hdr_t *rtp; while (1) { + video_packet = NULL; switch_mutex_lock(context->mutex); - status = switch_queue_trypop(context->video_queue, &video_packet); + status = switch_queue_trypop(context->video_queue, (void**)&video_packet); switch_mutex_unlock(context->mutex); if (status != SWITCH_STATUS_SUCCESS || !video_packet) { @@ -1065,13 +1072,13 @@ static switch_status_t fsv_file_read_video(switch_file_handle_t *handle, switch_ break; } - size = *(uint32_t *)video_packet; + size = video_packet->size; if (size > sizeof(context->video_packet_buffer)) { free(video_packet); return SWITCH_STATUS_BREAK; } - memcpy(context->video_packet_buffer, (uint8_t *)video_packet + sizeof(uint32_t), size); + memcpy(context->video_packet_buffer, video_packet->data, size); free(video_packet); video_packet = NULL; @@ -1093,14 +1100,15 @@ static switch_status_t fsv_file_read_video(switch_file_handle_t *handle, switch_ uint32_t size; switch_rtp_hdr_t *rtp; - switch_mutex_lock(context->mutex); - status = switch_queue_trypop(context->video_queue, &video_packet); + video_packet = NULL; + switch_mutex_lock(context->mutex); + status = switch_queue_trypop(context->video_queue, (void**)&video_packet); switch_mutex_unlock(context->mutex); if (status != SWITCH_STATUS_SUCCESS || !video_packet) break; - size = *(uint32_t *)video_packet; - rtp = (switch_rtp_hdr_t *)((uint8_t *)video_packet + sizeof(uint32_t)); + size = video_packet->size; + rtp = (switch_rtp_hdr_t *)(video_packet->data); rtp_frame.packet = rtp; rtp_frame.packetlen = size; From 9f362ea3154501b93b276b82c7a3aa44d7111cfb Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 7 Jun 2024 16:07:15 +0300 Subject: [PATCH 09/13] [Core] Better handle error cases in switch_rand(). --- src/switch_utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/switch_utils.c b/src/switch_utils.c index 25d0bf76ee..64577d3997 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -4828,6 +4828,8 @@ SWITCH_DECLARE(int) switch_rand(void) if (!BCRYPT_SUCCESS(status)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "BCryptGenRandom failed with status %d\n", status); + BCryptCloseAlgorithmProvider(hAlgorithm, 0); + return 1; } @@ -4856,6 +4858,8 @@ SWITCH_DECLARE(int) switch_rand(void) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "read failed: %s\n", error_msg); + close(random_fd); + return 1; } From 74f386bf94a3b793c466a14c71f267daa7fd96d2 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 10 Jun 2024 15:48:30 +0000 Subject: [PATCH 10/13] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 50 ++++++++++++ src/mod/languages/mod_managed/managed/swig.cs | 78 +++++++++++++++++++ 2 files changed, 128 insertions(+) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index bba26c8f9b..7cec120fbe 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -2129,6 +2129,46 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_LOST_BURST_CAPTURE_get___() } +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_uint31_t_value_set___(void * jarg1, unsigned int jarg2) { + switch_uint31_t *arg1 = (switch_uint31_t *) 0 ; + unsigned int arg2 ; + + arg1 = (switch_uint31_t *)jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->value = arg2; +} + + +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_uint31_t_value_get___(void * jarg1) { + unsigned int jresult ; + switch_uint31_t *arg1 = (switch_uint31_t *) 0 ; + unsigned int result; + + arg1 = (switch_uint31_t *)jarg1; + result = (unsigned int) ((arg1)->value); + jresult = result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_new_switch_uint31_t___() { + void * jresult ; + switch_uint31_t *result = 0 ; + + result = (switch_uint31_t *)new switch_uint31_t(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_delete_switch_uint31_t___(void * jarg1) { + switch_uint31_t *arg1 = (switch_uint31_t *) 0 ; + + arg1 = (switch_uint31_t *)jarg1; + delete arg1; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dtmf_t_digit_set___(void * jarg1, char jarg2) { switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ; char arg2 ; @@ -23521,6 +23561,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_memory_usage_strea } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_rand___() { + int jresult ; + int result; + + result = (int)switch_rand(); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_profile_node_t_var_set___(void * jarg1, char * jarg2) { profile_node_s *arg1 = (profile_node_s *) 0 ; char *arg2 = (char *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index dc3926cbbb..6ca27764cf 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -11585,6 +11585,11 @@ else return ret; } + public static int switch_rand() { + int ret = freeswitchPINVOKE.switch_rand(); + return ret; + } + public static switch_caller_extension switch_caller_extension_new(SWIGTYPE_p_switch_core_session session, string extension_name, string extension_number) { global::System.IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_new(SWIGTYPE_p_switch_core_session.getCPtr(session), extension_name, extension_number); switch_caller_extension ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false); @@ -15975,6 +15980,18 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_LOST_BURST_CAPTURE_get___")] public static extern int LOST_BURST_CAPTURE_get(); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_uint31_t_value_set___")] + public static extern void switch_uint31_t_value_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_uint31_t_value_get___")] + public static extern uint switch_uint31_t_value_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_new_switch_uint31_t___")] + public static extern global::System.IntPtr new_switch_uint31_t(); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_delete_switch_uint31_t___")] + public static extern void delete_switch_uint31_t(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dtmf_t_digit_set___")] public static extern void switch_dtmf_t_digit_set(global::System.Runtime.InteropServices.HandleRef jarg1, char jarg2); @@ -21099,6 +21116,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_memory_usage_stream___")] public static extern string switch_memory_usage_stream(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_rand___")] + public static extern int switch_rand(); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_profile_node_t_var_set___")] public static extern void profile_node_t_var_set(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); @@ -47333,6 +47353,64 @@ public class switch_timer_interface : global::System.IDisposable { namespace FreeSWITCH.Native { +public class switch_uint31_t : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_uint31_t(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_uint31_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_uint31_t() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_uint31_t(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public uint value { + set { + freeswitchPINVOKE.switch_uint31_t_value_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_uint31_t_value_get(swigCPtr); + return ret; + } + } + + public switch_uint31_t() : this(freeswitchPINVOKE.new_switch_uint31_t(), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.12 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace FreeSWITCH.Native { + public class switch_unicast_conninfo : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; From 8224bb8e65bd876ead46b21db57ccf09a7478404 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 11 May 2024 12:37:32 +0300 Subject: [PATCH 11/13] [Build-System] Add ARM64 support, extend Debian helper scripts. Co-authored-by: s3rj1k --- debian/bootstrap.sh | 63 +++++++++++++++++---------------- debian/util.sh | 48 ++++++++++++++++++------- debian/version-omit_revision.pl | 22 ++++++++++++ 3 files changed, 91 insertions(+), 42 deletions(-) create mode 100755 debian/version-omit_revision.pl diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index aba9e38bf7..fa40702938 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -65,6 +65,9 @@ avoid_mods=( avoid_mods_armhf=( languages/mod_v8 ) +avoid_mods_arm64=( + languages/mod_v8 +) avoid_mods_sid=( directories/mod_ldap ) @@ -352,7 +355,7 @@ EOF print_core_control () { cat <= 1.13.17) Recommends: Suggests: libfreeswitch1-dbg @@ -385,7 +388,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch Package: python-esl Section: python -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${shlibs:Depends}, \${misc:Depends}, \${python:Depends} Description: Cross-Platform Scalable Multi-Protocol Soft Switch $(debian_wrap "${fs_description}") @@ -394,7 +397,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch Package: libesl-perl Section: perl -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${shlibs:Depends}, \${misc:Depends}, \${perl:Depends} Description: Cross-Platform Scalable Multi-Protocol Soft Switch $(debian_wrap "${fs_description}") @@ -402,7 +405,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch This package contains the Perl binding for FreeSWITCH Event Socket Library (ESL). Package: freeswitch-meta-bare -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch (= \${binary:Version}) Recommends: freeswitch-doc (= \${binary:Version}), @@ -420,7 +423,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch bare FreeSWITCH install. Package: freeswitch-meta-default -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-commands (= \${binary:Version}), freeswitch-mod-conference (= \${binary:Version}), @@ -462,7 +465,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch reasonably basic FreeSWITCH install. Package: freeswitch-meta-vanilla -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-init, freeswitch-mod-console (= \${binary:Version}), @@ -511,7 +514,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch running the FreeSWITCH vanilla example configuration. Package: freeswitch-meta-sorbet -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), Recommends: freeswitch-init, @@ -594,7 +597,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch modules except a few which aren't recommended. Package: freeswitch-meta-all -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-init, freeswitch-lang (= \${binary:Version}), @@ -705,7 +708,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch FreeSWITCH modules. Package: freeswitch-meta-codecs -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-amr (= \${binary:Version}), freeswitch-mod-amrwb (= \${binary:Version}), @@ -732,7 +735,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch most FreeSWITCH codecs. Package: freeswitch-meta-codecs-dbg -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-amr-dbg (= \${binary:Version}), freeswitch-mod-amrwb-dbg (= \${binary:Version}), @@ -759,7 +762,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch most FreeSWITCH codecs. Package: freeswitch-meta-conf -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch-conf-curl (= \${binary:Version}), freeswitch-conf-insideout (= \${binary:Version}), @@ -773,7 +776,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch examples for FreeSWITCH. Package: freeswitch-meta-lang -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch-lang-de (= \${binary:Version}), freeswitch-lang-en (= \${binary:Version}), @@ -789,7 +792,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch FreeSWITCH. Package: freeswitch-meta-mod-say -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch-mod-say-de (= \${binary:Version}), freeswitch-mod-say-en (= \${binary:Version}), @@ -814,7 +817,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch FreeSWITCH. Package: freeswitch-meta-mod-say-dbg -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch-mod-say-de-dbg (= \${binary:Version}), freeswitch-mod-say-en-dbg (= \${binary:Version}), @@ -839,7 +842,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch FreeSWITCH. Package: freeswitch-meta-all-dbg -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-meta-codecs-dbg (= \${binary:Version}), freeswitch-meta-mod-say (= \${binary:Version}), @@ -943,7 +946,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch Package: freeswitch-all-dbg Section: debug Priority: optional -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch-meta-all (= \${binary:Version}), freeswitch-meta-all-dbg (= \${binary:Version}) Description: debugging symbols for FreeSWITCH $(debian_wrap "${fs_description}") @@ -953,7 +956,7 @@ Description: debugging symbols for FreeSWITCH Package: freeswitch-dbg Section: debug Priority: optional -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch (= \${binary:Version}) Description: debugging symbols for FreeSWITCH $(debian_wrap "${fs_description}") @@ -963,7 +966,7 @@ Description: debugging symbols for FreeSWITCH Package: libfreeswitch1-dbg Section: debug Priority: optional -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, libfreeswitch1 (= \${binary:Version}) Description: debugging symbols for FreeSWITCH $(debian_wrap "${fs_description}") @@ -972,7 +975,7 @@ Description: debugging symbols for FreeSWITCH Package: libfreeswitch-dev Section: libdevel -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch Description: development libraries and header files for FreeSWITCH $(debian_wrap "${fs_description}") @@ -981,7 +984,7 @@ Description: development libraries and header files for FreeSWITCH Package: freeswitch-doc Section: doc -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends} Description: documentation for FreeSWITCH $(debian_wrap "${fs_description}") @@ -994,7 +997,7 @@ Description: documentation for FreeSWITCH ## languages Package: freeswitch-lang -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends}, freeswitch-lang-en (= \${binary:Version}) Description: Language files for FreeSWITCH @@ -1006,7 +1009,7 @@ Description: Language files for FreeSWITCH ## timezones Package: freeswitch-timezones -Architecture: amd64 armhf +Architecture: amd64 armhf arm64 Depends: \${misc:Depends} Description: Timezone files for FreeSWITCH $(debian_wrap "${fs_description}") @@ -1020,7 +1023,7 @@ EOF if [ ${use_sysvinit} = "true" ]; then cat <= 3.0-6), sysvinit | sysvinit-utils Conflicts: freeswitch-init Provides: freeswitch-init @@ -1033,7 +1036,7 @@ EOF else cat <&2 echo $orig } @@ -292,9 +308,9 @@ create_dsc () { prep_create_dsc "$@" - local OPTIND OPTARG suite_postfix="" suite_postfix_p=false zl=9 + local OPTIND OPTARG suite_postfix="" suite_postfix_p=false soft_reset=false zl=9 - while getopts 'a:f:m:p:s:u:z:' o "$@"; do + while getopts 'a:f:m:p:s:u:xz:' o "$@"; do case "$o" in a) ;; f) ;; @@ -302,6 +318,7 @@ create_dsc () { p) ;; s) ;; u) suite_postfix="$OPTARG"; suite_postfix_p=true;; + x) soft_reset=true;; z) zl="$OPTARG";; esac done @@ -328,7 +345,11 @@ create_dsc () { local dsc="../$(dsc_base).dsc" - git reset --hard HEAD^ && git clean -fdx + if $soft_reset; then + git reset --soft HEAD^ + else + git reset --hard HEAD^ && git clean -fdx + fi } 1>&2 echo $dsc } @@ -686,6 +707,7 @@ commands: Set FS bootstrap/build -j flags -u Specify a custom suite postfix + -x Use git soft reset instead of hard reset -z Set compression level create-orig (same for 'prep_create_orig') @@ -694,6 +716,8 @@ commands: Choose custom list of modules to build -n Nightly build -v Set version + -V Set version (without replacing every '-' to '~') + -x Use git soft reset instead of hard reset -z Set compression level EOF diff --git a/debian/version-omit_revision.pl b/debian/version-omit_revision.pl new file mode 100755 index 0000000000..c6f5767a29 --- /dev/null +++ b/debian/version-omit_revision.pl @@ -0,0 +1,22 @@ +#!/usr/bin/perl +use strict; +use warnings; +use Dpkg::Version; + +my $version; + +open(my $fh, '-|', 'dpkg-parsechangelog -S version') or die "Failed to execute dpkg-parsechangelog: $!"; +{ + local $/; + $version = <$fh>; +} +close $fh; + +$version =~ s/\s+$//; + +die "No version found or empty output from dpkg-parsechangelog" unless defined $version and $version ne ''; + +my $v = Dpkg::Version->new($version); +my $vs = $v->as_string(omit_epoch => 1, omit_revision => 1); + +print "$vs\n"; From 72d17ccf5c559947de2e2c08b0778f677e3e5051 Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Thu, 6 Jun 2024 23:59:10 +0200 Subject: [PATCH 12/13] [GHA] Add build workflow. --- .../docker/debian/bookworm/amd64/Dockerfile | 97 ++++++++++++++++ .../docker/debian/bookworm/arm32v7/Dockerfile | 96 ++++++++++++++++ .../docker/debian/bookworm/arm64v8/Dockerfile | 96 ++++++++++++++++ .../docker/debian/bullseye/amd64/Dockerfile | 96 ++++++++++++++++ .../docker/debian/bullseye/arm32v7/Dockerfile | 96 ++++++++++++++++ .../docker/debian/bullseye/arm64v8/Dockerfile | 96 ++++++++++++++++ .github/docker/debian/buster/amd64/Dockerfile | 97 ++++++++++++++++ .../docker/debian/buster/arm32v7/Dockerfile | 96 ++++++++++++++++ .../docker/debian/buster/arm64v8/Dockerfile | 96 ++++++++++++++++ .github/workflows/build.yml | 107 ++++++++++++++++++ 10 files changed, 973 insertions(+) create mode 100644 .github/docker/debian/bookworm/amd64/Dockerfile create mode 100644 .github/docker/debian/bookworm/arm32v7/Dockerfile create mode 100644 .github/docker/debian/bookworm/arm64v8/Dockerfile create mode 100644 .github/docker/debian/bullseye/amd64/Dockerfile create mode 100644 .github/docker/debian/bullseye/arm32v7/Dockerfile create mode 100644 .github/docker/debian/bullseye/arm64v8/Dockerfile create mode 100644 .github/docker/debian/buster/amd64/Dockerfile create mode 100644 .github/docker/debian/buster/arm32v7/Dockerfile create mode 100644 .github/docker/debian/buster/arm64v8/Dockerfile create mode 100644 .github/workflows/build.yml diff --git a/.github/docker/debian/bookworm/amd64/Dockerfile b/.github/docker/debian/bookworm/amd64/Dockerfile new file mode 100644 index 0000000000..b500830148 --- /dev/null +++ b/.github/docker/debian/bookworm/amd64/Dockerfile @@ -0,0 +1,97 @@ +ARG BUILDER_IMAGE=debian:bookworm-20240513 + +FROM ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data +ARG CODENAME=bookworm +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/debian-unstable/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} +RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env + +RUN . ~/.env && ./debian/util.sh prep-create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x +RUN . ~/.env && ./debian/util.sh prep-create-dsc ${CODENAME} + +RUN apt-get -q update && \ + mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \ + apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" +RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + --force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}" + +RUN . ~/.env && ./debian/util.sh create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x + +RUN dpkg-source \ + --diff-ignore=.* \ + --compression=xz \ + --compression-level=9 \ + --build \ + . \ + && debuild -b -us -uc \ + && mkdir OUT \ + && mv -v ../*.{deb,dsc,changes,tar.*} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bookworm/arm32v7/Dockerfile b/.github/docker/debian/bookworm/arm32v7/Dockerfile new file mode 100644 index 0000000000..43b4778b3e --- /dev/null +++ b/.github/docker/debian/bookworm/arm32v7/Dockerfile @@ -0,0 +1,96 @@ +ARG BUILDER_IMAGE=arm32v7/debian:bookworm-20240513 + +FROM --platform=linux/arm32 ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data +ARG CODENAME=bookworm +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} +RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env + +RUN . ~/.env && ./debian/util.sh prep-create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x +RUN . ~/.env && ./debian/util.sh prep-create-dsc -a armhf ${CODENAME} + +RUN apt-get -q update && \ + mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \ + apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" +RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + --force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}" +RUN . ~/.env && ./debian/util.sh create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x + +RUN dpkg-source \ + --diff-ignore=.* \ + --compression=xz \ + --compression-level=9 \ + --build \ + . \ + && debuild -b -us -uc \ + && mkdir OUT \ + && mv -v ../*.{deb,dsc,changes,tar.*} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bookworm/arm64v8/Dockerfile b/.github/docker/debian/bookworm/arm64v8/Dockerfile new file mode 100644 index 0000000000..50c24957f1 --- /dev/null +++ b/.github/docker/debian/bookworm/arm64v8/Dockerfile @@ -0,0 +1,96 @@ +ARG BUILDER_IMAGE=arm64v8/debian:bookworm-20240513 + +FROM --platform=linux/arm64 ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data +ARG CODENAME=bookworm +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/debian-unstable/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} +RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env + +RUN . ~/.env && ./debian/util.sh prep-create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x +RUN . ~/.env && ./debian/util.sh prep-create-dsc -a arm64 ${CODENAME} + +RUN apt-get -q update && \ + mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \ + apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" +RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + --force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}" +RUN . ~/.env && ./debian/util.sh create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x + +RUN dpkg-source \ + --diff-ignore=.* \ + --compression=xz \ + --compression-level=9 \ + --build \ + . \ + && debuild -b -us -uc \ + && mkdir OUT \ + && mv -v ../*.{deb,dsc,changes,tar.*} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bullseye/amd64/Dockerfile b/.github/docker/debian/bullseye/amd64/Dockerfile new file mode 100644 index 0000000000..aefbd38224 --- /dev/null +++ b/.github/docker/debian/bullseye/amd64/Dockerfile @@ -0,0 +1,96 @@ +ARG BUILDER_IMAGE=debian:bullseye-20240513 + +FROM ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data +ARG CODENAME=bullseye +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/debian-unstable/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} +RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env + +RUN . ~/.env && ./debian/util.sh prep-create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x +RUN . ~/.env && ./debian/util.sh prep-create-dsc ${CODENAME} + +RUN apt-get -q update && \ + mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \ + apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" +RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + --force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}" +RUN . ~/.env && ./debian/util.sh create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x + +RUN dpkg-source \ + --diff-ignore=.* \ + --compression=xz \ + --compression-level=9 \ + --build \ + . \ + && debuild -b -us -uc \ + && mkdir OUT \ + && mv -v ../*.{deb,dsc,changes,tar.*} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bullseye/arm32v7/Dockerfile b/.github/docker/debian/bullseye/arm32v7/Dockerfile new file mode 100644 index 0000000000..b3a6f00c36 --- /dev/null +++ b/.github/docker/debian/bullseye/arm32v7/Dockerfile @@ -0,0 +1,96 @@ +ARG BUILDER_IMAGE=arm32v7/debian:bullseye-20240513 + +FROM --platform=linux/arm32 ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data +ARG CODENAME=bullseye +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} +RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env + +RUN . ~/.env && ./debian/util.sh prep-create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x +RUN . ~/.env && ./debian/util.sh prep-create-dsc -a armhf ${CODENAME} + +RUN apt-get -q update && \ + mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \ + apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" +RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + --force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}" +RUN . ~/.env && ./debian/util.sh create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x + +RUN dpkg-source \ + --diff-ignore=.* \ + --compression=xz \ + --compression-level=9 \ + --build \ + . \ + && debuild -b -us -uc \ + && mkdir OUT \ + && mv -v ../*.{deb,dsc,changes,tar.*} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bullseye/arm64v8/Dockerfile b/.github/docker/debian/bullseye/arm64v8/Dockerfile new file mode 100644 index 0000000000..dfa899540e --- /dev/null +++ b/.github/docker/debian/bullseye/arm64v8/Dockerfile @@ -0,0 +1,96 @@ +ARG BUILDER_IMAGE=arm64v8/debian:bullseye-20240513 + +FROM --platform=linux/arm64 ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data +ARG CODENAME=bullseye +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/debian-unstable/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} +RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env + +RUN . ~/.env && ./debian/util.sh prep-create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x +RUN . ~/.env && ./debian/util.sh prep-create-dsc -a arm64 ${CODENAME} + +RUN apt-get -q update && \ + mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \ + apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" +RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + --force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}" +RUN . ~/.env && ./debian/util.sh create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x + +RUN dpkg-source \ + --diff-ignore=.* \ + --compression=xz \ + --compression-level=9 \ + --build \ + . \ + && debuild -b -us -uc \ + && mkdir OUT \ + && mv -v ../*.{deb,dsc,changes,tar.*} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/buster/amd64/Dockerfile b/.github/docker/debian/buster/amd64/Dockerfile new file mode 100644 index 0000000000..119a18076e --- /dev/null +++ b/.github/docker/debian/buster/amd64/Dockerfile @@ -0,0 +1,97 @@ +ARG BUILDER_IMAGE=debian:buster-20240513 + +FROM ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data +ARG CODENAME=buster +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/debian-unstable/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} + +RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env + +RUN . ~/.env && ./debian/util.sh prep-create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x +RUN . ~/.env && ./debian/util.sh prep-create-dsc ${CODENAME} + +RUN apt-get -q update && \ + mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \ + apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" +RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + --force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}" +RUN . ~/.env && ./debian/util.sh create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x + +RUN dpkg-source \ + --diff-ignore=.* \ + --compression=xz \ + --compression-level=9 \ + --build \ + . \ + && debuild -b -us -uc \ + && mkdir OUT \ + && mv -v ../*.{deb,dsc,changes,tar.*} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/buster/arm32v7/Dockerfile b/.github/docker/debian/buster/arm32v7/Dockerfile new file mode 100644 index 0000000000..2113f55bd8 --- /dev/null +++ b/.github/docker/debian/buster/arm32v7/Dockerfile @@ -0,0 +1,96 @@ +ARG BUILDER_IMAGE=arm32v7/debian:buster-20240513 + +FROM --platform=linux/arm32 ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data +ARG CODENAME=buster +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} +RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env + +RUN . ~/.env && ./debian/util.sh prep-create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x +RUN . ~/.env && ./debian/util.sh prep-create-dsc -a armhf ${CODENAME} + +RUN apt-get -q update && \ + mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \ + apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" +RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + --force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}" +RUN . ~/.env && ./debian/util.sh create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x + +RUN dpkg-source \ + --diff-ignore=.* \ + --compression=xz \ + --compression-level=9 \ + --build \ + . \ + && debuild -b -us -uc \ + && mkdir OUT \ + && mv -v ../*.{deb,dsc,changes,tar.*} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/buster/arm64v8/Dockerfile b/.github/docker/debian/buster/arm64v8/Dockerfile new file mode 100644 index 0000000000..150a77fec2 --- /dev/null +++ b/.github/docker/debian/buster/arm64v8/Dockerfile @@ -0,0 +1,96 @@ +ARG BUILDER_IMAGE=arm64v8/debian:buster-20240513 + +FROM --platform=linux/arm64 ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data +ARG CODENAME=buster +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/debian-unstable/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} +RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env + +RUN . ~/.env && ./debian/util.sh prep-create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x +RUN . ~/.env && ./debian/util.sh prep-create-dsc -a arm64 ${CODENAME} + +RUN apt-get -q update && \ + mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \ + apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" +RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + --force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}" +RUN . ~/.env && ./debian/util.sh create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x + +RUN dpkg-source \ + --diff-ignore=.* \ + --compression=xz \ + --compression-level=9 \ + --build \ + . \ + && debuild -b -us -uc \ + && mkdir OUT \ + && mv -v ../*.{deb,dsc,changes,tar.*} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..e16da9a364 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,107 @@ +name: Build and Distribute + +on: + pull_request: + push: + branches: + - master + paths: + - "**" + workflow_dispatch: + +concurrency: + group: ${{ github.head_ref || github.ref }} + +jobs: + excludes: + runs-on: ubuntu-latest + outputs: + deb: ${{ steps.deb.outputs.excludes }} + steps: + - id: deb + name: Generate Matrix excludes for DEB + run: | + JSON="[]" + + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + JSON=$(jq -n '[ + { + "version": "bookworm", + "platform": { + "name": "amd64" + } + }, + { + "version": "bookworm", + "platform": { + "name": "arm64v8" + } + }, + { + "version": "bullseye" + } + ]') + fi + + echo "excludes=$(echo $JSON | jq -c .)" | tee -a $GITHUB_OUTPUT + + deb: + name: 'DEB' + permissions: + id-token: write + contents: read + needs: + - excludes + uses: signalwire/actions-template/.github/workflows/cicd-docker-build-and-distribute.yml@main + strategy: + # max-parallel: 1 + fail-fast: false + matrix: + os: + - debian + version: + - bookworm + - bullseye + - buster + platform: + - name: amd64 + runner: ubuntu-latest + - name: arm32v7 + runner: linux-arm64-4-core-public + - name: arm64v8 + runner: linux-arm64-4-core-public + exclude: ${{ fromJson(needs.excludes.outputs.deb) }} + with: + RUNNER: ${{ matrix.platform.runner }} + ARTIFACTS_PATTERN: '.*\.(deb|dsc|changes|tar.bz2|tar.gz|tar.lzma|tar.xz)$' + DOCKERFILE: .github/docker/${{ matrix.os }}/${{ matrix.version }}/${{ matrix.platform.name }}/Dockerfile + MAINTAINER: 'Andrey Volk ' + META_FILE_PATH_PREFIX: /var/www/freeswitch/${{ github.ref_name }}/${{ github.run_id }}-${{ github.run_number }} + PLATFORM: ${{ matrix.platform.name }} + REPO_DOMAIN: freeswitch.signalwire.com + TARGET_ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.version }}-${{ matrix.platform.name }}-artifact + UPLOAD_BUILD_ARTIFACTS: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.title, ':upload-artifacts') }} + secrets: + GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }} + HOSTNAME: ${{ secrets.HOSTNAME }} + PROXY_URL: ${{ secrets.PROXY_URL }} + USERNAME: ${{ secrets.USERNAME }} + TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }} + REPO_USERNAME: 'signalwire' + REPO_PASSWORD: ${{ secrets.REPOTOKEN }} + + meta: + name: 'Publish build data to meta-repo' + if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.title, ':upload-artifacts') }} + needs: + - deb + permissions: + id-token: write + contents: read + uses: signalwire/actions-template/.github/workflows/meta-repo-content.yml@main + with: + META_CONTENT: '/var/www/freeswitch/${{ github.ref_name }}/${{ github.run_id }}-${{ github.run_number }}' + META_REPO: signalwire/bamboo_gha_trigger + META_REPO_BRANCH: trigger/freeswitch/${{ github.ref_name }} + secrets: + GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }} From a0e7fb8e7112cfaf413c6f26c7fa7709279ebc21 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 7 Mar 2024 21:45:13 +0300 Subject: [PATCH 13/13] [Build-System] Update expired Certificate Thumbprint on Windows. --- w32/Setup/Setup.2017.wixproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w32/Setup/Setup.2017.wixproj b/w32/Setup/Setup.2017.wixproj index bf0aae0498..ef66d7c2e8 100644 --- a/w32/Setup/Setup.2017.wixproj +++ b/w32/Setup/Setup.2017.wixproj @@ -13,7 +13,7 @@ 2.0 FreeSWITCH Package - bf386393c880967b00adbc438aee534de6211774 + 076ce3c57198fc39443bd87f4aab86dac0aab62d http://timestamp.comodoca.com $(WindowsSDK80Path)bin\x86\signtool.exe $(WindowsSDK80Path)bin\x64\signtool.exe