### Quick Start: Clone, Install Dependencies, and Build Motif Source: https://github.com/dimmus/motif/blob/master/README.md Follow these steps for a quick setup: clone the repository, install dependencies using 'make deps', build the project with 'make build', and finally install it with 'sudo make install'. ```bash git clone https://github.com/dimmus/motif.git cd motif # Check and install dependencies (recommended) make deps # Or manually install dependencies for your OS # (see manual installation commands above) # Build Motif (CMake-based build system) make build # Install to system sudo make install # Uninstall if needed sudo make uninstall ``` -------------------------------- ### Install Guide Directory Source: https://github.com/dimmus/motif/blob/master/doc/CMakeLists.txt Installs the 'guide' directory, including HTML, TXT, and PDF files, to the installation's doc/motif directory. ```cmake if(EXISTS "${CMAKE_SOURCE_DIR}/doc/guide") install(DIRECTORY "${CMAKE_SOURCE_DIR}/doc/guide" DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/motif FILES_MATCHING PATTERN "*.html" PATTERN "*.txt" PATTERN "*.pdf" ) endif() ``` -------------------------------- ### Efficient Development Workflow: Initial Setup and Daily Testing Source: https://github.com/dimmus/motif/blob/master/tools/dev/env/README.md Demonstrates an efficient development workflow starting with initial image builds and transitioning to fast, cached daily testing. ```bash # Day 1: Initial setup ./test-motif.sh --podman archlinux # Build: 10 min ./test-motif.sh --podman ubuntu # Build: 8 min # Day 2-7: Fast daily testing ./test-motif.sh --podman archlinux # Cached: 30 sec ./test-motif.sh --podman --all # Cached: 1 min ``` -------------------------------- ### Complete Build Example: Modern Features and Parallel Build Source: https://github.com/dimmus/motif/blob/master/README.md A comprehensive example demonstrating how to build Motif with modern features, optimized release type, and parallel jobs using 'make'. Includes installation and library cache update. ```bash # Build with all modern features using CMake make full release ninja ccache # Or configure manually with specific features cmake -H. -Bbuild \ -DCMAKE_INSTALL_PREFIX=/usr/local \ -DWITH_UTF8=ON \ -DWITH_DEMOS=ON \ -DWITH_XFT=ON \ -DWITH_JPEG=ON \ -DWITH_PNG=ON \ -DCMAKE_BUILD_TYPE=Release # Build with parallel jobs make build # Install sudo make install # Update library cache sudo ldconfig # Uninstall if needed sudo make uninstall ``` -------------------------------- ### Manual Configuration Example Source: https://github.com/dimmus/motif/blob/master/doc/BUILD.md Example of manually configuring the build system with custom options. ```bash # Configure manually with custom options ./configure --enable-debug --with-xft --with-png --with-jpeg ``` -------------------------------- ### Install Utilities Source: https://github.com/dimmus/motif/blob/master/src/bin/utils/CMakeLists.txt Installs the built utility executables to the binary directory. ```cmake install(TARGETS makestrs mkcatdefs mkmsgcat RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) ``` -------------------------------- ### Install Other Documentation Files Source: https://github.com/dimmus/motif/blob/master/doc/CMakeLists.txt Installs markdown and text files from the doc directory to the installation's doc/motif directory. ```cmake file(GLOB DOC_FILES "${CMAKE_SOURCE_DIR}/doc/*.md" "${CMAKE_SOURCE_DIR}/doc/*.txt" ) if(DOC_FILES) install(FILES ${DOC_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/motif ) endif() ``` -------------------------------- ### Initial Setup Scripts Source: https://github.com/dimmus/motif/blob/master/src/tests/TEST_ENVIRONMENT_README.md Execute these scripts for the initial setup of the test environment. The 'revive_tests.sh' script is for revival, and 'setup_graphical_tests.sh' is for a comprehensive graphical test setup. ```bash # Run the revival script ./revive_tests.sh # Run the comprehensive setup ./setup_graphical_tests.sh ``` -------------------------------- ### Install README File Source: https://github.com/dimmus/motif/blob/master/CMakeLists.txt Installs the 'README.md' file from the project root to the 'doc' subdirectory within the installation's data directory. This makes the project's README file accessible in the installed documentation. ```cmake install(FILES README.md DESTINATION ${CMAKE_INSTALL_DATADIR}/Xm/doc ) ``` -------------------------------- ### Install UIL Executable and Sample File Source: https://github.com/dimmus/motif/blob/master/src/bin/uil/CMakeLists.txt Installs the compiled UIL executable to the binary directory and a sample UIL file to the include directory. ```cmake install(TARGETS uil RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) install(FILES XmAppl.uil DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/uil ) ``` -------------------------------- ### Initial Local Development Setup Source: https://github.com/dimmus/motif/blob/master/tools/dev/env/README.md Perform the initial setup for local development by adding and building container images for specified operating systems. This command builds the images once. ```bash # Initial setup (builds images once) ./add-os.sh archlinux ./add-os.sh ubuntu ./add-os.sh fedora ``` -------------------------------- ### Install man5 Pages Source: https://github.com/dimmus/motif/blob/master/doc/CMakeLists.txt Installs man5 pages from the source directory to the installation's man5 directory. ```cmake file(GLOB MAN5_PAGES "${CMAKE_SOURCE_DIR}/doc/man/man5/*.5") if(MAN5_PAGES) install(FILES ${MAN5_PAGES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man5 ) endif() ``` -------------------------------- ### Install Sudo Source: https://github.com/dimmus/motif/blob/master/tools/dev/README.md Installs sudo if it is not available on the system. ```bash su - # Then install sudo for your distribution ``` -------------------------------- ### Install Xm Library Files Source: https://github.com/dimmus/motif/blob/master/src/lib/Xm/CMakeLists.txt Installs the Xm library, its export targets, and runtime components to their designated installation directories. ```cmake install(TARGETS Xm EXPORT XmTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) ``` -------------------------------- ### Install man1 Pages Source: https://github.com/dimmus/motif/blob/master/doc/CMakeLists.txt Installs man1 pages (executables) from the source directory to the installation's man1 directory. ```cmake file(GLOB MAN1_PAGES "${CMAKE_SOURCE_DIR}/doc/man/man1/*.1") if(MAN1_PAGES) install(FILES ${MAN1_PAGES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) endif() ``` -------------------------------- ### Build Examples Source: https://github.com/dimmus/motif/blob/master/doc/BUILD.md Demonstrates common build scenarios including optimized, portable, development, and clean rebuilds. ```bash # Build optimized version for current machine make release # Build portable version for distribution make release-portable # Build development version for debugging make dev-build # Clean and rebuild everything make distclean make release # Install optimized version make release sudo make install # Build with tests and generate coverage ./configure --enable-tests make check make gcov ``` -------------------------------- ### Generate and Install version.h Source: https://github.com/dimmus/motif/blob/master/src/lib/Xm/CMakeLists.txt Generates the version.h header file from a template and installs it into the Xm include directory. ```cmake configure_file( ${CMAKE_SOURCE_DIR}/src/lib/Xm/version.h.in ${CMAKE_BINARY_DIR}/src/lib/Xm/version.h @ONLY ) install(FILES ${CMAKE_BINARY_DIR}/src/lib/Xm/version.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Xm ) ``` -------------------------------- ### Install Demo Executable Source: https://github.com/dimmus/motif/blob/master/src/examples/programs/CMakeLists.txt Installs the compiled demo executable to a runtime destination within the Xm directory, named after the demo. ```cmake install(TARGETS ${DEMO_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_DATADIR}/Xm/${DEMO_NAME} ) ``` -------------------------------- ### Install Xm Headers Source: https://github.com/dimmus/motif/blob/master/include/CMakeLists.txt Installs header files from the src/lib/Xm directory to the install include directory. ```cmake install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/lib/Xm/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Xm FILES_MATCHING PATTERN "*.h" ) ``` -------------------------------- ### Custom OS Configuration Example Source: https://github.com/dimmus/motif/blob/master/tools/dev/env/README.md Example configuration for a custom OS in `os-config.yaml`. This demonstrates how to define base image, package manager, commands, packages, and environment variables for a new OS. ```yaml myos: base_image: "myos:latest" description: "My Custom OS" package_manager: "mypm" commands: update: "mypm update" install: "mypm install" cleanup: "mypm clean" packages: base_tools: - build-essential - git # ... more packages environment: compiler: "gcc" cflags: "-O2 -g" # ... more environment variables ``` -------------------------------- ### Motif Environment Variables Setup Source: https://github.com/dimmus/motif/blob/master/src/tests/TEST_ENVIRONMENT_README.md Set these environment variables to configure the Motif development and library paths. Ensure X11 and Motif development libraries are installed. ```bash export MOTIF_HOME="/path/to/motif" export LIBRARY_PATH="/usr/X11R6/lib:$MOTIF_HOME/lib/Xm/.libs: sooner" export LD_LIBRARY_PATH="/usr/X11R6/lib:$MOTIF_HOME/lib/Xm/.libs: sooner" export C_INCLUDE_PATH="$MOTIF_HOME/include:$MOTIF_HOME/lib: sooner" export C_PATH="$MOTIF_HOME/lib: sooner" ``` -------------------------------- ### Install Buildx Plugin Source: https://github.com/dimmus/motif/blob/master/tools/dev/env/README.md Installs the buildx component for Docker to avoid the 'legacy builder deprecated' warning. ```bash # Option 1: Install buildx (Ubuntu/Debian) sudo apt install docker-buildx-plugin # Option 2: Install buildx (Arch Linux) sudo pacman -S docker-buildx ``` -------------------------------- ### Manual Installation on Void Linux Source: https://github.com/dimmus/motif/blob/master/tools/dev/README.md Installs Motif dependencies on Void Linux systems using xbps. ```bash sudo xbps-install base-devel autoconf automake gettext pkg-config flex bison \ libX11-devel libXt-devel libXmu-devel libXext-devel \ libXpm-devel libXft-devel libjpeg-turbo-devel libpng-devel check-devel ``` -------------------------------- ### Install UIL and UID Files Source: https://github.com/dimmus/motif/blob/master/src/examples/programs/CMakeLists.txt Installs the original UIL files and their compiled UID counterparts to the demo's destination directory. This ensures that runtime resources are available. ```cmake if(UIL_FILES) install(FILES ${UIL_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/Xm/${DEMO_NAME} ) foreach(UIL_FILE ${UIL_FILES}) get_filename_component(UIL_NAME ${UIL_FILE} NAME_WE) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DEMO_DIR}/${UIL_NAME}.uid DESTINATION ${CMAKE_INSTALL_DATADIR}/Xm/${DEMO_NAME} ) endforeach() endif() ``` -------------------------------- ### Install man4 Pages Source: https://github.com/dimmus/motif/blob/master/doc/CMakeLists.txt Installs man4 pages from the source directory to the installation's man4 directory. ```cmake file(GLOB MAN4_PAGES "${CMAKE_SOURCE_DIR}/doc/man/man4/*.4") if(MAN4_PAGES) install(FILES ${MAN4_PAGES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man4 ) endif() ``` -------------------------------- ### Install Dt Headers Source: https://github.com/dimmus/motif/blob/master/include/CMakeLists.txt Installs header files from the Dt directory to the install include directory. ```cmake install(DIRECTORY Dt/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Dt FILES_MATCHING PATTERN "*.h" ) ``` -------------------------------- ### Install man3 Pages Source: https://github.com/dimmus/motif/blob/master/doc/CMakeLists.txt Installs man3 pages (library functions) from the source directory to the installation's man3 directory. ```cmake file(GLOB MAN3_PAGES "${CMAKE_SOURCE_DIR}/doc/man/man3/*.3") if(MAN3_PAGES) install(FILES ${MAN3_PAGES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 ) endif() ``` -------------------------------- ### Quick Start Commands Source: https://github.com/dimmus/motif/blob/master/tools/dev/README.md Navigate to the environment directory and run test commands for specific or all available OS environments. You can also list available environments or add new ones. ```bash # Navigate to the environment directory cd tools/dev/env # Test on Arch Linux ./test-motif.sh archlinux # Test on all available OS ./test-motif.sh --all # List available OS environments ./test-motif.sh --list # Add new OS environment ./add-os.sh ubuntu # Use Makefile targets make test # Test on default OS make test-all # Test on all OS make add-os OS=fedora # Add Fedora support ``` -------------------------------- ### Manual Installation on FreeBSD Source: https://github.com/dimmus/motif/blob/master/tools/dev/README.md Installs Motif dependencies on FreeBSD systems using pkg. ```bash sudo pkg install gcc autoconf automake gettext pkgconf gmake flex bison \ libX11 libXt libXmu libXext libXpm libXft jpeg libpng libXp check ``` -------------------------------- ### Install pkg-config File Source: https://github.com/dimmus/motif/blob/master/CMakeLists.txt Installs the generated 'motif.pc' file from the binary directory to the 'pkgconfig' subdirectory within the installation's library directory. This makes the library information available to other projects using pkg-config. ```cmake install(FILES ${CMAKE_BINARY_DIR}/motif.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ) ``` -------------------------------- ### Manual Installation on Ubuntu/Debian Source: https://github.com/dimmus/motif/blob/master/tools/dev/README.md Installs Motif dependencies on Ubuntu/Debian systems using apt-get. ```bash sudo apt-get update sudo apt-get install build-essential autoconf automake autopoint pkg-config \ flex bison libx11-dev libxt-dev libxmu-dev libxext-dev \ libxpm-dev libxft-dev libjpeg-dev libpng-dev libxp-dev check ``` -------------------------------- ### Install Wsm Library Source: https://github.com/dimmus/motif/blob/master/src/lib/Wsm/CMakeLists.txt Installs the Wsm library to the appropriate system library directory. ```cmake install(TARGETS Wsm LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) ``` -------------------------------- ### Install xmbind Executable Source: https://github.com/dimmus/motif/blob/master/src/bin/xmbind/CMakeLists.txt Installs the xmbind executable to the runtime destination directory. ```cmake install(TARGETS xmbind RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) ``` -------------------------------- ### Test Hello World Internationalization Demo Source: https://github.com/dimmus/motif/blob/master/doc/LOCALIZATION.md Navigate to the 'hellomotifi18n' example directory and run the 'helloint' program with different locale settings to test basic internationalization. ```bash # Navigate to the example directory cd examples/programs/hellomotifi18n # Test different languages # English (default) ./helloint # French LANG=fr_FR.ISO8859-1 XAPPLRESDIR=./french ./helloint # Hebrew LANG=hebrew XAPPLRESDIR=./hebrew ./helloint # Japanese LANG=ja_JP.eucJP XAPPLRESDIR=./japanese ./helloint # Swedish LANG=sv_SE.ISO8859-1 XAPPLRESDIR=./swedish ./helloint ``` -------------------------------- ### Install Podman on Different Distributions Source: https://github.com/dimmus/motif/blob/master/tools/dev/env/README.md Installs Podman, a recommended alternative to Docker, on Ubuntu/Debian, Arch Linux, or Fedora/CentOS. ```bash # Install podman if not available sudo apt install podman # Ubuntu/Debian sudo pacman -S podman # Arch Linux sudo dnf install podman # Fedora/CentOS ``` -------------------------------- ### Example Output of Dependency Checker Source: https://github.com/dimmus/motif/blob/master/tools/dev/README.md This output demonstrates a successful run of the dependency checker script, showing OS detection, package status, and next build steps. ```text ========================================== Motif Dependency Checker & Installer ========================================== [INFO] Detecting operating system... [SUCCESS] Detected: ubuntu 24.04 [INFO] Package manager: apt [INFO] Starting dependency check... [INFO] Checking project dependencies... [SUCCESS] ✓ autoconf (autoconf) - installed [SUCCESS] ✓ pkg-config (pkg-config) - installed [WARNING] ✗ libXp (libxp-dev) - not available (optional, not in repositories) [INFO] Dependency check complete: 17/18 packages installed [SUCCESS] All dependencies are installed! [INFO] You can now build Motif with: ./autogen.sh ./configure make ``` -------------------------------- ### Manual Installation on Alpine Linux Source: https://github.com/dimmus/motif/blob/master/tools/dev/README.md Installs Motif dependencies on Alpine Linux systems using apk. ```bash sudo apk add build-base autoconf automake gettext pkgconf flex bison \ libx11-dev libxt-dev libxmu-dev libxext-dev \ libxpm-dev libxft-dev libjpeg-turbo-dev libpng-dev check-dev ``` -------------------------------- ### Motif Build System: Core Build Targets Source: https://github.com/dimmus/motif/blob/master/README.md Lists the primary 'make' commands for building, installing, and uninstalling Motif. 'make build' configures and builds without installation, while 'make all' builds and installs. ```bash # Core build targets make build # Configure and build Motif (no installation) make all # Build and install Motif (legacy behavior) make install # Install to system (requires sudo) make uninstall # Uninstall from system (requires sudo) ``` -------------------------------- ### CI/CD Integration Example Source: https://github.com/dimmus/motif/blob/master/tools/dev/README.md Shows how to integrate the Motif development environment into CI/CD pipelines by running tests and checking the exit code. ```bash # Test all supported platforms ./tools/dev/env/test-motif.sh --all --clean # Check exit code for CI if [ $? -eq 0 ]; then echo "All tests passed" else echo "Some tests failed" exit 1 fi ``` -------------------------------- ### Install WsmDemo Library Source: https://github.com/dimmus/motif/blob/master/src/examples/lib/Wsm/CMakeLists.txt Installs the built WsmDemo static library to the system's library directory. This is typically done for development or distribution. ```cmake install(TARGETS WsmDemo ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) ``` -------------------------------- ### Manual Installation on Arch Linux Source: https://github.com/dimmus/motif/blob/master/tools/dev/README.md Installs Motif dependencies on Arch Linux systems using pacman. ```bash sudo pacman -Sy base-devel autoconf automake gettext pkgconf flex bison \ libx11 libxt libxmu libxext libxpm libxft libjpeg-turbo libpng libxp check ``` -------------------------------- ### Clone and Build Motif Source: https://github.com/dimmus/motif/blob/master/README.md Clone the repository and set up a development build. Use 'make developer' for a quick setup or 'cmake' for manual configuration. ```bash git clone https://github.com/dimmus/motif.git cd motif # Development build with all features make developer debug full ninja ccache # Or configure manually for development cmake -H. -Bbuild \ -DCMAKE_BUILD_TYPE=Debug \ -DWITH_DEMOS=ON \ -DWITH_TESTS=ON \ -DWITH_UTF8=ON \ -DWITH_XFT=ON # Build make build # Run tests make test # Generate code coverage reports make gcov ``` -------------------------------- ### ClassPartInitialize for XmSpinBoxWidgetClass Source: https://github.com/dimmus/motif/blob/master/doc/guide/06-actual-implementations-deep-dive.md Sets up the class part for XmSpinBoxWidgetClass by initializing fast subclassing, installing the navigator trait, and setting up a string to position value type converter. ```c static void ClassPartInitialize(WidgetClass classPart) { XmSpinBoxWidgetClass spinC; spinC = (XmSpinBoxWidgetClass) classPart; _XmFastSubclassInit(classPart, XmSPINBOX_BIT); /* Install the navigator trait for all subclasses */ XmeTraitSet((XtPointer)spinC, XmQTnavigator, (XtPointer) &spinBoxNT); XtSetTypeConverter( XmRString, XmRPositionValue, CvtStringToPositionValue, selfConvertArgs, XtNumber(selfConvertArgs), XtCacheNone, (XtDestructor) NULL) ; } ``` -------------------------------- ### Localization File Structure Example Source: https://github.com/dimmus/motif/blob/master/doc/LOCALIZATION.md Illustrates the directory organization for localization files across different languages and application types. ```text examples/programs/hellomotifi18n/ ├── C/ # Default locale (English) ├── english/ # English localization ├── french/ # French localization ├── hebrew/ # Hebrew localization ├── japanese/ # Japanese localization └── swedish/ # Swedish localization examples/programs/fileview/ ├── English.uil # English UIL file ├── French.uil # French UIL file ├── German.uil # German UIL file └── xmfile # Localization test script localized/ ├── C/ # Default locale resources ├── fr_FR.ISO8859-1/ # French resources ├── de_DE.ISO8859-1/ # German resources └── ja_JP.dt-eucJP/ # Japanese resources ``` -------------------------------- ### Widget Initialization Phases Source: https://github.com/dimmus/motif/blob/master/doc/guide/03-widget-system-architecture.md Illustrates the sequence of steps involved in initializing Motif widgets, from resource definition to event binding and drawing setup. ```c // Resource initialization // Class part initialization // Instance part initialization // Constraint initialization (for manager widgets) // Child widget initialization // Geometry management setup // Event binding // Drawing initialization ``` -------------------------------- ### Install Wsm Headers Source: https://github.com/dimmus/motif/blob/master/src/lib/Wsm/CMakeLists.txt Installs the Wsm header files into the system include directory under a 'wsm' subdirectory. ```cmake install(FILES wsm_funcs.h wsm_proto.h utm_send.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/wsm ) ``` -------------------------------- ### Test File Viewer Localization Source: https://github.com/dimmus/motif/blob/master/doc/LOCALIZATION.md Navigate to the 'fileview' example directory and use the provided scripts to launch the file viewer with different language interfaces. ```bash cd examples/programs/fileview # Use the provided script for different languages ./xmfile french # French interface ./xmfile english # English interface ./xmfile german # German interface ``` -------------------------------- ### Install Other Data Files Source: https://github.com/dimmus/motif/blob/master/src/examples/programs/CMakeLists.txt Installs additional data files such as READMEs, .txt, and .md files to the demo's destination directory. This makes documentation and other text-based resources available with the demo. ```cmake file(GLOB DATA_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${DEMO_DIR}/README*" "${CMAKE_CURRENT_SOURCE_DIR}/${DEMO_DIR}/*.txt" "${CMAKE_CURRENT_SOURCE_DIR}/${DEMO_DIR}/*.md" ) if(DATA_FILES) install(FILES ${DATA_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/Xm/${DEMO_NAME} ) endif() ``` -------------------------------- ### Motif Installation Paths Configuration with CMake Source: https://github.com/dimmus/motif/blob/master/README.md Shows how to configure installation paths for Motif using CMake. Key variables include CMAKE_INSTALL_PREFIX, CMAKE_INSTALL_SYSCONFDIR, and CMAKE_INSTALL_LIBDIR. ```bash # Configure installation paths cmake -H. -Bbuild \ -DCMAKE_INSTALL_PREFIX=/usr/local # Installation prefix -DCMAKE_INSTALL_SYSCONFDIR=/etc # Configuration files -DCMAKE_INSTALL_LIBDIR=lib64 # Library directory ``` -------------------------------- ### Check Dependencies with Make Source: https://github.com/dimmus/motif/blob/master/README.md Use this command to verify that all required dependencies are installed before building. It's a quick way to identify missing packages. ```bash # Check dependencies make deps ``` -------------------------------- ### Manual Installation on RHEL/CentOS/Fedora Source: https://github.com/dimmus/motif/blob/master/tools/dev/README.md Installs Motif dependencies on RHEL, CentOS, or Fedora systems using dnf. ```bash sudo dnf install gcc autoconf automake gettext pkgconfig flex bison \ libX11-devel libXt-devel libXmu-devel libXext-devel \ libXpm-devel libXft-devel libjpeg-devel libpng-devel libXp-devel check-devel ``` -------------------------------- ### Ubuntu/Debian Dependency Installation Source: https://github.com/dimmus/motif/blob/master/README.md Command to install all essential build and runtime dependencies on Ubuntu, Debian, and similar distributions using apt-get. ```bash sudo apt-get update sudo apt-get install build-essential cmake pkg-config flex bison \ libx11-dev libxt-dev libxmu-dev libxext-dev \ libxpm-dev libxft-dev libjpeg-dev libpng-dev \ ninja-build ccache ``` -------------------------------- ### Install Xm Headers Source: https://github.com/dimmus/motif/blob/master/src/lib/Xm/CMakeLists.txt Installs the public headers for the Xm library, including extra and slide headers, into the include directory. ```cmake install(FILES ${XM_HEADERS} ${XM_EXTRA_HEADERS} ${XM_SLIDE_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Xm ) ``` -------------------------------- ### Conditional Example Building in CMake Source: https://github.com/dimmus/motif/blob/master/src/examples/CMakeLists.txt This snippet demonstrates how to conditionally build example subdirectories in CMake based on the WITH_DEMOS variable. It also shows how to check for the existence of optional subdirectories before adding them. ```cmake if(WITH_DEMOS) message(STATUS "Building Motif examples") # Add example subdirectories add_subdirectory(lib) add_subdirectory(programs) # Optional: add unsupported examples if(EXISTS "${CMAKE_SOURCE_DIR}/src/examples/unsupported/CMakeLists.txt") add_subdirectory(unsupported) endif() # Optional: add example documentation if(EXISTS "${CMAKE_SOURCE_DIR}/src/examples/doc/CMakeLists.txt") add_subdirectory(doc) endif() else() message(STATUS "Examples disabled - use -DWITH_DEMOS=ON to build examples") endif() ``` -------------------------------- ### Install Bitmap Files Source: https://github.com/dimmus/motif/blob/master/data/bitmaps/CMakeLists.txt Installs a predefined list of bitmap files to the specified destination directory. Ensure the destination path is correctly configured in your CMake project. ```cmake install(FILES xm_error xm_hour16 xm_hour16m xm_hour32 xm_hour32m xm_information xm_noenter16 xm_noenter16m xm_noenter32 xm_noenter32m xm_question xm_warning xm_working DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/X11/bitmaps ) ``` -------------------------------- ### Conditionally Add Example Subdirectory Source: https://github.com/dimmus/motif/blob/master/CMakeLists.txt Adds the 'src/examples' subdirectory to the build if the 'WITH_DEMOS' CMake variable is set to true. This allows for the selective inclusion of example code during the build configuration. ```cmake if(WITH_DEMOS) add_subdirectory(src/examples) endif() ``` -------------------------------- ### Install Wsm Headers Source: https://github.com/dimmus/motif/blob/master/src/examples/lib/Wsm/CMakeLists.txt Installs the header files for the Wsm library into the system's include directory, under a 'Wsm' subdirectory. This makes the library's API accessible to other projects. ```cmake install(FILES ${WSM_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Wsm ) ``` -------------------------------- ### Motif Build Workflow Examples Source: https://github.com/dimmus/motif/blob/master/tools/dev/env/README-speed-optimization.md Demonstrates the command-line workflow for building Motif artifacts using Podman, including initial builds, incremental builds, skipping tests, and final optimized builds. ```bash # First build (slower, but creates artifacts) ./tools/dev/env/test-motif.sh --podman archlinux --jobs 8 ``` ```bash # Subsequent builds (much faster) ./tools/dev/env/test-motif.sh --podman archlinux --incremental --jobs 8 ``` ```bash # When making changes ./tools/dev/env/test-motif.sh --podman archlinux --incremental --jobs 8 --no-tests ``` ```bash # Final build with tests ./tools/dev/env/test-motif.sh --podman archlinux --jobs 8 --optimize ``` -------------------------------- ### Usage Examples for Test Runner Source: https://github.com/dimmus/motif/blob/master/tools/dev/README.md Demonstrates various ways to use the `test-motif.sh` script, including basic testing, verbose mode, cleanup, using Podman, debugging, and viewing logs. ```bash # Basic testing ./test-motif.sh archlinux # Verbose testing with container rebuild ./test-motif.sh -v -r archlinux # Test all OS with cleanup ./test-motif.sh --all --clean # Use Podman instead of Docker ./test-motif.sh --podman archlinux # Keep container running for debugging ./test-motif.sh -k archlinux # Generate new OS environment ./add-os.sh ubuntu # Preview OS generation ./add-os.sh --dry-run fedora # View previous test logs ./test-motif.sh --logs-only ``` -------------------------------- ### ClassPartInitialize for Simple Primitive Widget Source: https://github.com/dimmus/motif/blob/master/doc/guide/06-actual-implementations-deep-dive.md Demonstrates `ClassPartInitialize` for a simple primitive widget, including fast subclassing, trait installation, and setting a basic type converter. ```c static void ClassPartInitialize(WidgetClass classPart) { XmMyWidgetClass myClass = (XmMyWidgetClass) classPart; // Basic fast subclassing _XmFastSubclassInit(classPart, XmPRIMITIVE_BIT); // Install basic traits XmeTraitSet((XtPointer)myClass, XmQTaccessColors, (XtPointer) &myColorTrait); // Set up type converter XtSetTypeConverter(XmRString, XmRInt, CvtStringToInt, NULL, 0, XtCacheNone, (XtDestructor) NULL); } ``` -------------------------------- ### Install MWM Executable Source: https://github.com/dimmus/motif/blob/master/src/bin/mwm/CMakeLists.txt Installs the 'mwm' executable to the runtime directory. This makes the Motif Window Manager available after installation. ```cmake install(TARGETS mwm RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) ``` -------------------------------- ### Create and Configure Basic SpinBox Source: https://github.com/dimmus/motif/blob/master/doc/guide/04-practical-widget-implementations.md Demonstrates how to create a basic SpinBox widget and set its minimum, maximum, and initial value resources. ```c Widget spinBox = XmCreateSpinBox(parent, "spinBox", NULL, 0); XtManageChild(spinBox); // Configure resources Arg args[10]; int n = 0; XtSetArg(args[n], XmNminimum, 0); n++; XtSetArg(args[n], XmNmaximum, 100); n++; XtSetArg(args[n], XmNvalue, 50); n++; XtSetValues(spinBox, args, n); ``` -------------------------------- ### Running Motif Demo Programs Source: https://github.com/dimmus/motif/blob/master/README.md Lists commands to execute various demonstration programs included with the Motif distribution after building with the --enable-examples option. ```bash # After building with --enable-examples cd examples/programs ``` ```bash # Classic examples ./hellomotif/hellomotif # Basic Motif application ./draw/draw # Drawing application ./animate/animate # Animation demo ./filemanager/filemanager # File manager ./periodic/periodic # Periodic table ``` ```bash # Advanced widget examples ./Notebook/notebook # Notebook widget ./Container/container # Container widget ./Tree/tree # Tree widget ./ComboBox/combo # Combo box widget ``` -------------------------------- ### Standard Build Commands Source: https://github.com/dimmus/motif/blob/master/doc/BUILD.md Common commands for building, cleaning, and managing the project. Use 'make help' to see all available targets. ```bash # Standard build make # Help - show all available targets make help # Optimized release build make release # Development build with debug symbols make dev-build ``` -------------------------------- ### Build Container Image with Podman Source: https://github.com/dimmus/motif/blob/master/tools/dev/env/README.md Use this command for the initial build of a container image. This process can take 5-15 minutes. ```bash # First run - builds image (5-15 minutes) ./test-motif.sh --podman archlinux ``` -------------------------------- ### List Available OS Templates Source: https://github.com/dimmus/motif/blob/master/tools/dev/env/README.md List all available operating system templates that can be used with the `add-os.sh` script. This helps in choosing the correct template for new OS additions. ```bash ./add-os.sh --list ``` -------------------------------- ### Install Internal Xm Headers Source: https://github.com/dimmus/motif/blob/master/src/lib/Xm/CMakeLists.txt Installs internal headers for development purposes into the Xm include directory. ```cmake install(FILES ${XM_INTERNAL_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Xm ) ``` -------------------------------- ### Motif Logging Initialization and Usage Example Source: https://github.com/dimmus/motif/blob/master/doc/LOGGING_CONFIGURATION.md Demonstrates how to initialize the Motif logging system, register a custom domain, log messages at different levels, and change the output destination to a file. Ensure Log.h is included and XmLogInit() is called before other logging functions. ```c #include "Log.h" int main() { // Initialize logging XmLogInit(); // Register a custom domain int my_domain = XmLogDomainRegister("MyApp", LOG_COLOR_GREEN); // Log messages XmLogPrint(my_domain, XM_LOG_INFO, __FILE__, __FUNCTION__, __LINE__, "Application started"); // Change output to file XmLogSetOutput("file", "myapp.log"); XmLogPrint(my_domain, XM_LOG_WARN, __FILE__, __FUNCTION__, __LINE__, "This will be written to myapp.log"); return 0; } ``` -------------------------------- ### Install Xmd Headers Source: https://github.com/dimmus/motif/blob/master/src/examples/lib/Xmd/CMakeLists.txt Installs the header files for the Xmd library into the include directory, under an 'Xmd' subdirectory. ```cmake install(FILES ${XMD_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Xmd ) ``` -------------------------------- ### Install Xmd Library Source: https://github.com/dimmus/motif/blob/master/src/examples/lib/Xmd/CMakeLists.txt Installs the compiled Xmd static library to the appropriate directory for development purposes. ```cmake install(TARGETS Xmd ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) ``` -------------------------------- ### Initialize Fast Subclassing for Motif Widgets Source: https://github.com/dimmus/motif/blob/master/doc/guide/06-actual-implementations-deep-dive.md Demonstrates how to use the `_XmFastSubclassInit` function to initialize fast subclassing for various Motif widgets. This function is crucial for performance optimizations. ```c // For a Form widget _XmFastSubclassInit(classPart, XmFORM_BIT); // For a List widget _XmFastSubclassInit(classPart, XmLIST_BIT); // For a PushButton widget _XmFastSubclassInit(classPart, XmPUSH_BUTTON_BIT); // For a Label gadget _XmFastSubclassInit(classPart, XmLABEL_GADGET_BIT); // For a custom manager widget _XmFastSubclassInit(classPart, XmMANAGER_BIT); ``` -------------------------------- ### Creating an XmString with Left-to-Right Direction Source: https://github.com/dimmus/motif/blob/master/src/tests/XmString/test_report.md Example of creating an XmString with specific components, including layout push, rendition begin/end tags, direction, and locale text. The text 'Hello World' is used. ```text XmSTRING_COMPONENT_LAYOUT_PUSH ( XmLEFT_TO_RIGHT ) XmSTRING_COMPONENT_RENDITION_BEGIN ( "render_tag2" ) XmSTRING_COMPONENT_RENDITION_BEGIN ( "render_tag1" ) XmSTRING_COMPONENT_TAB XmSTRING_COMPONENT_DIRECTION ( XmSTRING_DIRECTION_R_TO_L ) XmSTRING_COMPONENT_LOCALE_TEXT ( "Hello World" ) XmSTRING_COMPONENT_DIRECTION ( XmSTRING_DIRECTION_L_TO_R ) XmSTRING_COMPONENT_RENDITION_END ( "render_tag2" ) XmSTRING_COMPONENT_LAYOUT_POP XmSTRING_COMPONENT_SEPARATOR XmSTRING_COMPONENT_RENDITION_END ( "render_tag1" ) ``` -------------------------------- ### Manage Docker Service Source: https://github.com/dimmus/motif/blob/master/tools/dev/env/README.md Checks the status of the Docker service and starts it if it is not running. Also enables it to start on boot. ```bash # Check if Docker service is running sudo systemctl status docker # Start Docker service if needed sudo systemctl start docker sudo systemctl enable docker ``` -------------------------------- ### Display Test Help Options Source: https://github.com/dimmus/motif/blob/master/tools/dev/env/README.md Show all available command-line options and usage instructions for the motif testing script. ```bash ./test-motif.sh --help ``` -------------------------------- ### Install Navigator Trait Source: https://github.com/dimmus/motif/blob/master/doc/guide/06-actual-implementations-deep-dive.md Installs the navigator trait for keyboard navigation support on a widget class. This enables keyboard traversal and focus management. ```c static XmConst XmNavigatorTraitRec myNavigatorTrait = { 0, // version MyChangeMoveCB, // change move callback MySetValue, // set value function MyGetValue, // get value function }; // Install on any widget that needs navigation XmeTraitSet((XtPointer)widgetClass, XmQTnavigator, (XtPointer) &myNavigatorTrait); ``` -------------------------------- ### RHEL/CentOS/Fedora Dependency Installation Source: https://github.com/dimmus/motif/blob/master/README.md Command to install necessary build and runtime dependencies on RHEL, CentOS, Fedora, and related systems using yum/dnf. ```bash sudo yum install gcc cmake pkgconfig flex bison ninja-build ccache \ libX11-devel libXt-devel libXmu-devel libXext-devel \ libXpm-devel libXft-devel libjpeg-devel libpng-devel ``` -------------------------------- ### Basic Motif Application Structure Source: https://github.com/dimmus/motif/blob/master/README.md Illustrates the core components and initialization process for a simple Motif application using C. ```c #include #include #include #include int main(int argc, char *argv[]) { XtAppContext app_context; Widget toplevel, main_window, form, button; // Initialize toolkit toplevel = XtVaAppInitialize(&app_context, "MyApp", NULL, 0, &argc, argv, NULL, NULL); // Create main window main_window = XmCreateMainWindow(toplevel, "main", NULL, 0); XtManageChild(main_window); // Create form container form = XmCreateForm(main_window, "form", NULL, 0); XtManageChild(form); // Create push button button = XmCreatePushButton(form, "Hello World", NULL, 0); XtManageChild(button); // Realize and run XtRealizeWidget(toplevel); XtAppMainLoop(app_context); return 0; } ``` -------------------------------- ### Initialize XM Logging System Source: https://github.com/dimmus/motif/blob/master/doc/LOGGING_CONFIGURATION.md Initialize the logging system at the beginning of your C application. Ensure 'Log.h' is included and check the return value for initialization success. ```c #include "Log.h" int main() { // Initialize logging system with build-time defaults if (!XmLogInit()) { fprintf(stderr, "Failed to initialize logging system\n"); return 1; } // Your application code here return 0; } ``` -------------------------------- ### Install system.mwmrc Configuration File Source: https://github.com/dimmus/motif/blob/master/src/bin/mwm/CMakeLists.txt Installs the system-wide Motif Window Manager configuration file. This file is typically located in the X11 configuration directory. ```cmake install(FILES system.mwmrc DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/X11 ) ``` -------------------------------- ### Install Activatable Trait Source: https://github.com/dimmus/motif/blob/master/doc/guide/06-actual-implementations-deep-dive.md Installs the activatable trait for button-like widgets. This trait provides functions for arming, disarming, activating, and managing the active state of a widget. ```c static XmConst XmActivatableTraitRec myActivatableTrait = { 0, // version MyArm, // arm function MyDisarm, // disarm function MyActivate, // activate function MySetActive, // set active function MyGetActive, // get active function }; // Install on buttons, toggles, etc. XmeTraitSet((XtPointer)widgetClass, XmQTactivatable, (XtPointer) &myActivatableTrait); ``` -------------------------------- ### Manual Test Execution with Virtual Display Source: https://github.com/dimmus/motif/blob/master/src/tests/TEST_ENVIRONMENT_README.md Run a specific XmString test executable, such as 'StringExt', using 'xvfb-run' for a virtual display. This is the recommended method for manual execution. ```bash cd tests/XmString # Run with virtual display (recommended) echo -e "\n\n\n\n\n" | xvfb-run -a ./StringExt ``` -------------------------------- ### Install Additional Locales on Red Hat/Fedora Source: https://github.com/dimmus/motif/blob/master/doc/LOCALIZATION.md Commands to define and install a new locale on Red Hat or Fedora-based systems. Use this when the target locale is missing. ```bash sudo localedef -i fr_FR -f ISO8859-1 fr_FR.ISO8859-1 ``` -------------------------------- ### Quick Local Test on Primary Platform Source: https://github.com/dimmus/motif/blob/master/tools/dev/env/README.md Run a quick test on the primary platform using cached images for faster iteration during local development. ```bash # Quick test on primary platform (uses cache) ./test-motif.sh archlinux ``` -------------------------------- ### Install Menu Savvy Trait Source: https://github.com/dimmus/motif/blob/master/doc/guide/06-actual-implementations-deep-dive.md Installs the menu savvy trait for widgets that interact with menus. This trait provides functions for posting, popping down, and retrieving menu widgets. ```c static XmConst XmMenuSavvyTraitRec myMenuSavvyTrait = { 0, // version MyMenuPost, // menu post function MyMenuPopdown, // menu popdown function MyGetMenuWidget, // get menu widget function }; // Install on widgets that work with menus XmeTraitSet((XtPointer)widgetClass, XmQTmenuSavvy, (XtPointer) &myMenuSavvyTrait); ``` -------------------------------- ### Install Project to User Directory Source: https://github.com/dimmus/motif/blob/master/README.md Configures the build to install Motif to a user-specific directory (`~/.local`) instead of system-wide. This is useful for avoiding permission issues or for local development. ```bash cmake -H. -Bbuild -DCMAKE_INSTALL_PREFIX=$HOME/.local make build make install ``` -------------------------------- ### Preview OS Dockerfile Generation (Dry Run) Source: https://github.com/dimmus/motif/blob/master/tools/dev/env/README.md Perform a dry run of the `add-os.sh` script for Fedora to preview the Dockerfile that would be generated without actually creating it. Useful for verifying configurations. ```bash ./add-os.sh --dry-run fedora ``` -------------------------------- ### Install Additional Fonts Source: https://github.com/dimmus/motif/blob/master/doc/LOCALIZATION.md Installs common fonts like DejaVu and Liberation, which often provide support for a wide range of characters. This can resolve font rendering issues. ```bash sudo apt-get install fonts-dejavu fonts-liberation ``` -------------------------------- ### Install Navigator Trait and Type Converter Source: https://github.com/dimmus/motif/blob/master/doc/guide/06-actual-implementations-deep-dive.md Installs the navigator trait for subclasses and sets a type converter for resource handling. This enables extensible behavior and proper resource management. ```c static XmConst XmNavigatorTraitRec spinBoxNT = { 0, SpinNChangeMoveCB, SpinNSetValue, SpinNGetValue, }; static void ClassPartInitialize(WidgetClass classPart) { XmSpinBoxWidgetClass spinC; spinC = (XmSpinBoxWidgetClass) classPart; _XmFastSubclassInit(classPart, XmSPINBOX_BIT); /* Install the navigator trait for all subclasses */ XmeTraitSet((XtPointer)spinC, XmQTnavigator, (XtPointer) &spinBoxNT); XtSetTypeConverter( XmRString, XmRPositionValue, CvtStringToPositionValue, selfConvertArgs, XtNumber(selfConvertArgs), XtCacheNone, (XtDestructor) NULL) ; } ``` -------------------------------- ### Coverage Workflow Source: https://github.com/dimmus/motif/blob/master/doc/BUILD.md Steps to enable tests, build, run tests, generate coverage reports, and clean up coverage files. ```bash # 1. Configure with tests enabled ./configure --enable-tests # 2. Build and run tests make check # 3. Generate coverage reports make gcov # 4. View coverage files (*.gcov) ls *.gcov # 5. Clean up when done make clean-gcov ``` -------------------------------- ### Install Scrollable Trait Source: https://github.com/dimmus/motif/blob/master/doc/guide/06-actual-implementations-deep-dive.md Installs the scrollable trait for widgets containing scrollable content. This trait provides functions to manage scrolling behavior, including size, margins, and position. ```c static XmConst XmScrollableTraitRec myScrollableTrait = { 0, // version MyGetScrollableSize, // get scrollable size MyGetScrollableMargins, // get scrollable margins MyScrollTo, // scroll to position MyGetScrollablePreferredSize, // get preferred size }; // Install on widgets with scrollable content XmeTraitSet((XtPointer)widgetClass, XmQTscrollable, (XtPointer) &myScrollableTrait); ``` -------------------------------- ### Monitor Build Performance Source: https://github.com/dimmus/motif/blob/master/tools/dev/env/README-speed-optimization.md Measure build duration and observe resource utilization to identify performance bottlenecks. Use 'time' for timing and 'htop' for real-time CPU/memory monitoring. ```bash # Time the build time ./tools/dev/env/test-motif.sh --podman archlinux --incremental # Check resource usage ./tools/dev/env/test-motif.sh --podman archlinux --jobs 8 & htop # Monitor CPU and memory usage ``` -------------------------------- ### Configure unit tests for guardedalloc Source: https://github.com/dimmus/motif/blob/master/src/internal/guardedalloc/CMakeLists.txt Sets up source files, include directories, and libraries for running guardedalloc unit tests. ```cmake if(WITH_GTESTS) set(TEST_SRC tests/guardedalloc_alignment_test.cc tests/guardedalloc_overflow_test.cc tests/guardedalloc_test_base.h ) set(TEST_INC ../../source/blender/blenlib ) set(TEST_LIB bf_intern_guardedalloc bf_blenlib ) motif_add_test_suite_executable(guardedalloc "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() ``` -------------------------------- ### Automatic Dependency Checking and Installation Source: https://github.com/dimmus/motif/blob/master/README.md Triggers the project's built-in script to automatically check for and install missing dependencies. This is a convenient way to ensure all requirements are met across supported operating systems. ```bash # Automatic dependency checking and installation make deps # Or run the script directly ./tools/dev/scripts/deps_check.sh ``` -------------------------------- ### Make Clean Build Artifacts Source: https://github.com/dimmus/motif/blob/master/tools/dev/README.md Cleans build artifacts while keeping dependencies installed. ```bash make clean ``` -------------------------------- ### Make Dependencies Source: https://github.com/dimmus/motif/blob/master/tools/dev/README.md Automatically checks and installs dependencies using the Motif build system. ```bash make deps ``` -------------------------------- ### XtSetTypeConverter with No Caching Source: https://github.com/dimmus/motif/blob/master/doc/guide/06-actual-implementations-deep-dive.md Example of setting a type converter with no caching, suitable for simple conversions. ```c XtSetTypeConverter(XmRString, XmRInt, CvtStringToInt, args, numArgs, XtCacheNone, (XtDestructor) NULL); ```