Enhancement: Fixes #176, Move branding into separate install package (out of winver)

This commit is contained in:
Rory Fewell
2023-05-10 01:55:28 +01:00
parent 37c8d8fb18
commit 5c5bc14551
45 changed files with 303 additions and 10 deletions

View File

@@ -1,10 +1,56 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.3)
set(REPO_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../..)
# Define some constants used by builds
#
set(WINTC_COMPILE_OPTIONS -Wall -Wextra -Wpedantic -Werror)
set(WINTC_ASSETS_INSTALL_DIR share/wintc)
# Handle SKU stuff
#
set(
WINTC_VALID_SKUS
xpclient-home # CLIENT
xpclient-pro
xpclient-linux
xpclient-mce
xpclient-tabletpc
xpclient-starter
xpclient-embedded
xpclient-flp
xpclient-wepos
xpclient-wes
xpclient-posready
dnsrv-std # SERVER
dnsrv-ent
dnsrv-dtc
dnsrv-sbs
dnsrv-web
dnsrv-ccs
dnsrv_r2-std # SERVER R2
dnsrv_r2-ent
dnsrv_r2-dtc
homesrv # HOME SERVER
)
if (NOT DEFINED WINTC_SKU)
message(
FATAL_ERROR
"No SKU has been specified."
)
endif()
if (NOT ${WINTC_SKU} IN_LIST WINTC_VALID_SKUS)
message(
FATAL_ERROR
"The SKU ${WINTC_SKU} is not valid."
)
endif()
# Define func for importing constants from a file
#
function(wintc_source_vars SOURCE_PATH)
file(STRINGS ${SOURCE_PATH} sourceLines)

View File

@@ -84,7 +84,8 @@ do
mkdir "${local_build_dir}"
cd "${local_build_dir}"
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr -DWINTC_PKGMGR=deb "${full_component_dir}" > "${CMAKE_LOG_PATH}"
# Default to Pro SKU for now
cmake -DWINTC_SKU=xpclient-pro -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr -DWINTC_PKGMGR=deb "${full_component_dir}" > "${CMAKE_LOG_PATH}"
((build_result+=$?))
cat "${CMAKE_LOG_PATH}" # So the output is still in stdout as well

View File

@@ -4,6 +4,8 @@
#include "errors.h"
#include "msgbox.h"
#define RETURN_IF_NO_ERROR(e) if (e == NULL || *e == NULL) { return; }
//
// GLIB BOILERPLATE
//
@@ -16,6 +18,8 @@ void wintc_display_error_and_clear(
GError** error
)
{
RETURN_IF_NO_ERROR(error)
wintc_messagebox_show(
NULL,
(*error)->message,
@@ -31,6 +35,8 @@ void wintc_log_error_and_clear(
GError** error
)
{
RETURN_IF_NO_ERROR(error)
g_message("%s", (*error)->message);
g_clear_error(error);
@@ -40,6 +46,8 @@ void wintc_nice_error_and_clear(
GError** error
)
{
RETURN_IF_NO_ERROR(error)
const gchar* message = NULL;
if ((*error)->domain == WINTC_GENERAL_ERROR)

2
shared/winbrand/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
# Ignore dynamically generated source
brand.c

View File

@@ -0,0 +1,134 @@
cmake_minimum_required(VERSION 3.0)
project(
libwintc-winbrand
VERSION 1.0
DESCRIPTION "Windows Total Conversion Windows branding library."
)
set(PROJECT_ANYARCH false)
set(PROJECT_FREESTATUS false)
set(PROJECT_MAINTAINER "Rory Fewell <roryf@oddmatics.uk>")
set(
PROJECT_DEPENDENCIES
libgdk-pixbuf-2.0-0
libglib2.0-0
)
set(PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR})
include(GNUInstallDirs)
include(../../packaging/cmake-inc/common/CMakeLists.txt)
include(../../packaging/cmake-inc/libraries/CMakeLists.txt)
include(../../packaging/cmake-inc/packaging/CMakeLists.txt)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GDK_PIXBUF REQUIRED gdk-pixbuf-2.0)
pkg_check_modules(GLIB REQUIRED glib-2.0)
configure_file(src/brand.c.in ${PROJECT_ROOT}/src/brand.c @ONLY)
add_library(
libwintc-winbrand
src/brand.h
src/brand.c
)
set_target_properties(
libwintc-winbrand
PROPERTIES
PUBLIC_HEADER public/wintc-winbrand.h
SOVERSION 1
VERSION ${PROJECT_VERSION}
)
target_compile_options(
libwintc-winbrand
PRIVATE ${WINTC_COMPILE_OPTIONS}
)
target_include_directories(
libwintc-winbrand
SYSTEM
PRIVATE ${GDK_PIXBUF_INCLUDE_DIRS}
PRIVATE ${GLIB_INCLUDE_DIRS}
)
target_link_directories(
libwintc-winbrand
PRIVATE ${GDK_PIXBUF_LIBRARY_DIRS}
PRIVATE ${GLIB_LIBRARY_DIRS}
)
target_link_libraries(
libwintc-winbrand
PRIVATE ${GDK_PIXBUF_LIBRARIES}
PRIVATE ${GLIB_LIBRARIES}
)
# Pick banner based on SKU
#
if (${WINTC_SKU} MATCHES "^xpclient-(.+)")
if (${CMAKE_MATCH_1} STREQUAL "pro")
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(WINBRAND_BANNER_NAME x64pro)
elseif (
${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ia64" OR
${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv8"
)
set(WINBRAND_BANNER_NAME 64bit)
else()
set(WINBRAND_BANNER_NAME pro)
endif()
else()
set(WINBRAND_BANNER_NAME ${CMAKE_MATCH_1})
endif()
elseif (${WINTC_SKU} MATCHES "^dnsrv-(.+)")
if (
${CMAKE_MATCH_1} STREQUAL "sbs" OR
${CMAKE_MATCH_1} STREQUAL "web" OR
${CMAKE_MATCH_1} STREQUAL "ccs" OR
NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64"
)
set(WINBRAND_BANNER_NAME srv2k3${CMAKE_MATCH_1})
else()
set(WINBRAND_BANNER_NAME x64srv2k3${CMAKE_MATCH_1})
endif()
elseif (${WINTC_SKU} MATCHES "^dnsrv_r2-(.+)")
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(WINBRAND_BANNER_NAME x64srv2k3r2${CMAKE_MATCH_1})
else()
set(WINBRAND_BANNER_NAME srv2k3r2${CMAKE_MATCH_1})
endif()
elseif (${WINTC_SKU} STREQUAL "homesrv")
set(WINBRAND_BANNER_NAME homesrv)
else()
message(
FATAL_ERROR
"No banner defined for SKU: ${WINTC_SKU}"
)
endif()
# Installation
#
wintc_configure_and_install_packaging()
wintc_add_pkgconfig_install()
install(
FILES res/banner-${WINBRAND_BANNER_NAME}.png
DESTINATION ${WINTC_ASSETS_INSTALL_DIR}/brand
RENAME banner.png
)
install(
FILES res/strip-xp.png
DESTINATION ${WINTC_ASSETS_INSTALL_DIR}/brand
RENAME strip.png
)
install(
TARGETS libwintc-winbrand
LIBRARY DESTINATION ${LIB_DIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

View File

@@ -0,0 +1,5 @@
# libwintc-winbrand
This directory contains the source code for the Windows branding library.
## Purpose
This library provides an API for retrieving various branding graphics. The reason for doing this via an API rather than directory is due to the possibility that compiling distro-specific branding may require runtime detection.

View File

@@ -0,0 +1,18 @@
#ifndef __WINTC_WINBRAND_H__
#define __WINTC_WINBRAND_H__
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
//
// Branding banners
//
GdkPixbuf* wintc_brand_get_banner(
GError** error
);
GdkPixbuf* wintc_brand_get_progress_strip(
GError** error
);
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,27 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include "brand.h"
//
// PUBLIC FUNCTIONS
//
GdkPixbuf* wintc_brand_get_banner(
GError** error
)
{
return gdk_pixbuf_new_from_file(
"@CMAKE_INSTALL_PREFIX@/@WINTC_ASSETS_INSTALL_DIR@/brand/banner.png",
error
);
}
GdkPixbuf* wintc_brand_get_progress_strip(
GError** error
)
{
return gdk_pixbuf_new_from_file(
"@CMAKE_INSTALL_PREFIX@/@WINTC_ASSETS_INSTALL_DIR@/brand/strip.png",
error
);
}

View File

@@ -0,0 +1,11 @@
#ifndef __BRAND_H__
#define __BRAND_H__
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
GdkPixbuf* wintc_brand_get_banner(
GError** error
);
#endif

View File

@@ -12,9 +12,11 @@ set(PROJECT_MAINTAINER "Rory Fewell <roryf@oddmatics.uk>")
set(
PROJECT_DEPENDENCIES
libgdk-pixbuf-2.0-0
libglib2.0-0
libgtk-3-0
libwintc-comgtk
libwintc-winbrand
)
set(PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR})
@@ -26,9 +28,11 @@ include(../../packaging/cmake-inc/packaging/CMakeLists.txt)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(WINTC_COMGTK REQUIRED wintc-comgtk)
pkg_check_modules(GDK_PIXBUF REQUIRED gdk-pixbuf-2.0)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(WINTC_COMGTK REQUIRED wintc-comgtk)
pkg_check_modules(WINTC_WINBRAND REQUIRED wintc-winbrand)
add_executable(
wintc-shell-winver
@@ -49,23 +53,29 @@ target_compile_options(
target_include_directories(
wintc-shell-winver
SYSTEM
PRIVATE ${GDK_PIXBUF_INCLUDE_DIRS}
PRIVATE ${GLIB_INCLUDE_DIRS}
PRIVATE ${GTK3_INCLUDE_DIRS}
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
PRIVATE ${WINTC_WINBRAND_INCLUDE_DIRS}
)
target_link_directories(
wintc-shell-winver
PRIVATE ${GDK_PIXBUF_LIBRARY_DIRS}
PRIVATE ${GLIB_LIBRARY_DIRS}
PRIVATE ${GTK3_LIBRARY_DIRS}
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
PRIVATE ${WINTC_WINBRAND_LIBRARY_DIRS}
)
target_link_libraries(
wintc-shell-winver
PRIVATE ${GDK_PIXBUF_LIBRARIES}
PRIVATE ${GLIB_LIBRARIES}
PRIVATE ${GTK3_LIBRARIES}
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
PRIVATE ${WINTC_COMGTK_LIBRARIES}
PRIVATE ${WINTC_WINBRAND_LIBRARIES}
)
# Installation

View File

@@ -1,3 +1,4 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <gtk/gtk.h>
@@ -6,6 +7,7 @@
#include <unistd.h>
#include <pwd.h>
#include <wintc-comgtk.h>
#include <wintc-winbrand.h>
//
// FORWARD DECLARATIONS
@@ -41,6 +43,7 @@ int main(
)
{
GtkWidget* banner;
GtkWidget* banner_strip;
GtkWidget* box;
GtkWidget* box_buttons;
GtkWidget* button_ok;
@@ -76,7 +79,32 @@ int main(
// Create banner
//
banner = gtk_image_new_from_file("/usr/share/wintc/shell-res/banner.png");
GError* banner_error = NULL;
GdkPixbuf* banner_pixbuf = NULL;
GError* strip_error = NULL;
GdkPixbuf* strip_pixbuf = NULL;
banner_pixbuf = wintc_brand_get_banner(&banner_error);
strip_pixbuf = wintc_brand_get_progress_strip(&strip_error);
if (banner_pixbuf != NULL)
{
banner = gtk_image_new_from_pixbuf(banner_pixbuf);
g_object_unref(banner_pixbuf);
}
if (strip_pixbuf != NULL)
{
banner_strip = gtk_image_new_from_pixbuf(strip_pixbuf);
apply_box_model_style(banner_strip, "margin", "bottom", 4);
g_object_unref(strip_pixbuf);
}
wintc_log_error_and_clear(&banner_error);
wintc_log_error_and_clear(&strip_error);
// Get kernel info
//
@@ -118,6 +146,7 @@ int main(
apply_box_model_style(label_product, "margin", "top", 4);
apply_box_model_style(label_eula, "margin", "top", 30);
apply_box_model_style(label_eula_user, "margin", "left", 60);
apply_box_model_style(label_eula_user, "margin", "bottom", 16);
apply_box_model_style(label_memory, "margin", "top", 4);
// Create separator
@@ -125,7 +154,6 @@ int main(
separator = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
apply_box_model_style(separator, "margin", "right", 8);
apply_box_model_style(separator, "margin", "top", 14);
apply_winver_margin_style(separator);
// Create OK button
@@ -146,12 +174,13 @@ int main(
// Build window contents
//
box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
box_buttons = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add(GTK_CONTAINER(window), box);
gtk_box_pack_start(GTK_BOX(box), banner, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(box), banner_strip, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(box), label_product, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(box), label_version, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(box), label_copyright, FALSE, FALSE, 0);
@@ -221,7 +250,9 @@ static void apply_winver_margin_style(
GtkWidget* widget
)
{
apply_box_model_style(widget, "margin", "bottom", 2);
apply_box_model_style(widget, "margin", "left", 52);
apply_box_model_style(widget, "margin", "top", 2);
}
static GtkWidget* create_winver_label(