@@ -81,6 +81,7 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
8181#include " deploy.h"
8282#include " mode.h"
8383#include " license.h"
84+ #include " stacksecurity.h"
8485
8586#include " debug.h"
8687
@@ -353,6 +354,19 @@ bool MCDeployParameters::InitWithArray(MCExecContext &ctxt, MCArrayRef p_array)
353354 }
354355 }
355356
357+ // If the 'banner_class' string is present, then set the class override.
358+ MCAutoStringRef t_banner_class;
359+ if (!ctxt . CopyOptElementAsString (p_array, MCNAME (" banner_class" ), false , &t_banner_class))
360+ return false ;
361+ if (MCStringIsEqualToCString (*t_banner_class,
362+ " commercial" ,
363+ kMCStringOptionCompareCaseless ))
364+ banner_class = kMCLicenseClassEvaluation ;
365+ else if (MCStringIsEqualToCString (*t_banner_class,
366+ " professional" ,
367+ kMCStringOptionCompareCaseless ))
368+ banner_class = kMCLicenseClassProfessionalEvaluation ;
369+
356370 return true ;
357371}
358372
@@ -361,6 +375,10 @@ bool MCDeployParameters::InitWithArray(MCExecContext &ctxt, MCArrayRef p_array)
361375static bool MCDeployWriteDefinePrologueSection (const MCDeployParameters& p_params, MCDeployCapsuleRef p_capsule)
362376{
363377 MCCapsulePrologueSection t_prologue;
378+ t_prologue . banner_timeout = p_params . banner_timeout;
379+ t_prologue . program_timeout = p_params . timeout;
380+
381+ MCDeployByteSwapRecord (true , " ll" , &t_prologue, sizeof (t_prologue));
364382
365383 return MCDeployCapsuleDefine (p_capsule, kMCCapsuleSectionTypePrologue , &t_prologue, sizeof (t_prologue));
366384}
@@ -379,11 +397,13 @@ static bool MCDeployWriteDefineLicenseSection(const MCDeployParameters& p_params
379397 case kMCLicenseClassCommunity :
380398 t_edition = 1 ;
381399 break ;
382-
400+
401+ case kMCLicenseClassEvaluation :
383402 case kMCLicenseClassCommercial :
384403 t_edition = 2 ;
385404 break ;
386405
406+ case kMCLicenseClassProfessionalEvaluation :
387407 case kMCLicenseClassProfessional :
388408 t_edition = 3 ;
389409 break ;
@@ -395,6 +415,11 @@ static bool MCDeployWriteDefineLicenseSection(const MCDeployParameters& p_params
395415 sizeof (t_edition));
396416}
397417
418+ static bool MCDeployWriteDefineBannerSecion (const MCDeployParameters& p_params, MCDeployCapsuleRef p_capsule)
419+ {
420+ return MCDeployCapsuleDefine (p_capsule, kMCCapsuleSectionTypeBanner , MCDataGetBytePtr (p_params . banner_stackfile), MCDataGetLength (p_params . banner_stackfile));
421+ }
422+
398423// This method generates the standalone specific capsule elements. This is
399424// just a Standalone Prologue section at the moment.
400425static bool MCDeployWriteCapsuleDefineStandaloneSections (const MCDeployParameters& p_params, MCDeployCapsuleRef p_capsule)
@@ -405,11 +430,16 @@ static bool MCDeployWriteCapsuleDefineStandaloneSections(const MCDeployParameter
405430 // First emit the prologue.
406431 if (t_success)
407432 t_success = MCDeployWriteDefinePrologueSection (p_params, p_capsule);
408-
409- // Next emit the license info.
410- if (t_success)
433+
434+ // Next emit the license info.
435+ if (t_success)
411436 t_success = MCDeployWriteDefineLicenseSection (p_params, p_capsule);
412437
438+ // Next emit the banner.
439+ if (t_success &&
440+ !MCDataIsEmpty (p_params . banner_stackfile))
441+ t_success = MCDeployWriteDefineBannerSecion (p_params, p_capsule);
442+
413443 return t_success;
414444}
415445
@@ -710,11 +740,48 @@ void MCIdeDeploy::exec_ctxt(MCExecContext& ctxt)
710740 }
711741#endif
712742
713- // Now, if we are not licensed for a target, then its an error.
743+ // If the banner_class field is set and we are not a trial license, we
744+ // override the license class with that specified.
745+ uint32_t t_license_class;
746+ t_license_class = kMCLicenseClassNone ;
747+ if (MClicenseparameters . license_class == kMCLicenseClassCommercial )
748+ {
749+ // If we have a commercial license, then we only allow a commercial
750+ // evaluation.
751+ if (t_params . banner_class == kMCLicenseClassEvaluation )
752+ t_license_class = kMCLicenseClassEvaluation ;
753+ }
754+ else if (MClicenseparameters . license_class == kMCLicenseClassProfessional )
755+ {
756+ // If we are a professional license, then we allow any kind of
757+ // trial.
758+ t_license_class = t_params . banner_class;
759+ }
760+
761+ if (t_license_class == kMCLicenseClassNone )
762+ t_license_class = MClicenseparameters . license_class;
763+
764+ // Now check to see if we should build a trial - this if the license class is a
765+ // trail, or the banner_class override is specified and the chosen option is
766+ // compatible with the license class.
767+ bool t_is_trial;
768+ t_is_trial = false ;
769+ if (t_license_class == kMCLicenseClassEvaluation ||
770+ t_license_class == kMCLicenseClassProfessionalEvaluation )
771+ t_is_trial = true ;
772+
773+ // Now, if we are not licensed for a target, then its an error. If we are in trial
774+ // mode, however, all platforms are licensed (apart from embedded) they just will
775+ // timeout.
714776 bool t_is_licensed;
715777 t_is_licensed = false ;
778+
716779 if (MCnoui && MClicenseparameters . license_class == kMCLicenseClassCommunity )
717780 t_is_licensed = true ;
781+ else if (t_is_trial &&
782+ m_platform != PLATFORM_IOS_EMBEDDED &&
783+ m_platform != PLATFORM_ANDROID_EMBEDDED)
784+ t_is_licensed = true ;
718785 else if (m_platform == PLATFORM_WINDOWS)
719786 t_is_licensed = (MClicenseparameters . deploy_targets & kMCLicenseDeployToWindows ) != 0 ;
720787 else if (m_platform == PLATFORM_MACOSX)
@@ -738,7 +805,59 @@ void MCIdeDeploy::exec_ctxt(MCExecContext& ctxt)
738805 t_soft_error = true ;
739806 t_has_error = true ;
740807 }
741-
808+
809+ uint32_t t_platform;
810+ switch (m_platform)
811+ {
812+ case PLATFORM_MACOSX:
813+ t_platform = kMCLicenseDeployToMacOSX ;
814+ break ;
815+ case PLATFORM_WINDOWS:
816+ t_platform = kMCLicenseDeployToWindows ;
817+ break ;
818+ case PLATFORM_LINUX:
819+ t_platform = kMCLicenseDeployToLinux ;
820+ break ;
821+ case PLATFORM_IOS:
822+ t_platform = kMCLicenseDeployToIOS ;
823+ break ;
824+ case PLATFORM_ANDROID:
825+ t_platform = kMCLicenseDeployToAndroid ;
826+ break ;
827+ case PLATFORM_IOS_EMBEDDED:
828+ t_platform = kMCLicenseDeployToIOSEmbedded ;
829+ break ;
830+ case PLATFORM_ANDROID_EMBEDDED:
831+ t_platform = kMCLicenseDeployToAndroidEmbedded ;
832+ break ;
833+ case PLATFORM_EMSCRIPTEN:
834+ t_platform = kMCLicenseDeployToHTML5 ;
835+ break ;
836+ }
837+
838+ if (!t_has_error)
839+ {
840+ // If this is a trial then set the timeout.
841+ if (t_is_trial)
842+ {
843+ if (m_platform != PLATFORM_IOS &&
844+ m_platform != PLATFORM_ANDROID &&
845+ m_platform != PLATFORM_EMSCRIPTEN)
846+ t_params . timeout = 5 * 60 ;
847+ else
848+ t_params . timeout = 1 * 60 ;
849+
850+ t_params . banner_timeout = 10 ;
851+ }
852+
853+ // Pass the deploy parameters through any stack security related steps.
854+ if (!MCStackSecurityPreDeploy (t_platform, t_params))
855+ {
856+ t_soft_error = true ;
857+ t_has_error = true ;
858+ }
859+ }
860+
742861 if (!t_has_error)
743862 {
744863 if (m_platform == PLATFORM_WINDOWS)
0 commit comments