public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-apps@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH setup 09/16] Move is_64bit to state
Date: Fri,  8 Mar 2024 18:34:28 +0000	[thread overview]
Message-ID: <20240308183440.4263-10-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <20240308183440.4263-1-jon.turney@dronecode.org.uk>

Note this controls what we will install, not indicating how we are
built, so it's use in splash is questionable, and is downright wrong in
the messages from IniDbBuilderPackage giving URLs for an updated
version of setup.

This controls stuff all over the place!
---
 ini.h     |  1 -
 main.cc   | 34 ++++++++++++++--------------------
 splash.cc |  2 +-
 state.cc  |  6 ++++++
 state.h   |  2 ++
 5 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/ini.h b/ini.h
index f1788e2..2ca4f5b 100644
--- a/ini.h
+++ b/ini.h
@@ -23,7 +23,6 @@
 typedef std::vector <std::string> IniList;
 extern IniList found_ini_list, setup_ext_list;
 
-extern bool is_64bit;
 extern bool is_new_install;
 extern std::string SetupArch;
 extern std::string SetupIniDir;
diff --git a/main.cc b/main.cc
index 2ce3b30..c359ba9 100644
--- a/main.cc
+++ b/main.cc
@@ -83,7 +83,6 @@
 extern char **_argv;
 #endif
 
-bool is_64bit;
 bool is_new_install = false;
 std::string SetupArch;
 std::string SetupIniDir;
@@ -263,26 +262,21 @@ WinMain (HINSTANCE h,
     else if (HelpOption)
       help_option = true;
 
-    if (!((std::string) Arch).size ())
+    if (((std::string) Arch).size ())
       {
-#ifdef __x86_64__
-	is_64bit = true;
-#else
-	is_64bit = false;
-#endif
-      }
-    else if (((std::string) Arch).find ("64") != std::string::npos)
-      is_64bit = true;
-    else if (((std::string) Arch).find ("32") != std::string::npos
-	     || ((std::string) Arch).find ("x86") != std::string::npos)
-      is_64bit = false;
-    else
-      {
-	char buff[80 + ((std::string) Arch).size ()];
-	sprintf (buff, "Invalid option for --arch:  \"%s\"",
-		 ((std::string) Arch).c_str ());
-	fprintf (stderr, "*** %s\n", buff);
-	exit (1);
+        if (((std::string) Arch).find ("64") != std::string::npos)
+          is_64bit = true;
+        else if (((std::string) Arch).find ("32") != std::string::npos
+                 || ((std::string) Arch).find ("x86") != std::string::npos)
+          is_64bit = false;
+        else
+          {
+            char buff[80 + ((std::string) Arch).size ()];
+            sprintf (buff, "Invalid option for --arch:  \"%s\"",
+                     ((std::string) Arch).c_str ());
+            fprintf (stderr, "*** %s\n", buff);
+            exit (1);
+          }
       }
 
     if (GuiLangOption.isPresent())
diff --git a/splash.cc b/splash.cc
index 40c1334..8b601db 100644
--- a/splash.cc
+++ b/splash.cc
@@ -19,7 +19,7 @@
 #include "setup_version.h"
 #include "resource.h"
 #include "splash.h"
-#include "ini.h"
+#include "state.h"
 
 #define SPLASH_URL "https://cygwin.com"
 #define SPLASH_COPYRIGHT "Copyright 2000-2023"
diff --git a/state.cc b/state.cc
index 111b890..ef14116 100644
--- a/state.cc
+++ b/state.cc
@@ -29,3 +29,9 @@ int root_menu;
 int root_desktop;
 
 LANGID langid;
+
+#ifdef __x86_64__
+bool is_64bit = true;
+#else
+bool is_64bit = false;
+#endif
diff --git a/state.h b/state.h
index b211de3..c4b88a4 100644
--- a/state.h
+++ b/state.h
@@ -48,4 +48,6 @@ extern int root_desktop;
 
 extern LANGID langid;
 
+extern bool is_64bit;
+
 #endif /* SETUP_STATE_H */
-- 
2.43.0


  parent reply	other threads:[~2024-03-08 18:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08 18:34 [PATCH setup 00/16] Groundwork for a GUI-less installation tool Jon Turney
2024-03-08 18:34 ` [PATCH setup 01/16] Drop forward declaration of non-existent class IniState Jon Turney
2024-03-08 18:34 ` [PATCH setup 02/16] Move setup_exts[] to the only place it's used Jon Turney
2024-03-08 18:34 ` [PATCH setup 03/16] Split GuiParseFeedback out from ini fetcher Jon Turney
2024-03-08 18:34 ` [PATCH setup 04/16] Split out site into SiteSettings and SitePage Jon Turney
2024-03-08 18:34 ` [PATCH setup 05/16] Don't call Antivirus::AtExit() directly from Logger::exit() Jon Turney
2024-03-08 18:34 ` [PATCH setup 06/16] Simplify invocation of UserSettings::open_settings() Jon Turney
2024-03-08 18:34 ` [PATCH setup 07/16] Split out URL fetching progress reporting Jon Turney
2024-03-08 18:34 ` [PATCH setup 08/16] Instantiate found_ini_list in ini.cc Jon Turney
2024-03-08 18:34 ` Jon Turney [this message]
2024-03-08 18:34 ` [PATCH setup 10/16] Move setup.ini pathame components to ini.cc Jon Turney
2024-03-08 18:34 ` [PATCH setup 11/16] Drop hinstance global Jon Turney
2024-03-08 18:34 ` [PATCH setup 12/16] Spit out GetNetAuth from NetIO Jon Turney
2024-03-08 18:34 ` [PATCH setup 13/16] Split out hash checking progress reporting Jon Turney
2024-03-08 18:34 ` [PATCH setup 14/16] Push check_for_cached into package_source Jon Turney
2024-03-08 18:34 ` [PATCH setup 15/16] Put various shared subcomponents into a convenience library Jon Turney
2024-03-08 18:34 ` [PATCH setup 16/16] Add beginnings of a command line installation tool Jon Turney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240308183440.4263-10-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).