mrc-1.3.4/0000775000175000017500000000000014127025075012145 5ustar maartenmaartenmrc-1.3.4/.gitignore0000664000175000017500000000005714127025075014137 0ustar maartenmaarten.vscode/ mrc mrc-unit-test mrc-bootstrap build/mrc-1.3.4/.travis.yml0000664000175000017500000000037214127025075014260 0ustar maartenmaartenlanguage: cpp arch: - amd64 - ppc64le - s390x - arm64 os: - linux dist: - focal compiler: - gcc - clang addons: apt: packages: - libboost-all-dev script: - ./configure - make - make test - sudo make install mrc-1.3.4/CMakeLists.txt0000664000175000017500000000723514127025075014714 0ustar maartenmaarten# Copyright (c) 2021 Maarten L. Hekkelman # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cmake_minimum_required(VERSION 3.10) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # set the project name project(mrc VERSION 1.3.4) include(Dart) include(FindFilesystem) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Filesystem REQUIRED) if(MSVC) # make msvc standards compliant... add_compile_options(/permissive-) # Windows is always little endian, right? add_compile_definitions(LITTLE_ENDIAN) # Find out the processor type for the target if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") set(COFF_TYPE "x64") elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386") set(COFF_TYPE "x86") elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ARM64") set(COFF_TYPE "arm64") else() message(FATAL_ERROR "Unsupported or unknown processor type ${CMAKE_SYSTEM_PROCESSOR}") endif() set(COFF_SPEC "--coff=${COFF_TYPE}") endif() find_package(Boost 1.70.0 REQUIRED COMPONENTS program_options) include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) link_libraries(Boost::program_options std::filesystem) add_custom_command(OUTPUT mrc-rsrc.obj COMMAND $ -o mrc-rsrc.obj ${PROJECT_SOURCE_DIR}/mrsrc.h ${COFF_SPEC} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/mrsrc.h mrc-bootstrap ) file(GLOB UNIT_TEST_RSRC LIST_DIRECTORIES true ${PROJECT_SOURCE_DIR}/rsrc/*) add_custom_command(OUTPUT mrc-unit-test-rsrc.obj COMMAND $ -o mrc-unit-test-rsrc.obj ${UNIT_TEST_RSRC} ${COFF_SPEC} DEPENDS ${UNIT_TEST_RSRC} mrc-bootstrap ) add_executable(mrc ${PROJECT_SOURCE_DIR}/mrc.cpp mrc-rsrc.obj) add_executable(mrc-bootstrap ${PROJECT_SOURCE_DIR}/mrc.cpp ${PROJECT_SOURCE_DIR}/dummy.cpp) add_executable(mrc-unit-test ${PROJECT_SOURCE_DIR}/mrc-unit-test.cpp mrc-unit-test-rsrc.obj) enable_testing() add_test(NAME unit-test COMMAND $ WORKING_DIRECTORY .) set(PACKAGE_NAME "${PROJECT_NAME}") set(PACKAGE_VERSION "${PROJECT_VERSION}") set(PACKAGE_STRING "${PROJECT_NAME} ${PROJECT_VERSION}") configure_file(${PROJECT_SOURCE_DIR}/mrc.h.in mrc.h) install(TARGETS mrc) if(WIN32) install(FILES mrc-config.cmake DESTINATION cmake) install(FILES mrc-manual.pdf DESTINATION doc) else() install(FILES mrc-config.cmake DESTINATION share/mrc/cmake) install(FILES mrc.1 DESTINATION share/man/man1) endif() install(DIRECTORY example DESTINATION share/doc/mrc/)mrc-1.3.4/LICENSE0000664000175000017500000000245114127025075013154 0ustar maartenmaartenSPDX-License-Identifier: BSD-2-Clause Copyright (c) 2020 Maarten L. Hekkelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.mrc-1.3.4/README.md0000664000175000017500000000575514127025075013440 0ustar maartenmaarten[![Build Status](https://travis-ci.org/mhekkel/mrc.svg?branch=master)](https://travis-ci.org/mhekkel/mrc) # mrc Maartens Resource Compiler ========================== ## Abstract A long, long time ago there existed an operating system that did things differently. One of the cool features of this OS was that applications were self contained. A single file was everything you needed to copy in order to install a new application instead of having to use installers or install scripts that put dozens of files at the most obscure locations on your disk. One of the technical features of this OS to make this possible was what they called resources. In fact, resources were stored as some kind of database in one of the two forks of a file, the other fork being the data fork. Resources were mildly popular, other OS'es copied the concept in one way or another. The company that invented them abandoned the whole concept though, they thought they had something better.... Anyway, I still like being able to provide a single executable to the users of my software. And given the usefulness of resources I decided to create a compiler for them that works with the ELF executable format. Since using resource forks is not an option I decided to store the data in the static data section of an executable. The data is then available through global variables. New in version 1.4 is support for writing COFF files, so you can now use this type of resources in Windows as well. ## Synopsis First, create the mrsrc.h file that contains C++ classes to access the resources. This file can be generated by executing: mrc --header > mrsrc.h Then include this file and use it: #include "mrsrc.h" int main() { mrsrc::rsrc hello("texts/greeting"); if (hello) { string s(hello.data(), hello.size()); cout << s << endl; } return 0; } To create a resource file: echo "Hello, world!" > greeting mrc -o my-rsrc.o --root texts greeting c++ -o my-app foo.cpp my-rsrc.o ## CMake integration mrc comes with a mrc-config.cmake file installed at a suitable location. This means you can include mrc using a `find_package` call. The previous example might have a _CMakeLists.txt_ file containing the following: ``` project(hello VERSION 1.0.0 LANGUAGES CXX) # Include the mrc package file find_package(Mrc) # The MRC_FOUND variable is set if MRC was found if(NOT MRC_FOUND) message(FATAL_ERROR "mrc not found) endif() # Write out the mrc header file and add the directory to the include paths mrc_write_header(${CMAKE_CURRENT_BINARY_DIR}/mrsrc.hpp) include_directories(${CMAKE_CURRENT_BINARY_DIR}) # The executable to create add_executable(mrc-user ${CMAKE_CURRENT_SOURCE_DIR}/src/mrc-user.cpp) # Add the file hello.txt in the directory rsrc as resource 'hello.txt' mrc_target_resources(mrc-user ${CMAKE_CURRENT_SOURCE_DIR}/rsrc/hello.txt) ``` ## Building mrc To build mrc, you should use [cmake](https://cmake.org), e.g.: ``` git clone https://github.com/mhekkel/mrc.git cd mrc mkdir build cd build cmake .. cmake --install ```mrc-1.3.4/changelog0000664000175000017500000000157614127025075014030 0ustar maartenmaartenVersion 1.3.4 - Fix the Windows version again. Version 1.3.3 - Add the ABI flag to specify ABI OS version in ELF headers Version 1.3.2 - Fix install rules in CMakeLists.txt - Added example code Version 1.3.1 - Fix writing header to specified output instead of stdout - Added a cmake config file, for easy configuration Version 1.3.0 - Use cmake as new build system instead of autoconf - Write COFF files (for MS Windows) Version 1.2.3 - Should now work on all architectures. - replaced cpu and eabi flags with more generic --elf-xxx options. Version 1.2.2 - Fixed error caused by switching to std::filesystem usage. Version 1.2.0 - Added istream class Version 1.2.0 - Added streambuf class - Added unit tests Version 1.1.0 - New interface file, now no longer throws exception when a resource is not found. So you should check the validity using e.g. operator bool. Version 1.0.0 mrc-1.3.4/cmake/0000775000175000017500000000000014127025075013225 5ustar maartenmaartenmrc-1.3.4/cmake/FindFilesystem.cmake0000664000175000017500000000432714127025075017162 0ustar maartenmaarten# Simplistic reimplementation of https://github.com/vector-of-bool/CMakeCM/blob/master/modules/FindFilesystem.cmake if(TARGET std::filesystem) return() endif() cmake_minimum_required(VERSION 3.10) include(CMakePushCheckState) include(CheckIncludeFileCXX) include(CheckCXXSourceCompiles) cmake_push_check_state() set(CMAKE_CXX_STANDARD 17) check_include_file_cxx("filesystem" _CXX_FILESYSTEM_HAVE_HEADER) mark_as_advanced(_CXX_FILESYSTEM_HAVE_HEADER) set(code [[ #include #include int main() { auto cwd = std::filesystem::current_path(); return EXIT_SUCCESS; } ]]) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 8.4.0) # >> https://stackoverflow.com/questions/63902528/program-crashes-when-filesystempath-is-destroyed set(CXX_FILESYSTEM_NO_LINK_NEEDED 0) else() # Check a simple filesystem program without any linker flags check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED) endif() if(CXX_FILESYSTEM_NO_LINK_NEEDED) set(_found 1) else() set(prev_libraries ${CMAKE_REQUIRED_LIBRARIES}) # Add the libstdc++ flag set(CMAKE_REQUIRED_LIBRARIES ${prev_libraries} -lstdc++fs) check_cxx_source_compiles("${code}" CXX_FILESYSTEM_STDCPPFS_NEEDED) set(_found ${CXX_FILESYSTEM_STDCPPFS_NEEDED}) if(NOT CXX_FILESYSTEM_STDCPPFS_NEEDED) # Try the libc++ flag set(CMAKE_REQUIRED_LIBRARIES ${prev_libraries} -lc++fs) check_cxx_source_compiles("${code}" CXX_FILESYSTEM_CPPFS_NEEDED) set(_found ${CXX_FILESYSTEM_CPPFS_NEEDED}) endif() endif() if(_found) add_library(std::filesystem INTERFACE IMPORTED) set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_17) if(CXX_FILESYSTEM_NO_LINK_NEEDED) # Nothing to add... elseif(CXX_FILESYSTEM_STDCPPFS_NEEDED) set_target_properties(std::filesystem PROPERTIES IMPORTED_LIBNAME stdc++fs) elseif(CXX_FILESYSTEM_CPPFS_NEEDED) set_target_properties(std::filesystem PROPERTIES IMPORTED_LIBNAME c++fs) endif() endif() cmake_pop_check_state() set(Filesystem_FOUND ${_found} CACHE BOOL "TRUE if we can run a program using std::filesystem" FORCE) if(Filesystem_FIND_REQUIRED AND NOT Filesystem_FOUND) message(FATAL_ERROR "Cannot run simple program using std::filesystem") endif() mrc-1.3.4/config/0000775000175000017500000000000014127025075013412 5ustar maartenmaartenmrc-1.3.4/config/config.guess0000664000175000017500000013671414127025075015743 0ustar maartenmaarten#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2020 Free Software Foundation, Inc. timestamp='2020-04-26' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$driver" break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi-}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; *:OS108:*:*) echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Twizzler:*:*) echo "$UNAME_MACHINE"-unknown-twizzler exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ "$HP_ARCH" = hppa2.0w ] then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi else echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf fi exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-pc-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; *:Minix:*:*) echo "$UNAME_MACHINE"-unknown-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel #undef mips64 #undef mips64el #if ${IS_GLIBC} && defined(_ABI64) LIBCABI=gnuabi64 #else #if ${IS_GLIBC} && defined(_ABIN32) LIBCABI=gnuabin32 #else LIBCABI=${LIBC} #endif #endif #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa64r6 #else #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa32r6 #else #if defined(__mips64) CPU=mips64 #else CPU=mips #endif #endif #endif #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) MIPS_ENDIAN= #else MIPS_ENDIAN= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac if command -v xcode-select > /dev/null 2> /dev/null && \ ! xcode-select --print-path > /dev/null 2> /dev/null ; then # Avoid executing cc if there is no toolchain installed as # cc will be a stub that puts up a graphical alert # prompting the user to install developer tools. CC_FOR_BUILD=no_compiler_found else set_cc_for_build fi if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. # shellcheck disable=SC2154 if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; *:Unleashed:*:*) echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" exit ;; esac # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" < #include #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #include #if defined(_SIZE_T_) || defined(SIGLOST) #include #endif #endif #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) #include #if defined (BSD) #if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); #else #if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); #else printf ("vax-dec-bsd\n"); exit (0); #endif #endif #else printf ("vax-dec-bsd\n"); exit (0); #endif #else #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname un; uname (&un); printf ("vax-dec-ultrix%s\n", un.release); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname *un; uname (&un); printf ("mips-dec-ultrix%s\n", un.release); exit (0); #else printf ("mips-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF fi exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: mrc-1.3.4/config/config.sub0000664000175000017500000007560414127025075015406 0ustar maartenmaarten#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2020 Free Software Foundation, Inc. timestamp='2020-05-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type # shellcheck disable=SC2162 IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \ | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 os=$maybe_os ;; android-linux) basic_machine=$field1-unknown os=linux-android ;; *) basic_machine=$field1-$field2 os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any pattern case $field1-$field2 in decstation-3100) basic_machine=mips-dec os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 os= ;; *) basic_machine=$field1 os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc os=bsd ;; a29khif) basic_machine=a29k-amd os=udi ;; adobe68k) basic_machine=m68010-adobe os=scout ;; alliant) basic_machine=fx80-alliant os= ;; altos | altos3068) basic_machine=m68k-altos os= ;; am29k) basic_machine=a29k-none os=bsd ;; amdahl) basic_machine=580-amdahl os=sysv ;; amiga) basic_machine=m68k-unknown os= ;; amigaos | amigados) basic_machine=m68k-unknown os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=sysv4 ;; apollo68) basic_machine=m68k-apollo os=sysv ;; apollo68bsd) basic_machine=m68k-apollo os=bsd ;; aros) basic_machine=i386-pc os=aros ;; aux) basic_machine=m68k-apple os=aux ;; balance) basic_machine=ns32k-sequent os=dynix ;; blackfin) basic_machine=bfin-unknown os=linux ;; cegcc) basic_machine=arm-unknown os=cegcc ;; convex-c1) basic_machine=c1-convex os=bsd ;; convex-c2) basic_machine=c2-convex os=bsd ;; convex-c32) basic_machine=c32-convex os=bsd ;; convex-c34) basic_machine=c34-convex os=bsd ;; convex-c38) basic_machine=c38-convex os=bsd ;; cray) basic_machine=j90-cray os=unicos ;; crds | unos) basic_machine=m68k-crds os= ;; da30) basic_machine=m68k-da30 os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec os= ;; delta88) basic_machine=m88k-motorola os=sysv3 ;; dicos) basic_machine=i686-pc os=dicos ;; djgpp) basic_machine=i586-pc os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=ose ;; gmicro) basic_machine=tron-gmicro os=sysv ;; go32) basic_machine=i386-pc os=go32 ;; h8300hms) basic_machine=h8300-hitachi os=hms ;; h8300xray) basic_machine=h8300-hitachi os=xray ;; h8500hms) basic_machine=h8500-hitachi os=hms ;; harris) basic_machine=m88k-harris os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp os=hpux ;; hp300bsd) basic_machine=m68k-hp os=bsd ;; hppaosf) basic_machine=hppa1.1-hp os=osf ;; hppro) basic_machine=hppa1.1-hp os=proelf ;; i386mach) basic_machine=i386-mach os=mach ;; isi68 | isi) basic_machine=m68k-isi os=sysv ;; m68knommu) basic_machine=m68k-unknown os=linux ;; magnum | m3230) basic_machine=mips-mips os=sysv ;; merlin) basic_machine=ns32k-utek os=sysv ;; mingw64) basic_machine=x86_64-pc os=mingw64 ;; mingw32) basic_machine=i686-pc os=mingw32 ;; mingw32ce) basic_machine=arm-unknown os=mingw32ce ;; monitor) basic_machine=m68k-rom68k os=coff ;; morphos) basic_machine=powerpc-unknown os=morphos ;; moxiebox) basic_machine=moxie-unknown os=moxiebox ;; msdos) basic_machine=i386-pc os=msdos ;; msys) basic_machine=i686-pc os=msys ;; mvs) basic_machine=i370-ibm os=mvs ;; nacl) basic_machine=le32-unknown os=nacl ;; ncr3000) basic_machine=i486-ncr os=sysv4 ;; netbsd386) basic_machine=i386-pc os=netbsd ;; netwinder) basic_machine=armv4l-rebel os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=newsos ;; news1000) basic_machine=m68030-sony os=newsos ;; necv70) basic_machine=v70-nec os=sysv ;; nh3000) basic_machine=m68k-harris os=cxux ;; nh[45]000) basic_machine=m88k-harris os=cxux ;; nindy960) basic_machine=i960-intel os=nindy ;; mon960) basic_machine=i960-intel os=mon960 ;; nonstopux) basic_machine=mips-compaq os=nonstopux ;; os400) basic_machine=powerpc-ibm os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=ose ;; os68k) basic_machine=m68k-none os=os68k ;; paragon) basic_machine=i860-intel os=osf ;; parisc) basic_machine=hppa-unknown os=linux ;; pw32) basic_machine=i586-unknown os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=rdos ;; rdos32) basic_machine=i386-pc os=rdos ;; rom68k) basic_machine=m68k-rom68k os=coff ;; sa29200) basic_machine=a29k-amd os=udi ;; sei) basic_machine=mips-sei os=seiux ;; sequent) basic_machine=i386-sequent os= ;; sps7) basic_machine=m68k-bull os=sysv2 ;; st2000) basic_machine=m68k-tandem os= ;; stratus) basic_machine=i860-stratus os=sysv4 ;; sun2) basic_machine=m68000-sun os= ;; sun2os3) basic_machine=m68000-sun os=sunos3 ;; sun2os4) basic_machine=m68000-sun os=sunos4 ;; sun3) basic_machine=m68k-sun os= ;; sun3os3) basic_machine=m68k-sun os=sunos3 ;; sun3os4) basic_machine=m68k-sun os=sunos4 ;; sun4) basic_machine=sparc-sun os= ;; sun4os3) basic_machine=sparc-sun os=sunos3 ;; sun4os4) basic_machine=sparc-sun os=sunos4 ;; sun4sol2) basic_machine=sparc-sun os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun os= ;; sv1) basic_machine=sv1-cray os=unicos ;; symmetry) basic_machine=i386-sequent os=dynix ;; t3e) basic_machine=alphaev5-cray os=unicos ;; t90) basic_machine=t90-cray os=unicos ;; toad1) basic_machine=pdp10-xkl os=tops20 ;; tpf) basic_machine=s390x-ibm os=tpf ;; udi29k) basic_machine=a29k-amd os=udi ;; ultra3) basic_machine=a29k-nyu os=sym1 ;; v810 | necv810) basic_machine=v810-nec os=none ;; vaxv) basic_machine=vax-dec os=sysv ;; vms) basic_machine=vax-dec os=vms ;; vsta) basic_machine=i386-pc os=vsta ;; vxworks960) basic_machine=i960-wrs os=vxworks ;; vxworks68) basic_machine=m68k-wrs os=vxworks ;; vxworks29k) basic_machine=a29k-wrs os=vxworks ;; xbox) basic_machine=i686-pc os=mingw32 ;; ymp) basic_machine=ymp-cray os=unicos ;; *) basic_machine=$1 os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi os=${os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray os=${os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $os in irix*) ;; *) os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony os=newsos ;; next | m*-next) cpu=m68k vendor=next case $os in openstep*) ;; nextstep*) ;; ns2*) os=nextstep2 ;; *) os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde os=${os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) # shellcheck disable=SC2162 IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x$os != x ] then case $os in # First match some system type aliases that might get confused # with valid system types. # solaris* is a basic system type, with this one exception. auroraux) os=auroraux ;; bluegene*) os=cnk ;; solaris1 | solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; solaris) os=solaris2 ;; unixware*) os=sysv4.2uw ;; gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) es1800*) os=ose ;; # Some version numbers need modification chorusos*) os=chorusos ;; isc) os=isc2.2 ;; sco6) os=sco5v6 ;; sco5) os=sco3.2v5 ;; sco4) os=sco3.2v4 ;; sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` ;; sco3.2v[4-9]* | sco5v6*) # Don't forget version if it is 3.2v4 or newer. ;; scout) # Don't match below ;; sco*) os=sco3.2v2 ;; psos*) os=psos ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # sysv* is not here because it comes later, after sysvr4. gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | kopensolaris* | plan9* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* | twizzler* \ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ | knetbsd* | mirbsd* | netbsd* \ | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \ | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ | chorusrdb* | cegcc* | glidix* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ | linux-newlib* | linux-musl* | linux-uclibc* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \ | interix* | uwin* | mks* | rhapsody* | darwin* \ | openstep* | oskit* | conix* | pw32* | nonstopux* \ | storm-chaos* | tops10* | tenex* | tops20* | its* \ | os2* | vos* | palmos* | uclinux* | nucleus* \ | morphos* | superux* | rtmk* | windiss* \ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | nsk* | powerunix* | genode*) # Remember, each alternative MUST END IN *, to match a version number. ;; qnx*) case $cpu in x86 | i*86) ;; *) os=nto-$os ;; esac ;; hiux*) os=hiuxwe2 ;; nto-qnx*) ;; nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; sim | xray | os68k* | v88r* \ | windows* | osx | abug | netware* | os9* \ | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) ;; linux-dietlibc) os=linux-dietlibc ;; linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; lynx*178) os=lynxos178 ;; lynx*5) os=lynxos5 ;; lynx*) os=lynxos ;; mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; opened*) os=openedition ;; os400*) os=os400 ;; sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; wince*) os=wince ;; utek*) os=bsd ;; dynix*) os=bsd ;; acis*) os=aos ;; atheos*) os=atheos ;; syllable*) os=syllable ;; 386bsd) os=bsd ;; ctix* | uts*) os=sysv ;; nova*) os=rtmk-nova ;; ns2) os=nextstep2 ;; # Preserve the version number of sinix5. sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; sinix*) os=sysv4 ;; tpf*) os=tpf ;; triton*) os=sysv3 ;; oss*) os=sysv3 ;; svr4*) os=sysv4 ;; svr3) os=sysv3 ;; sysvr4) os=sysv4 ;; # This must come after sysvr4. sysv*) ;; ose*) os=ose ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) os=mint ;; zvmoe) os=zvmoe ;; dicos*) os=dicos ;; pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $cpu in arm*) os=eabi ;; *) os=elf ;; esac ;; nacl*) ;; ios) ;; none) ;; *-eabi) ;; *) echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $cpu-$vendor in score-*) os=elf ;; spu-*) os=elf ;; *-acorn) os=riscix1.2 ;; arm*-rebel) os=linux ;; arm*-semi) os=aout ;; c4x-* | tic4x-*) os=coff ;; c8051-*) os=elf ;; clipper-intergraph) os=clix ;; hexagon-*) os=elf ;; tic54x-*) os=coff ;; tic55x-*) os=coff ;; tic6x-*) os=coff ;; # This must come before the *-dec entry. pdp10-*) os=tops20 ;; pdp11-*) os=none ;; *-dec | vax-*) os=ultrix4.2 ;; m68*-apollo) os=domain ;; i386-sun) os=sunos4.0.2 ;; m68000-sun) os=sunos3 ;; m68*-cisco) os=aout ;; mep-*) os=elf ;; mips*-cisco) os=elf ;; mips*-*) os=elf ;; or32-*) os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=sysv3 ;; sparc-* | *-sun) os=sunos4.1.1 ;; pru-*) os=elf ;; *-be) os=beos ;; *-ibm) os=aix ;; *-knuth) os=mmixware ;; *-wec) os=proelf ;; *-winbond) os=proelf ;; *-oki) os=proelf ;; *-hp) os=hpux ;; *-hitachi) os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=sysv ;; *-cbm) os=amigaos ;; *-dg) os=dgux ;; *-dolphin) os=sysv3 ;; m68k-ccur) os=rtu ;; m88k-omron*) os=luna ;; *-next) os=nextstep ;; *-sequent) os=ptx ;; *-crds) os=unos ;; *-ns) os=genix ;; i370-*) os=mvs ;; *-gould) os=sysv ;; *-highlevel) os=bsd ;; *-encore) os=bsd ;; *-sgi) os=irix ;; *-siemens) os=sysv4 ;; *-masscomp) os=rtu ;; f30[01]-fujitsu | f700-fujitsu) os=uxpv ;; *-rom68k) os=coff ;; *-*bug) os=coff ;; *-apple) os=macos ;; *-atari*) os=mint ;; *-wrs) os=vxworks ;; *) os=none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $os in riscix*) vendor=acorn ;; sunos*) vendor=sun ;; cnk*|-aix*) vendor=ibm ;; beos*) vendor=be ;; hpux*) vendor=hp ;; mpeix*) vendor=hp ;; hiux*) vendor=hitachi ;; unos*) vendor=crds ;; dgux*) vendor=dg ;; luna*) vendor=omron ;; genix*) vendor=ns ;; clix*) vendor=intergraph ;; mvs* | opened*) vendor=ibm ;; os400*) vendor=ibm ;; ptx*) vendor=sequent ;; tpf*) vendor=ibm ;; vxsim* | vxworks* | windiss*) vendor=wrs ;; aux*) vendor=apple ;; hms*) vendor=hitachi ;; mpw* | macos*) vendor=apple ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) vendor=atari ;; vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: mrc-1.3.4/config/install-sh0000775000175000017500000003253714127025075015430 0ustar maartenmaarten#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: mrc-1.3.4/dummy.cpp0000664000175000017500000000031714127025075014005 0ustar maartenmaarten// Dummy file for creating a first mrc-mini application #include "mrsrc.h" const mrsrc::rsrc_imp gResourceIndex[1] = {}; const char gResourceData[] = "\0\0\0\0"; const char gResourceName[] = "\0\0\0\0"; mrc-1.3.4/example/0000775000175000017500000000000014127025075013600 5ustar maartenmaartenmrc-1.3.4/example/CMakeLists.txt0000664000175000017500000000137014127025075016341 0ustar maartenmaartencmake_minimum_required(VERSION 3.16) # set the project name project(mrc-user VERSION 1.0.0 LANGUAGES CXX) # Locate the mrc executable and load the mrc_* functions find_package(mrc) # resources depend on C++17 features, like std::filesystem set(CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) # Write out an mrsrc.hpp file and make sure the compiler finds it mrc_write_header(${CMAKE_CURRENT_BINARY_DIR}/mrsrc.hpp) include_directories(${CMAKE_CURRENT_BINARY_DIR}) # The executable to create add_executable(mrc-user ${CMAKE_CURRENT_SOURCE_DIR}/mrc-user.cpp) # Add the hello.txt file as a resource, more files and/or directories # can be specified here mrc_target_resources(mrc-user ${CMAKE_CURRENT_SOURCE_DIR}/hello.txt) mrc-1.3.4/example/hello.txt0000664000175000017500000000001514127025075015440 0ustar maartenmaartenHello, world!mrc-1.3.4/example/mrc-user.cpp0000664000175000017500000000070214127025075016040 0ustar maartenmaarten/* Example of the use of resources created with mrc in a C++ application */ #include // Include the generated header file #include "mrsrc.hpp" int main() { try { mrsrc::rsrc res("hello.txt"); if (not res) throw std::runtime_error("Resource not found"); std::cout.write(res.data(), res.size()); std::cout << std::endl; } catch(const std::exception& e) { std::cerr << e.what() << '\n'; exit(1); } return 0; } mrc-1.3.4/mrc-config.cmake0000664000175000017500000001077014127025075015200 0ustar maartenmaarten# SPDX-License-Identifier: BSD-2-Clause # Copyright (c) 2021 Maarten L. Hekkelman # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #[=======================================================================[.rst: FindMrc ------- The module defines the following variables: ``MRC_EXECUTABLE`` Path to mrc executable. ``mrc_FOUND``, ``MRC_FOUND`` True if the mrc executable was found. ``MRC_VERSION_STRING`` The version of mrc found. Additionally, the following commands will be added: :command:`mrc_write_header` :command:`mrc_target_resource` .. versionadded:: 3.14 The module defines the following ``IMPORTED`` targets (when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``): ``mrc::mrc`` the mrc executable. Example usage: .. code-block:: cmake find_package(Mrc) if(mrc_FOUND) message("mrc found: ${MRC_EXECUTABLE}") mrc_write_header(${CMAKE_CURRENT_BINARY_DIR}/mrsrc.hpp) mrc_target_resource(my-app rsrc/hello-world.txt) endif() #]=======================================================================] find_program(MRC_EXECUTABLE NAMES mrc DOC "mrc executable" ) if(CMAKE_HOST_WIN32) find_program(MRC_EXECUTABLE NAMES mrc PATHS $ENV{LOCALAPPDATA} PATH_SUFFIXES mrc/bin DOC "mrc executable" ) endif() mark_as_advanced(MRC_EXECUTABLE) # Retrieve the version number execute_process(COMMAND ${MRC_EXECUTABLE} --version OUTPUT_VARIABLE mrc_version ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) if (mrc_version MATCHES "^mrc version [0-9]") string(REPLACE "mrc version " "" MRC_VERSION_STRING "${mrc_version}") endif() unset(mrc_version) find_package(PackageHandleStandardArgs REQUIRED) find_package_handle_standard_args(Mrc REQUIRED_VARS MRC_EXECUTABLE VERSION_VAR MRC_VERSION_STRING) #[=======================================================================[.rst: .. command:: mrc_target_resources Add resources to a target. The first argument should be the target name, the rest of the arguments are passed to mrc to pack into a resource object file. #]=======================================================================] function(mrc_target_resources _target) set(RSRC_FILE "${CMAKE_CURRENT_BINARY_DIR}/${_target}_rsrc.obj") if(CMAKE_HOST_WIN32) # Find out the processor type for the target if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") set(COFF_TYPE "x64") elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386") set(COFF_TYPE "x86") elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ARM64") set(COFF_TYPE "arm64") else() message(FATAL_ERROR "Unsupported or unknown processor type ${CMAKE_SYSTEM_PROCESSOR}") endif() set(COFF_SPEC "--coff=${COFF_TYPE}") endif() add_custom_command(OUTPUT ${RSRC_FILE} COMMAND ${MRC_EXECUTABLE} -o ${RSRC_FILE} ${ARGN} ${COFF_SPEC}) target_sources(${_target} PRIVATE ${RSRC_FILE}) endfunction() #[=======================================================================[.rst: .. command:: mrc_write_header Write out the header file needed to use resources in a C++ application. The argument specifies the file to create. #]=======================================================================] function(mrc_write_header _header) execute_process( COMMAND ${MRC_EXECUTABLE} --header --output ${_header} ) endfunction() mrc-1.3.4/mrc-manual.pdf0000664000175000017500000006443314127025075014706 0ustar maartenmaarten%PDF-1.4 %쏢 %%Invocation: path/gs -P- -dSAFER -dCompatibilityLevel=1.4 -q -P- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sstdout=? -sOutputFile=? -P- -dSAFER -dCompatibilityLevel=1.4 - 5 0 obj <> stream xWn6 ׊{ h G-ӶZ]\QJbt{Q;lYiE$6'QF<r]LVjӄCbd%y6-'#1'q$%rb&.&'Nd;?l.=y^ӳף ,0I8NWpB>X-&Ϋ'8{A#OI#U5$Y]n\W\沈&Zo8>4EzdE{xևӿw[nݵihU!P Sȝw~}VO@}3e 8q0q؋ #BL|"tIw4MYȫˑO\#wu<-E+yRH)ֈαZCY!:4CAD(MBbd`'3ߑj-`(-,B9ВArg(44ɨN69`ʫ+=-A?AJ S ^/>7a'h~ѩsЪGxeKΡ/ɩŧ3@UHQ\rOа^ǣ(`zt݋o^uENVBپf[+4B6P&fShiII.vMTRVh:]ֹBS(-Qm+G"\AĂX[[uhU>-1=q"Hud.SJx^]4u&]#ѯv-Z"*"qLTUx&$v-RVKʼnKDׂ82z&t.72keWeZMF!0W9T <ЫN #$ƼF=宲 U33*Պ@l+/PRifp@-Oz]~Ft=`˪K,puv.ז2F-TuR[Ρy^ϡNU:4ܰޭ3n][- o\3WFA)TsԥA^{S͈&q {v}h*0p^c)@X=h}ezwjO+8#&<ގ頭bSc@K:3X34EWXj ] HlNȫՄeU p9hȇ?4K(.@|_ۖn?u!gfBߓ#6]S~ʘyYٔAjrMk(R;VdD)Цj:ީ%}^ꍆiQz. r>!9kg %5!w= /sw]SyS.X qG@_#%pT] >bkOxpaɊj#yK&5DE| 7ׇb5G}&-dz+RdJYrǘ=3x TZ* Gղ/߽c}_.a DO+Y,R4&W0LZo{9UW`Ǿ3k[! Z%s̳%>bc*gO}9T{@S7*z0a4vb/ ,I5!(=^2Ft|G?Qendstream endobj 6 0 obj 1776 endobj 17 0 obj <> stream xXn}W4aiwA^ˈX83Mr\D 'x9U}e)A 2VUNUw(' xsD#/$Ov$op ƅB$$J<'d} 96ٝVV6+W28?cZ-_w93{!qw_8+˝]Z6sx 5SU܂8br[FqIo|*/ҪmK$˜l%EwЏJ,"\ _oD-rW7,Hܾ@o2ZR/pߣ99mw^JQǩTjdZk4 nl/^ Y4AyOG\qT4J4Ye/ V]S!ODEу Q=s`6zsbx 0r $ӮN#F~<Õ`FIidՑE>IWnsc9B}Eݛ.Ib?o|{nE)vUN F̹ hE&B8BJۮn$ ^}쁷xp׿H14@Em$L$@ҙP;4_蜀ϢF.]OGѨo݄1AduեZ_r{ lڢr+<ϳG"lnT2wID^27/YLOkO2+OߓoiY"f4DU"H4-%kD/nY#D21'?i%H_W DT!orٗ{v!7n7n“6ǥ8(†g0nGGI`JsQHi(hcjG; u=DsAvyw ]!2U3Lh*seP~[$Nid[ lSC6 ݠZre˂9. =Hm%HZ rI.+;%Kk+9C!I ]I \iKV{,4+"y(:-BD?VYU%ΠEwaE[Ox= W 4G1Zn!&'mİp2q0k8V1A:yM<]i+=GUY9iki`W)7.-VVT_DaR #+`eWQv 4ZITKli9!NѪt=~ `ބ`&nMhMC#<@O&})F8>P>-Jnd2}pL6ؖ%'7 ^AꠗW j2cn1HUMS 8|/7)At ٽ܈?"hԠyS~EA`0`Oe9QǮ7}endstream endobj 18 0 obj 2235 endobj 22 0 obj <> stream xXے}W̛8 ғ+)M? KX @^l9g0Zo t>}1%g8~n%귕/Wqb ʝ,Q,4O3=d"xv98ρy~LިHp!m<,":f۫O>nj~a؃ Bh:Y(Y,;< A~Ǽ'zV4UecyU}6'|dCe:֝MQ>VEuٗ\=^Xxj%x&پliK&RgYmͺt L5JF-NkD9+ZT_ J)0t_\{xYovS:i.u^ kKmq,byQ#s9%i"ICv7ZrQI6 %c yߛP֬ ǻEZ2i[ґ=XCLPa C8,/ovЏ)T?~, !Hki`wZ Q53 ($;QNfZ1[\|so)-:7Tg̶yeBɕ M+ɳJlDA4}q'#-hendstream endobj 23 0 obj 1975 endobj 4 0 obj <> /Contents 5 0 R >> endobj 16 0 obj <> /Contents 17 0 R >> endobj 21 0 obj <> /Contents 22 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 4 0 R 16 0 R 21 0 R ] /Count 3 >> endobj 1 0 obj <> endobj 7 0 obj <>endobj 14 0 obj <> endobj 15 0 obj <> endobj 19 0 obj <> endobj 20 0 obj <> endobj 24 0 obj <> endobj 25 0 obj <> endobj 12 0 obj <> endobj 29 0 obj <> endobj 10 0 obj <> endobj 30 0 obj <> endobj 8 0 obj <> endobj 31 0 obj <> endobj 13 0 obj <> endobj 26 0 obj <>stream xypW XXq봄@nB )WrcsmCmZiOe%YƖ16\ I 0GP$Lt1Cg;7o~aa<W%rr{d%cl*}yk>z ?|%&a`L~yd8L<[[ffm6+=/JӥKJH6ۨ TQDRm.Q={G 0LPVK Kd9/bleaIJjl >cSX2&؋:x7wx1n?a|PP @B\RW҅"~B-Mfiې4 Or2w\8Al1>1[KZ-N\ ڻբr-2H I'F hP! voO9dљR܍ D6d}Id8p|_Ka_:cr|>^궃*\U5'#ߌh*u)A1xk;]\tBYW'?>v8gp̉(/+c⽾:OC4SHa0j &b7|ր*^UuY0pJ*ƻɫ 5*C5j"" A~oh R` \RpL!dL=%c{zA@ %GóɮǛf鲑P6Hufyo|4QO_C|Wlv|KaߙfoS]c?$G;t4-A;W7/}L +}pIǚj2mLNKuoqP~m<%v͗lp%=@bC~ ?cZmUV#UxMy„]pAos9h3N`5#m ;wv|.y:>wP^[7%ם9p _(=MoVVKߞ-&?_Ini n _aݏhz4F0>"n`.総 a~B77b2^-K*pY^g:S]dS"sTT%Cߞ/:xwklc|}lu -O]"`>PY2͘CIl3X@mrpl=P#FҦ`.S J}(;4|rOrm4\e 3Q)yDX6$Fv~}g Eyã|XRn5V`]%JZ=^7>jter U) hMP_sP\Q"ꮎxbh-ES#O;D̙;4ٚP;-Y|q0f&7i68ޒb.T[b`ۯqtH5-nma&& =#仕rb{yEbȆѮ ѶUjZKHe֮P!NC4ScoO{2jiKF\bD 9IڤZZւ \vns0>ئrj[ \@/[Aܢ.nbb* ,/.:P-`KUܝ> endobj 27 0 obj <>stream xWiXS׺1nAD]VmmN8 a`$$@ +3A$E-֡=ցi{ZX=CўmxsW>BZ~~j8J 8I*毕G8}"ৎ"N؅B.B2i*ߝg'}"ݨ{ʽ3wutyLTt [7^륊DYM4^ MLIKQx%&z96QSޚke% WlJNْ HtG_T{'gb (j:ZFEQ˩Nj&5M>mʟZKQ;!j.Z@mޣ6S[ZLm|)Wj"Q)IM\*z@No邑q g ;mwvt'4z+K^iyϯ:Ü]߃ww}L~7 Gv8pN_䛵(`!]@/6=3tUm-LN6@δJK lyٌauVl̇a16W"# LmST&jbdh ֑8x!zB5.ӥ}^5}5kuNE9((b`!<ǡ8f |JC!T}2a0ab,3x pi@M}sO/*ygDTwsyY(50P6h;#_p\UmiljDuݒv&6u@ Fš& 0tR8a V_WUv4 NJ-d:u|qZO[x(A3[yh<'E4H8B1jԬc7L7D8iȽ+^+|' U”U]>K`OwiWޏh2C-̪6^ea'3VVQ)Oͱ#lL[MoNs:Rc 쬐\e={fK?Bx _q03SQ)(L.JF-ۗl |",GqlD gexl,))GŨP;9u wiɦc2jgZl]FqCZezm0:Rlh 0 #:_tĔB{cRGBUB #Aq! |DLʪ;+| nDWPn>Ӿa=Ƨ7iҌT)˪'O2wK>÷r!jc/ 8PWiL,dbcӲ|,і8R,<`[k-^ʊ+U1xƭ)J1^`y%ch]@RUkzsbZ`,Iغ54u.8Y?;ҸD:vEZ|t\XuܫAșωvƈcZ%5Lyt4!\d0.s>;qu\* BMR{n=5y`!:{%{Z^>ͷ_۸Uĩ/Spv9M1FqKLDN&cjJémbxc(}LC1OưKYCc^j_ 8MIHTd`dig;G&OwӶeQo9/+ҥP ?)7)s|k/TYNm`*r{Ls q˼L||_Ü^6T$jP^:-95+k5zU!qxWy>qlzm=O5 rqrN%g_ㄣթv/CMJ(mq Y0 ;"PԎ61b:OSNnK,<뛹'%VqrG1XȪԼ9ÑRf}_җsqkxaXYlCU` hRi}pUp4V+@Si+she&_-QQoWN~gfEp85Z>`w_,M@O$,,B}\[n˂/SLE}u_};s;B[`;g(ېe`kj-S4bEZlzD 9->7Ijdf>]3c`YId˼8L(W+?J @Qkɬ6m7vǀ;|x{;{}LMbCm.f?;[+Gq3b^PZ${pwI:t(ɓ'$/^|aqBE2}i;Ў(9%yd -wcHQiEE ;kM V Gm\:Rg@Vb?lFgH9ֱrdqð&'{%1xdcTnpң[q\lC'CoUEĥJ]e$uL?]]<kQ˻9ڧ-yrAZ8+!ѡAm}}m}}1!(IѪdR^8HH`Iy$h SXܫ +.]E.ɍhƃ+II'3ێ|&bt.wUs9GO߁pа }gyw xied=ڜha"a8F[\UiV&3{6@h=t:FׁYp+bGaUV8<7B[0's/!'Oa9'z$gnU Ȣ pwޓgGY͘>1_-Q"ǩo8LʰY!ޥ`ڌuJt8Xe\Go0rIMdy9YH޺_p5ں mEAIؘ}:_t#IZ"M :5JV\ztʩ"Ԫ(dq!i:] jU#.0D`> u jX!B @4Pgd@Wg+E7Y3[dSbeCo%vK71; `gŒ $1{Kiy?f3D%-d fgq6>hڋbMAőlɑ;1*\Z\VR]TKt ۞y{ L〃e y KP23"<#B,o<\} )o{~bp;7"wv_:6969@ְcF]xxxgbR61o/gA;#( RH??ህpH/[Set֌2˴[M4\Q\XَXǭѨ7%,^=yySٝ)W tV&ȲvcY7E$Uu/ nr.I^G?L@s OEndXxȠ#29vV3syY-E*z> kWAV _j> endstream endobj 9 0 obj <> endobj 28 0 obj <>stream xxy\S!{o nM&j*:- *L I $+ S agĉZk;P;iϩ;kE+w~dewx]a p{GŅ,L .vUNdc `:Lw玬,8 LI8p8-{kҷ'$f&GED_r՚!_?M!=,6!1.,>@T\HZs{E'A|5~[B;wIۛ,q<_a{DgWwOo߲A+VfކmZVmaxxp'# <ě&|_b Gۈb;8H NbM"{w5>b-FK' b 1E"ÄqM0\Cp gp!B&DTFl$∗xbG/#q$Sޛ]ƭr"yyj1u>J?=6m4/-|~ӿxmƫ3L|%rK33o uqcթ38w_gO0LUs|9gtsoz~)` H K46]`Z#Fei]d`?g(tB) (k)3VTǗ%'$Kr}uPٰl4j`eF8_90BA7 ;'k:}>vQYi) P e34̤]z8Vo2~R*6f@7EHO9BԌNO2Rpt[oNMOgw$8 %1-qMeTהNj-'êKhu  ӓM!OzԘ̐ܽ>(3`Pڂ* rvhe3 Q] Ѽ'#tw(OlQv3zy)zGl O% gvG8)65_ 19)@'WJ(dE ZQn(CLV~E \G(;99+.[Նl })_\X6c'X?&Iuz<QZx*pc{)4: h _"̬޶cOz p^gbЁ{@.8/l$X?{ 8e;;QxSy!cܢ>*I]<_:pxxPjOzdDEEtgh" v: mLg6B'4<['~m%![9w\/^#?En*Q|*}r-z3m%'8+M Y!x@B\WCS/oc\)|I IFDuNhrjT[./w4'h9L&̀.NMVn 뼉f1,۰nv{l;6C̀qqr @cȪ^a~lsI4 -2M9-U鶨(+-B敉[ 2RZ?MCs`)FpdYOy;)ݻJf +(}NxJW)+{$Pm:sנ8M&S\MҠ(L-I-LFO^Ǿ ]ʨJ]c,,.-09AΞ*Fq2AU;Eßj u-L h$@F&S$yB7e) -@ROW$୧ gmsɬ0jgAVkpk#﬘_YXoOfc78lv.I|RS.FeФȯ&6wi Rbp:F1C^@qΆw-[Q_s #:U* Ru"qJ毃!@ԚOCTO^[(3%IV@bXW-Pc.*H:mbK@!()+k0A '6|5uW^/| =p)SU"GaM>˶tKfj tb֤+tS{mx -;s4,-Cq» ]<^3|UT[XqܥԔu)kidYbn:#:D`/z~NX8m//X0IyUw v]SDKP `"žQՖvOj̫RH tDPP +$V.aYY89-y\8"vy(gixe_+)^~ew2TTV_-k݅ψ%h;"<,I-eۧ뺗:a evǜ?ض |W_N$9552H/8 TGE? ƚ9q8S;bv;kekkom2ZXTJ;C7#I# kW&ݢT ը0{4 gPϵFM?ӷJ2cFqZ ?40 ˷Xv3Z!W *ifʼn~I }󽇍'mU\;t|kb>|z@΂MF gSP}?tdGxlE՞-u&KiQ!|\njkU #yx'? GYǤ)}F@)‹)O$!@oJM`zpb-GaYN V㮯!b;r(wo6v36qY0cFi|' E|p, d$_׸GEL-QnQb(k栫<d3~8ebHR }iػs>_i!LM gD+yR\e2})O \)ݚܝO;}W2 iͭ--?uXt,5|AҨ:'G-0Bc2oiCSZ,Nʨ>9dlY6gT!T)s\oISvh"PL pYN*&h,7pH0I\b-`8Xx*]Ia]wG/$'+9n On+(/MQnnFE>g+v(Qf}kR}(L?n63nfɫVJǡE\>Z [ ,`0 Y_nA3X!쥎Gfi!ƭ8$aQf7_eӰ↺.@FbDJS-Ujqw_HW"Ai*5^` 1  N ?Gy1(W?= 7Ro [ZQXV%mL]@]ngfdN{Lz̅ H̺4 k@{VpZꋱ1IcDXj$:C7opo"s^}.&WpNrII}P{^K;.Hvhj o.xxxź" y3k'k_̪o仙[$:X95vO: A]vu m!֎˴8ˠN[s= ڷ5!>\xcT9vE7\7pPB[zխS =睿rY$%CK뀾1xt_429IvbuWq ]W©hzi͸$FNTH!|v /qd(rSdxtJM`n'ע#zfiμGσCGxH@Mbip yby˃x>h8$B&þΙ{bl`P<6# Be`ږA#oӞ̧W\dԴ(S~tX/:E @RR΍I m®7 a&{Y=~q*>ldߑȔԨZqoqB@ONmeؕWLMͼ7(x({=SNcP9p;D.=K[x<1m8zBwݔ{릫Z\'ڭ l-bWۋv2wϴ6 }mׯNpv/NkgpklRǼ ^vMi@^ k(̢PvC]C8rص-tUʽu*1@c`}p_Cvsk@Y ުbC u=}'A37DZZn ifEz hGgѯq jb)Gk<jBw,Olge>E7H&JBYm'莾t,L)PGvr|ZvXuQZH;2'%SB*CޡwNu>ZP[H;&Xs\JQ_X߿Dsd1~E$?:uR}JPDc&UH;zӧ?*2AKur endstream endobj 32 0 obj <>stream 2021-09-02T17:09:00+02:00 2021-09-02T17:09:00+02:00 groff version 1.22.4 Untitled endstream endobj 2 0 obj <>endobj xref 0 33 0000000000 65535 f 0000007001 00000 n 0000025939 00000 n 0000006928 00000 n 0000006444 00000 n 0000000182 00000 n 0000002028 00000 n 0000007066 00000 n 0000008359 00000 n 0000017194 00000 n 0000007806 00000 n 0000011990 00000 n 0000007342 00000 n 0000009049 00000 n 0000007107 00000 n 0000007137 00000 n 0000006604 00000 n 0000002048 00000 n 0000004355 00000 n 0000007189 00000 n 0000007219 00000 n 0000006766 00000 n 0000004376 00000 n 0000006423 00000 n 0000007271 00000 n 0000007301 00000 n 0000009338 00000 n 0000012347 00000 n 0000017718 00000 n 0000007721 00000 n 0000008271 00000 n 0000008937 00000 n 0000024516 00000 n trailer << /Size 33 /Root 1 0 R /Info 2 0 R /ID [<467394913CAA9CEC3F0D472AF2314A53><467394913CAA9CEC3F0D472AF2314A53>] >> startxref 26093 %%EOF mrc-1.3.4/mrc-unit-test.cpp0000664000175000017500000000431214127025075015364 0ustar maartenmaarten#define BOOST_TEST_MODULE MRC_Test #include #include "mrsrc.h" BOOST_AUTO_TEST_CASE(test_1) { mrsrc::rsrc r1("resource-1.txt"); BOOST_ASSERT((bool)r1); BOOST_TEST(r1.data() != nullptr); BOOST_TEST(r1.size() == 50); int r = std::memcmp(r1.data(), R"(This is the first line And this is the second line)", r1.size()); BOOST_TEST(r == 0); } BOOST_AUTO_TEST_CASE(test_2) { mrsrc::rsrc r2("resource-2.txt"); BOOST_ASSERT((bool)r2); BOOST_TEST(r2.data() != nullptr); BOOST_TEST(r2.size() == 102); /* const char16_t* t = u"\xfeffThis is the first line\ And this is the second line"; // t[0] = 0xfeff; int r = std::memcmp(r2.data(), (char*)t, r2.size()); BOOST_TEST(r == 0); */ } BOOST_AUTO_TEST_CASE(test_3) { mrsrc::streambuf buf("resource-1.txt"); std::istream is(&buf); std::string line; BOOST_TEST((bool)std::getline(is, line)); BOOST_TEST(line == "This is the first line"); BOOST_TEST((bool)std::getline(is, line)); BOOST_TEST(line == "And this is the second line"); BOOST_TEST(not std::getline(is, line)); } BOOST_AUTO_TEST_CASE(test_4) { mrsrc::istream is("resource-1.txt"); std::string line; BOOST_TEST((bool)std::getline(is, line)); BOOST_TEST(line == "This is the first line"); BOOST_TEST((bool)std::getline(is, line)); BOOST_TEST(line == "And this is the second line"); BOOST_TEST(not std::getline(is, line)); } BOOST_AUTO_TEST_CASE(test_10) { mrsrc::rsrc r0(""); BOOST_TEST(std::distance(r0.begin(), r0.end()) == 3); std::set found; for (auto& r1: r0) found.insert(r1.name()); std::set kTest{"resource-1.txt", "resource-2.txt", "subdir"}; BOOST_TEST(found == kTest); if (found != kTest) { for (auto& f: found) std::cout << f << std::endl; } } BOOST_AUTO_TEST_CASE(test_11) { mrsrc::rsrc r0("subdir/resource-3.txt"); BOOST_TEST((bool)r0); mrsrc::istream is(r0); std::string line; BOOST_TEST((bool)std::getline(is, line)); BOOST_TEST(line == "Dit is resource 3"); } BOOST_AUTO_TEST_CASE(test_12) { mrsrc::rsrc r0("subdir/subsubdir/resource-4.txt"); BOOST_TEST((bool)r0); mrsrc::istream is(r0); std::string line; BOOST_TEST((bool)std::getline(is, line)); BOOST_TEST(line == "Dit is resource 4"); } mrc-1.3.4/mrc.10000664000175000017500000001472714127025075013023 0ustar maartenmaarten.TH mrc 1 "2020-09-11" "version 1.2.2" "User Commands" .if n .ad l .nh .SH NAME mrc \- A resource compiler .SH SYNOPSIS mrc [\fB-o\fR|\fB--output\fR outputfile] [\fB--root\fR arg] [\fB--resource-prefix\fR arg] [\fB--elf-machine\fR arg] [\fB--elf-class\fR arg] [\fB--elf-data\fR arg] [\fB--elf-abi\fR arg] [\fB--elf-flags\fR arg] file1 [file2...] .sp mrc [\fB-h\fR|\fB--help\fR] .sp mrc [\fB-v\fR|\fB--version\fR] .sp mrc [\fB--header\fR] > mrsrc.h .sp #include "mrsrc.h" void foo() { mrsrc::rsrc data("/alerts/text.txt"); if (data) { mrsrc::istream is(data); ... } } .SH DESCRIPTION Many applications come with supplementary data. This data is usually stored on disk as regular files. The disadvantage of this procedure is that an application cannot simply be copied to another location or computer and expected to function properly. .sp Resources are a way to overcome this problem by including all data inside the executable file. The mrc resource compiler can create object files containing both the data and an index. This data can then be accessed from within an application using .BR C++ classes. .SH OPTIONS .TP [\fB-o\fR|\fB--output\fR] file Specify the output file, the resulting file will be an object file you can link together with the rest of your object files into an executable file. .TP \fB--root\fR The resources are accessed using a path. You can specify the root part of the path using this parameter. .TP \fB--resource-prefix\fR name Use this option to specify another name for the global variables in the data section. .TP \fB--elf-machine\fR arg By default mrc assumes you want to create a resource file for the machine it runs on. But using this option you can create files for other architectures, useful when cross compiling. .sp The machine flag is used to specify the value of the \fIe_machine\fR field in the ELF header. .TP \fB--elf-class\fR number The ELF class to use, should be either \fI1\fR for 32-bit objects or \fI2\fR for 64-bit objects. .TP \fB--elf-data\fR number The ELF data endianness to use, should be either \fI1\fR for little-endian (=LSB) objects or \fI2\fR for big-endian (=MSB) objects. .TP \fB--elf-abi\fR number The ELF OS ABI flag to use, the exact value for this flag should be looked up in \fIelf.h\fR. Default is to use the value for the current architecture. (Value of 3 is for Linux, 9 is for FreeBSD). .TP \fB--elf-flags\fR number A value to store in the \fIe_flags\fR field of the ELF header. This can contain the EABI version for ARM e.g. .TP \fB--coff\fR type When this option is specified, a COFF file is created for use on Windows. The argument \fItype\fR should be one of \fBx64\fR, \fBx86\fR or \fBarm64\fR. .TP \fB--header\fR This option will print a \fBmrsrc.h\fR file to \fBstdout\fR which you can write to disk and use to access resources. .TP [\fB-v\fR|\fB--verbose\fR] Print debug output, useful to track where all data ends up in the resource. .TP \fB--version\fR Print version number and exit. .TP [\fB-h\fR|\fB--help\fR] Print simple help summary and exit. .TP file [file...] One or more files to include in the resource file. Directory names can be used as well. All regular files end up in the root of the resource tree, files found in directories end up in directies in the resource tree. The following rules apply: .sp Regular files are added in the root of the resource tree using their proper file name. .sp If the file name refers to a directory, the directory is traversed recursively and all files are added. If the file name ends with a forward slash (/) files are added to the root. If the file does not end with a slash, the name of the directory will be placed in the root and all contained files will be placed beneath this. .sp .SH EXAMPLES .PP Here's a list of usage cases. .TP mrc -o x.o my-resource.txt my-image.png Will create a resource file containing two resources accessible using the path "/my-resource.txt" and "/my-image.png" respectively. .TP mrc -o x.o img/my-image.png Will create a resource file containing a single resource accessible using the path "/my-image.png". .TP mrc -o x.o img/ Assuming there are two images in the directory img called my-image-1.png and my-image-2.png, the resource file will contain them both accessible under the name "/my-image-1.png" and "/my-image-1.png". .sp mrc -o x.o img Same as the previous, but note there's no trailing slash, the resource file will contain both images but they are now accessible under the name "/img/my-image-1.png" and "/img/my-image-1.png". .PP Use the verbose flag (\fB--verbose\fR) to track what ends up where. .SH DETAILS .sp The way this works is that mrc first collects all data from the files specified, including the files found in specified directories. An simple index is created to allow hierarchical access to the data. The data is then flattened into three data structures and these are written to the \fB.data\fR section of the object file. The three data blobs are then made available as globals in your application with the names \fBgResourceIndex\fR, \fBgResourceName\fR and \fBgResourceData\fR. You can specify the prefix part of this variable with the -fB--resource-prefix\fR option. .sp The index entries have the following format: struct rsrc_imp { unsigned int m_next; // index of the next sibling entry unsigned int m_child; // index of the first child entry unsigned int m_name; // offset of the name for this entry unsigned int m_size; // data size for this entry unsigned int m_data; // offset of the data for this entry }; .sp The classes in the \fBmrsrc.h\fR file are contained in the namespace \fBmrsrc\fR. The available classes are .TP \fBmrsrc::rsrc\fR This is the basic class to access data. It has a constructor that takes a path to a resource. Data can be accessed using the \fBdata\fR method and the size of the data is available via the \fBsize\fR method. If the resource was not found, \fBdata\fR will return \fBnullptr\fR and \fBsize\fR will return zero. You can also use \fBoperator bool\fR to check for valid data. .TP \fBmrsrc::streambuf\fR This class is derived from \fBstd::streambuf\fR. It can take both a \fBmrsrc::rsrc\fR or a path as constructor parameter. .sp .TP \fBmrsrc::istream\fR This class is derived from \fBstd::istream\fR. It can take both a \fBmrsrc::rsrc\fR or a path as constructor parameter. .SH BUGS This application can only generate ELF formatted object files. .sp Only a single resource entry can be generated and there's no way to merge or manipulate resource files yet. mrc-1.3.4/mrc.cpp0000664000175000017500000007456414127025075013452 0ustar maartenmaarten/*- * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2017-2021 Maarten L. Hekkelman * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ // // mrc, A simple resource compiler. // // Use this program to make data available to your program without // having to distribute this data in separate files. // // Example usage: mrc -o myrsrc.o rsrc/ // // This will create an object file called myrsrs.o containing the data for all file found in the rsrc/ directory. #include "mrc.h" #include #include #include #if __has_include() #include #elif not defined(EM_NONE) #define EM_NONE 0 #endif #include #include #include #include #include "mrsrc.h" #ifndef PATH_MAX #define PATH_MAX 1024 #endif namespace po = boost::program_options; namespace fs = std::filesystem; int VERBOSE = 0; // -------------------------------------------------------------------- uint32_t AddNameToNameTable(std::string &ioNameTable, const std::string &inName) { uint32_t result = 0; const char *p = ioNameTable.c_str(); const char *e = p + ioNameTable.length(); while (p < e) { if (inName == p) { result = p - ioNameTable.c_str(); break; } p += strlen(p) + 1; } if (p >= e) { result = ioNameTable.length(); ioNameTable.append(inName); ioNameTable.append("\0", 1); } return result; } // -------------------------------------------------------------------- struct MObjectFileImp { fs::path mFile; uint32_t mTextSize; uint32_t mDataSize; virtual ~MObjectFileImp() {} virtual void Write(std::ofstream &inFile) = 0; static MObjectFileImp *Create(int machine, int elf_class, int elf_data, int elf_abi, int flags); protected: friend class MObjectFile; struct MGlobal { std::string name; std::string data; }; typedef std::vector MGlobals; MGlobals mGlobals; }; // -------------------------------------------------------------------- // byte swapping namespace Swap { struct no_swapper { template T operator()(T inValue) const { return inValue; } }; struct swapper { template T operator()(T inValue) const { return inValue; } }; template <> inline int16_t swapper::operator()(int16_t inValue) const { return static_cast( ((inValue & 0xFF00UL) >> 8) | ((inValue & 0x00FFUL) << 8)); } template <> inline uint16_t swapper::operator()(uint16_t inValue) const { return static_cast( ((inValue & 0xFF00UL) >> 8) | ((inValue & 0x00FFUL) << 8)); } template <> inline int32_t swapper::operator()(int32_t inValue) const { return static_cast( ((inValue & 0xFF000000UL) >> 24) | ((inValue & 0x00FF0000UL) >> 8) | ((inValue & 0x0000FF00UL) << 8) | ((inValue & 0x000000FFUL) << 24)); } template <> inline uint32_t swapper::operator()(uint32_t inValue) const { return static_cast( ((inValue & 0xFF000000UL) >> 24) | ((inValue & 0x00FF0000UL) >> 8) | ((inValue & 0x0000FF00UL) << 8) | ((inValue & 0x000000FFUL) << 24)); } template <> inline int64_t swapper::operator()(int64_t inValue) const { return static_cast( (((static_cast(inValue)) << 56) & 0xFF00000000000000ULL) | (((static_cast(inValue)) << 40) & 0x00FF000000000000ULL) | (((static_cast(inValue)) << 24) & 0x0000FF0000000000ULL) | (((static_cast(inValue)) << 8) & 0x000000FF00000000ULL) | (((static_cast(inValue)) >> 8) & 0x00000000FF000000ULL) | (((static_cast(inValue)) >> 24) & 0x0000000000FF0000ULL) | (((static_cast(inValue)) >> 40) & 0x000000000000FF00ULL) | (((static_cast(inValue)) >> 56) & 0x00000000000000FFULL)); } template <> inline uint64_t swapper::operator()(uint64_t inValue) const { return static_cast( ((((uint64_t)inValue) << 56) & 0xFF00000000000000ULL) | ((((uint64_t)inValue) << 40) & 0x00FF000000000000ULL) | ((((uint64_t)inValue) << 24) & 0x0000FF0000000000ULL) | ((((uint64_t)inValue) << 8) & 0x000000FF00000000ULL) | ((((uint64_t)inValue) >> 8) & 0x00000000FF000000ULL) | ((((uint64_t)inValue) >> 24) & 0x0000000000FF0000ULL) | ((((uint64_t)inValue) >> 40) & 0x000000000000FF00ULL) | ((((uint64_t)inValue) >> 56) & 0x00000000000000FFULL)); } #if defined(LITTLE_ENDIAN) typedef no_swapper lsb_swapper; typedef swapper msb_swapper; #elif defined(BIG_ENDIAN) typedef swapper lsb_swapper; typedef no_swapper msb_swapper; #else #error Undefined endianness #endif } // namespace Swap // -------------------------------------------------------------------- // Write data aligned to some alignment value uint32_t WriteDataAligned(std::ofstream &inStream, const void *inData, uint32_t inSize, uint32_t inAlignment = 1) { inStream.write(reinterpret_cast(inData), inSize); if (inAlignment > 1) { while ((inStream.tellp() % inAlignment) != 0) inStream.put('\0'); } return inStream.tellp(); } // -------------------------------------------------------------------- // // Implementation for ELF #if __has_include() template struct ElfClass; template <> struct ElfClass { using Elf_Ehdr = Elf32_Ehdr; using Elf_Shdr = Elf32_Shdr; using Elf_Sym = Elf32_Sym; using Elf_Word = Elf64_Word; using Elf_Half = Elf64_Half; }; template <> struct ElfClass { using Elf_Ehdr = Elf64_Ehdr; using Elf_Shdr = Elf64_Shdr; using Elf_Sym = Elf64_Sym; using Elf_Word = Elf64_Word; using Elf_Half = Elf64_Half; }; template struct ElfData; template <> struct ElfData { using swapper = Swap::msb_swapper; }; template <> struct ElfData { using swapper = Swap::lsb_swapper; }; template struct MELFObjectFileImp : public MObjectFileImp { using swapper = typename ElfData::swapper; using Elf_Ehdr = typename ElfClass::Elf_Ehdr; using Elf_Shdr = typename ElfClass::Elf_Shdr; using Elf_Sym = typename ElfClass::Elf_Sym; using Elf_Word = typename ElfClass::Elf_Word; using Elf_Half = typename ElfClass::Elf_Half; virtual void Write(std::ofstream &inFile) override; MELFObjectFileImp(int machine, uint8_t elf_abi, int flags) : MObjectFileImp() , mMachine(machine) , mABI(elf_abi) , mFlags(flags) { } Elf_Half mMachine; uint8_t mABI; Elf_Word mFlags; }; enum { kNullSection, kTextSection, kDataSection, kBssSection, kShStrtabSection, kSymtabSection, kStrtabSection, kSectionCount }; enum { kNullSymbol, kTextSectionSymbol, kDataSectionSymbol, kBssSectionSymbol, kGlobalSymbol, kSymbolCount }; template void MELFObjectFileImp::Write(std::ofstream &f) { Elf_Ehdr eh = { // e_ident {ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3, ELF_CLASS, ELF_DATA, EV_CURRENT, mABI}, ET_REL, // e_type mMachine, // e_machine EV_CURRENT, // e_version 0, // e_entry 0, // e_phoff 0, // e_shoff mFlags, // e_flags sizeof(Elf_Ehdr), // e_ehsize 0, // e_phentsize 0, // e_phnum sizeof(Elf_Shdr), // e_shentsize kSectionCount, // e_shnum kShStrtabSection // e_shstrndx }; uint32_t data_offset = WriteDataAligned(f, &eh, sizeof(eh), 16); std::string strtab; AddNameToNameTable(strtab, ""); // null name Elf_Sym sym = {}; std::vector syms; // kNullSymbol syms.push_back(sym); // text section symbol sym.st_info = ELF32_ST_INFO(STB_LOCAL, STT_SECTION); sym.st_shndx = kTextSection; syms.push_back(sym); // data section symbol sym.st_info = ELF32_ST_INFO(STB_LOCAL, STT_SECTION); sym.st_shndx = kDataSection; syms.push_back(sym); // bss section symbol sym.st_info = ELF32_ST_INFO(STB_LOCAL, STT_SECTION); sym.st_shndx = kBssSection; syms.push_back(sym); uint32_t sym_offset = data_offset; for (const auto &[name, data] : mGlobals) { sym.st_name = AddNameToNameTable(strtab, name); sym.st_value = sym_offset - data_offset; sym.st_size = data.length(); sym.st_info = ELF32_ST_INFO(STB_GLOBAL, STT_OBJECT); sym.st_shndx = kDataSection; syms.push_back(sym); sym_offset = WriteDataAligned(f, data.c_str(), data.length(), 8); } uint32_t data_size = sym_offset; uint32_t symtab_off = sym_offset; assert((sizeof(Elf_Sym) % 8) == 0); uint32_t symtab_size = syms.size() * sizeof(sym); uint32_t strtab_off = WriteDataAligned(f, syms.data(), symtab_size, 8); uint32_t shstrtab_off = WriteDataAligned(f, strtab.c_str(), strtab.length(), 8); std::string shstrtab; (void)AddNameToNameTable(shstrtab, ""); // null name (void)AddNameToNameTable(shstrtab, ".text"); (void)AddNameToNameTable(shstrtab, ".rsrc_data"); (void)AddNameToNameTable(shstrtab, ".bss"); (void)AddNameToNameTable(shstrtab, ".shstrtab"); (void)AddNameToNameTable(shstrtab, ".symtab"); (void)AddNameToNameTable(shstrtab, ".strtab"); eh.e_shoff = WriteDataAligned(f, shstrtab.c_str(), shstrtab.length(), 16); Elf_Shdr sh[kSectionCount] = { { // kNullSection }, { // kTextSection // sh_name AddNameToNameTable(shstrtab, ".text"), SHT_PROGBITS, // sh_type // sh_flags SHF_ALLOC | SHF_EXECINSTR, 0, // sh_addr data_offset, // sh_offset 0, // sh_size 0, // sh_link 0, // sh_info 4, // sh_addralign 0 // sh_entsize }, { // kDataSection // sh_name AddNameToNameTable(shstrtab, ".rsrc_data"), SHT_PROGBITS, // sh_type // sh_flags SHF_ALLOC | SHF_WRITE, 0, // sh_addr data_offset, // sh_offset data_size, // sh_size 0, // sh_link 0, // sh_info 4, // sh_addralign 0 // sh_entsize }, { // kBssSection // sh_name AddNameToNameTable(shstrtab, ".bss"), SHT_NOBITS, // sh_type // sh_flags SHF_ALLOC | SHF_WRITE, 0, // sh_addr eh.e_shoff, // sh_offset 0, // sh_size 0, // sh_link 0, // sh_info 4, // sh_addralign 0 // sh_entsize }, { // kShStrtabSection // sh_name AddNameToNameTable(shstrtab, ".shstrtab"), SHT_STRTAB, // sh_type 0, // sh_flags 0, // sh_addr shstrtab_off, // sh_offset Elf32_Word(shstrtab.length()), // sh_size 0, // sh_link 0, // sh_info 1, // sh_addralign 0 // sh_entsize }, { // kSymtabSection // sh_name AddNameToNameTable(shstrtab, ".symtab"), SHT_SYMTAB, // sh_type // sh_flags 0, 0, // sh_addr symtab_off, // sh_offset symtab_size, // sh_size 6, // sh_link kGlobalSymbol, // sh_info 8, // sh_addralign sizeof(Elf_Sym) // sh_entsize }, { // kStrtabSection // sh_name AddNameToNameTable(shstrtab, ".strtab"), SHT_STRTAB, // sh_type // sh_flags 0, 0, // sh_addr strtab_off, // sh_offset Elf32_Word(strtab.length()), // sh_size 0, // sh_link 0, // sh_info 1, // sh_addralign 0 // sh_entsize }, }; WriteDataAligned(f, sh, sizeof(sh), 1); f.flush(); f.seekp(0); WriteDataAligned(f, &eh, sizeof(eh)); } #endif // -------------------------------------------------------------------- // PE/COFF enum COFF_Machine : uint16_t { IMAGE_FILE_MACHINE_AMD64 = 0x8664, IMAGE_FILE_MACHINE_I386 = 0x14c, IMAGE_FILE_MACHINE_ARM64 = 0xaa64 }; enum COFF_HeaderCharacteristics : uint16_t { IMAGE_FILE_RELOCS_STRIPPED = 0x0001, IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004 }; struct COFF_Header { COFF_Machine machine = IMAGE_FILE_MACHINE_AMD64; uint16_t numberOfSections; uint32_t timeDateStamp = 0; uint32_t pointerToSymbolTable; uint32_t numberOfSymbols; uint16_t sizeOfOptionalHeader; uint16_t characteristics = 0; }; union COFF_Name { char str[8] = ""; struct { uint32_t _filler_; uint32_t offset; }; }; static_assert(sizeof(COFF_Header) == 20, "COFF_Header size should be 20 bytes"); enum COFF_SectionHeaderCharacteristics : uint32_t { IMAGE_SCN_CNT_CODE = 0x00000020, IMAGE_SCN_LNK_INFO = 0x00000200, IMAGE_SCN_LNK_REMOVE = 0x00000800, IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040, IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080, IMAGE_SCN_ALIGN_1BYTES = 0x00100000, IMAGE_SCN_ALIGN_8BYTES = 0x00400000, IMAGE_SCN_ALIGN_16BYTES = 0x00500000, IMAGE_SCN_MEM_EXECUTE = 0x20000000, IMAGE_SCN_MEM_READ = 0x40000000, IMAGE_SCN_MEM_WRITE = 0x80000000 }; struct COFF_SectionHeader { COFF_Name name; uint32_t virtualSize; uint32_t virtualAddress; uint32_t sizeOfRawData; uint32_t pointerToRawData; uint32_t pointerToRelocations; uint32_t pointerToLineNumbers; uint16_t numberOfRelocations; uint16_t numberOfLineNumbers; uint32_t characteristics; }; static_assert(sizeof(COFF_SectionHeader) == 40, "Section headers should be 40 bytes"); enum COFF_StorageClass : uint8_t { IMAGE_SYM_CLASS_EXTERNAL = 0x02, IMAGE_SYM_CLASS_STATIC = 0x03, IMAGE_SYM_CLASS_FILE = 0x67 }; /// \brief COFF symbol table entry, should be 18 bytes... right... struct COFF_Symbol { COFF_Name name; uint32_t value; int16_t sectionNumber; uint16_t type; uint8_t storageClass; uint8_t numberOfAuxSymbols; uint16_t _filler_; }; static_assert(sizeof(COFF_Symbol) == 20, "Symbols should be 18 bytes, plus that filler of 2 bytes which is not written..."); struct COFF_Relocation { uint32_t virtualAddress; uint32_t symbolTableIndex; uint16_t type; }; // -------------------------------------------------------------------- struct MCOFFObjectFileImp : public MObjectFileImp { using swapper = Swap::lsb_swapper; virtual void Write(std::ofstream &inFile) override; MCOFFObjectFileImp(COFF_Machine machine) : MObjectFileImp() , mMachine(machine) { } COFF_Machine mMachine; }; void MCOFFObjectFileImp::Write(std::ofstream &f) { // Start by allocating a header COFF_Header header = { mMachine, // machine 0, // numberOfSections 0, // timeDateStamp 0, // pointerToSymbolTable 0, // numberOfSymbols 0, // sizeOfOptionalHeader 0, // characteristics }; std::string strtab; auto addName = [&strtab](const std::string &name) { COFF_Name result{}; if (name.length() <= 8) name.copy(result.str, name.length()); else result.offset = 4 + AddNameToNameTable(strtab, name); return result; }; auto sectionHeaderStart = WriteDataAligned(f, &header, sizeof(header), 1); COFF_SectionHeader sectionHeaders[] = { { addName(".rdata"), // name 0, // virtualSize 0, // virtualAddress 0, // sizeOfRawData 0, // pointerToRawData 0, // pointerToRelocations 0, // pointerToLineNumbers 0, // numberOfRelocations 0, // numberOfLineNumbers IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_8BYTES | IMAGE_SCN_MEM_READ // characteristics }, { addName(".rdata$z"), // name 0, // virtualSize 0, // virtualAddress 0, // sizeOfRawData 0, // pointerToRawData 0, // pointerToRelocations 0, // pointerToLineNumbers 0, // numberOfRelocations 0, // numberOfLineNumbers IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_1BYTES | IMAGE_SCN_MEM_READ // characteristics } }; std::vector symbols{}; auto rawDataOffset = WriteDataAligned(f, sectionHeaders, sizeof(sectionHeaders)); auto offset = rawDataOffset; for (const auto &[name, data] : mGlobals) { symbols.emplace_back( COFF_Symbol{ addName(name), offset - rawDataOffset, 1, 0, IMAGE_SYM_CLASS_EXTERNAL}); offset = WriteDataAligned(f, data.data(), data.size()); } auto dataSize = offset - rawDataOffset; auto padding = 8 - dataSize % 8; if (padding == 8) padding = 0; auto rawDataSize = dataSize + padding; auto rawData2Offset = WriteDataAligned(f, std::string('\0', 8).data(), padding); offset = WriteDataAligned(f, PACKAGE_STRING, sizeof(PACKAGE_STRING)); auto rawData2Size = offset - rawData2Offset; auto symbolTableOffset = offset; // We can now fill in the blanks sectionHeaders[0].pointerToRawData = rawDataOffset; sectionHeaders[0].sizeOfRawData = rawDataSize; sectionHeaders[1].pointerToRawData = rawData2Offset; sectionHeaders[1].sizeOfRawData = rawData2Size; // create the rest of the symbols symbols.emplace_back( COFF_Symbol{ addName(".rdata"), 0, 1, 0, IMAGE_SYM_CLASS_STATIC, 1}); COFF_Name n1{}; n1._filler_ = dataSize; symbols.emplace_back(COFF_Symbol{ n1 }); symbols.emplace_back( COFF_Symbol{ addName(".rdata$z"), 0, 2, 0, IMAGE_SYM_CLASS_STATIC, 1}); COFF_Name n2{}; n2._filler_ = dataSize; symbols.emplace_back(COFF_Symbol{ n2 }); for (auto& sym: symbols) WriteDataAligned(f, &sym, 18); uint32_t strTabSize = strtab.size() + 4; WriteDataAligned(f, &strTabSize, sizeof(strTabSize)); WriteDataAligned(f, strtab.data(), strtab.size() + 1); // write section headers f.seekp(sectionHeaderStart); WriteDataAligned(f, sectionHeaders, sizeof(sectionHeaders)); // Write header f.seekp(0); header.numberOfSections = sizeof(sectionHeaders) / sizeof(COFF_SectionHeader); header.pointerToSymbolTable = symbolTableOffset; header.numberOfSymbols = symbols.size(); WriteDataAligned(f, &header, sizeof(header)); } // -------------------------------------------------------------------- #if __has_include() MObjectFileImp *MObjectFileImp::Create(int machine, int elf_class, int elf_data, int elf_abi, int flags) { MObjectFileImp *result = nullptr; if (elf_class == ELFCLASS32 and elf_data == ELFDATA2LSB) result = new MELFObjectFileImp(machine, elf_abi, flags); else if (elf_class == ELFCLASS32 and elf_data == ELFDATA2MSB) result = new MELFObjectFileImp(machine, elf_abi, flags); else if (elf_class == ELFCLASS64 and elf_data == ELFDATA2LSB) result = new MELFObjectFileImp(machine, elf_abi, flags); else if (elf_class == ELFCLASS64 and elf_data == ELFDATA2MSB) result = new MELFObjectFileImp(machine, elf_abi, flags); else { std::cerr << "Unsupported ELF class and/or data" << std::endl; exit(1); } return result; } #endif // -------------------------------------------------------------------- class MObjectFile { public: #if __has_include() MObjectFile(int machine, int elf_class, int elf_data, int elf_abi, int flags) : mImpl(MObjectFileImp::Create(machine, elf_class, elf_data, elf_abi, flags)) { } #endif MObjectFile(COFF_Machine machine) : mImpl(new MCOFFObjectFileImp(machine)) { } ~MObjectFile(); void AddGlobal(const std::string &inName, const void *inData, uint32_t inSize); void Write(std::ofstream &inFile); private: MObjectFileImp *mImpl; }; MObjectFile::~MObjectFile() { delete mImpl; } void MObjectFile::AddGlobal(const std::string &inName, const void *inData, uint32_t inSize) { MObjectFileImp::MGlobal g; g.name = inName; g.data.assign(reinterpret_cast(inData), inSize); mImpl->mGlobals.push_back(g); } void MObjectFile::Write(std::ofstream &inFile) { if (mImpl == nullptr) throw std::runtime_error("nullptr error"); mImpl->Write(inFile); } // -------------------------------------------------------------------- class MResourceFile { public: MResourceFile(const std::string &prefix) : mPrefix(prefix) { mIndex.push_back({}); mName.push_back(0); } void Write(MObjectFile& objFile); void Add(const fs::path &inPath, const fs::path &inFile); private: void AddEntry(fs::path inPath, const char *inData, uint32_t inSize); std::vector mIndex; std::vector mData, mName; std::string mPrefix; }; void MResourceFile::AddEntry(fs::path inPath, const char *inData, uint32_t inSize) { uint32_t node = 0; // start at root for (fs::path::iterator p = inPath.begin(); p != inPath.end(); ++p) { if (*p == ".") // flatten continue; // no such child? Add it and continue if (mIndex[node].m_child == 0) { mrsrc::rsrc_imp child = {}; child.m_name = mName.size(); std::string n = p->string(); copy(n.begin(), n.end(), std::back_inserter(mName)); mName.push_back(0); mIndex[node].m_child = mIndex.size(); mIndex.push_back(child); node = mIndex[node].m_child; continue; } // lookup the path element in the current directory uint32_t next = mIndex[node].m_child; for (;;) { const char *name = mName.data() + mIndex[next].m_name; // if this is the one we're looking for, break out of the loop if (*p == name) { node = next; break; } // if there is a next element, loop if (mIndex[next].m_next != 0) { next = mIndex[next].m_next; continue; } // not found, create it mrsrc::rsrc_imp n = {}; n.m_name = mName.size(); std::string s = p->string(); copy(s.begin(), s.end(), back_inserter(mName)); mName.push_back(0); node = mIndex.size(); mIndex[next].m_next = node; mIndex.push_back(n); break; } } assert(node != 0); assert(node < mIndex.size()); mIndex[node].m_size = inSize; mIndex[node].m_data = mData.size(); copy(inData, inData + inSize, back_inserter(mData)); while ((mData.size() % 8) != 0) mData.push_back('\0'); } void MResourceFile::Add(const fs::path &inPath, const fs::path &inFile) { if (fs::is_directory(inFile)) { fs::path ns = inPath / inFile.filename(); fs::path cwd = fs::current_path(); fs::current_path(inFile); for (auto i = fs::directory_iterator(fs::current_path()); i != fs::directory_iterator(); ++i) Add(ns, i->path().filename()); fs::current_path(cwd); } else { if (VERBOSE) std::cerr << "adding " << inFile << " as " << inPath / inFile.filename() << std::endl; std::ifstream f(inFile, std::ios::binary); if (not f.is_open()) throw std::runtime_error("Could not open data file"); std::filebuf *b = f.rdbuf(); uint32_t size = b->pubseekoff(0, std::ios::end, std::ios::in); b->pubseekoff(0, std::ios::beg, std::ios::in); std::vector text(size); b->sgetn(text.data(), size); f.close(); AddEntry(inPath / inFile.filename(), text.data(), size); } } void MResourceFile::Write(MObjectFile& obj) { obj.AddGlobal(mPrefix + "Index", mIndex.data(), mIndex.size() * sizeof(mrsrc::rsrc_imp)); obj.AddGlobal(mPrefix + "Data", mData.data(), mData.size()); obj.AddGlobal(mPrefix + "Name", mName.data(), mName.size()); } // -------------------------------------------------------------------- int main(int argc, char *argv[]) { try { po::options_description visible_options("mrc " PACKAGE_VERSION " options file1 [file2...]"); visible_options.add_options() ( "help,h", "Display help message" ) ( "version", "Print version" ) ( "output,o", po::value(), "Output file, this file is in the default object file format for this OS." ) ( "header", "This will print out the header file you need to include in your program to access your resources" ) ( "root", po::value(), "Root path for the stored data (in the final resource data structure" ) ( "resource-prefix", po::value()->default_value("gResource"), "Prefix for the name of the global variables, default is gResource" ) #if __has_include() ( "elf-machine", po::value(), "The ELF machine type to use, default is same as this machine. Use one of the values from elf.h" ) ( "elf-class", po::value(), "ELF class, default is same as this machine. Acceptable values are 1 (32bit) and 2 (64bit)." ) ( "elf-data", po::value(), "ELF endianness, default is same as this machine. Acceptable values are 1 (little-endian, LSB) and 2 (big-endian, MSB)." ) ( "elf-abi", po::value(), "ELF OS ABI value, see file elf.h for values (linux = 3, freebsd = 9)" ) ( "elf-flags", po::value(), "Processor specific flags in the ELF header, e.g. the EABI version for ARM" ) #endif ( "coff", po::value(), "Write a PE/COFF file for Windows, values should be one of x64, x86 or arm64" ) ( "verbose,v", "Verbose output") ; po::options_description hidden_options("hidden options"); hidden_options.add_options() ( "input,i", po::value>(), "Input files"); po::options_description cmdline_options; cmdline_options.add(visible_options).add(hidden_options); po::positional_options_description p; p.add("input", -1); po::variables_map vm; po::store(po::command_line_parser(argc, argv).options(cmdline_options).positional(p).run(), vm); po::notify(vm); if (vm.count("version")) { std::cout << PACKAGE_NAME << " version " PACKAGE_VERSION << std::endl; exit(0); } if (vm.count("header")) { mrsrc::rsrc data("mrsrc.h"); std::string text(data.data(), data.size()); if (vm.count("output")) { std::ofstream file(vm["output"].as(), std::ios::binary); if (not file.is_open()) throw std::runtime_error("Could not open output file for writing"); file << text << std::endl; } else std::cout << text << std::endl; exit(0); } if (vm.count("help") or vm.count("input") == 0) { std::cerr << visible_options << std::endl << "See man mrc for more help" << std::endl; exit(vm.count("help") == 0); } if (vm.count("verbose")) VERBOSE = 1; std::string ns; if (vm.count("root")) ns = vm["root"].as(); // -------------------------------------------------------------------- // find out the native format. Simply look at how we were assembled ourselves int elf_machine = EM_NONE, elf_class = 0, elf_data = 0, elf_flags = 0, elf_abi = 0; #if __linux or __linux__ elf_abi = ELFOSABI_LINUX; #elif __FreeBSD__ elf_abi = ELFOSABI_FREEBSD; #endif #if not defined(_MSC_VER) char exePath[PATH_MAX + 1]; int r = readlink("/proc/self/exe", exePath, PATH_MAX); if (r > 0) { exePath[r] = 0; int fd = open(exePath, O_RDONLY); if (fd >= 0) { unsigned char e_ident[16]; if (read(fd, e_ident, sizeof(e_ident)) == sizeof(e_ident) and e_ident[EI_MAG0] == ELFMAG0 and e_ident[EI_MAG1] == ELFMAG1 and e_ident[EI_MAG2] == ELFMAG2 and e_ident[EI_MAG3] == ELFMAG3) { // Yes, we're an ELF! elf_class = e_ident[EI_CLASS]; elf_data = e_ident[EI_DATA]; if (e_ident[EI_ABIVERSION]) elf_abi = e_ident[EI_ABIVERSION]; lseek(fd, 0, SEEK_SET); switch (elf_class) { case ELFCLASS32: { Elf32_Ehdr hdr; if (read(fd, &hdr, sizeof(hdr)) == sizeof(Elf32_Ehdr)) { elf_machine = hdr.e_machine; elf_flags = hdr.e_flags; } break; } case ELFCLASS64: { Elf64_Ehdr hdr; if (read(fd, &hdr, sizeof(hdr)) == sizeof(Elf64_Ehdr)) { elf_machine = hdr.e_machine; elf_flags = hdr.e_flags; } break; } default: std::cerr << "Unknown ELF class" << std::endl; } } } } #endif std::string prefix = vm["resource-prefix"].as(); MResourceFile rsrcFile(prefix); for (fs::path i : vm["input"].as>()) rsrcFile.Add(ns, i); std::ofstream file(vm["output"].as(), std::ios::binary); if (not file.is_open()) throw std::runtime_error("Could not open output file for writing"); COFF_Machine win_machine = {}; #if defined(_MSC_VER) #if defined(_M_AMD64) win_machine = IMAGE_FILE_MACHINE_AMD64; #elif defined(_M_ARM64) win_machine = IMAGE_FILE_MACHINE_ARM64; #elif defined(_M_IX86) win_machine = IMAGE_FILE_MACHINE_I386; #endif #endif if (vm.count("coff")) { if (vm["coff"].as() == "x64") win_machine = IMAGE_FILE_MACHINE_AMD64; else if (vm["coff"].as() == "arm64") win_machine = IMAGE_FILE_MACHINE_ARM64; else if (vm["coff"].as() == "x86") win_machine = IMAGE_FILE_MACHINE_I386; else throw std::runtime_error("Unsupported machine for COFF: " + vm["coff"].as()); } bool target_elf = vm.count("elf-machine") and vm.count("elf-class") and vm.count("elf-data") and vm.count("elf-flags"); if (vm.count("elf-machine")) elf_machine = vm["elf-machine"].as(); if (vm.count("elf-class")) elf_class = vm["elf-class"].as(); if (vm.count("elf-data")) elf_data = vm["elf-data"].as(); if (vm.count("elf-abi")) elf_abi = vm["elf-abi"].as(); if (vm.count("elf-flags")) elf_flags = vm["elf-flags"].as(); if (win_machine and not target_elf) { MObjectFile obj(win_machine); rsrcFile.Write(obj); obj.Write(file); } else #if __has_include() { MObjectFile obj(elf_machine, elf_class, elf_data, elf_abi, elf_flags); rsrcFile.Write(obj); obj.Write(file); } #else throw std::runtime_error("Could not create resource file, probably you're trying to create a ELF resource file on Windows?"); #endif } catch (const std::exception &ex) { std::cerr << "Error executing mrc: " << ex.what() << std::endl; exit(1); } return 0; } mrc-1.3.4/mrc.h.in0000664000175000017500000000041514127025075013504 0ustar maartenmaarten/* Define to the name of this package. */ #cmakedefine PACKAGE_NAME "@PACKAGE_NAME@" /* Define to the version of this package. */ #cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@" /* Define the complete package string */ #cmakedefine PACKAGE_STRING "@PACKAGE_STRING@" mrc-1.3.4/mrsrc.h0000664000175000017500000002276314127025075013456 0ustar maartenmaarten/*- * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2006-2020 Maarten L. Hekkelman * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #include #include #include #include #include #include /* Resources are data sources for the application. They are retrieved by name. Basic usage: mrsrc::rsrc rsrc("dialogs/my-cool-dialog.glade"); if (rsrc) { GladeXML* glade = glade_xml_new_from_buffer(rsrc.data(), rsrc.size(), NULL, "japi"); ... } Alternative, to loop over all resources: mrsrc rsrc; // <- the root resource for (rsrc child: rsrc) std::cout << child.name() << std::endl; ------------------------------------------------- Stream interface: mrsrc::streambuf rb("data/my-text.txt"); std::istream is(&rb); std::string line; while (std::gettline(is, line)) std::cout << line << std::endl; */ namespace mrsrc { /// \brief Internal data structure as generated by mrc struct rsrc_imp { unsigned int m_next; unsigned int m_child; unsigned int m_name; unsigned int m_size; unsigned int m_data; }; } // namespace mrsrc // The following three variables are generated by mrc: extern "C" const mrsrc::rsrc_imp gResourceIndex[]; extern "C" const char gResourceData[]; extern "C" const char gResourceName[]; namespace mrsrc { /// \brief Class mrsrc::rsrc contains a pointer to the data in the /// resource, as well as offering an iterator interface to its /// children. class rsrc { public: rsrc() : m_impl(gResourceIndex) {} rsrc(const rsrc& other) : m_impl(other.m_impl) {} rsrc& operator=(const rsrc& other) { m_impl = other.m_impl; return *this; } rsrc(std::filesystem::path path); std::string name() const { return gResourceName + m_impl->m_name; } const char* data() const { return gResourceData + m_impl->m_data; } unsigned long size() const { return m_impl->m_size; } explicit operator bool() const { return m_impl != nullptr and m_impl->m_size > 0; } template class iterator_t { public: using iterator_category = std::input_iterator_tag; using value_type = RSRC; using difference_type = std::ptrdiff_t; using pointer = value_type*; using reference = value_type&; iterator_t(const rsrc_imp* cur) : m_cur(cur) {} iterator_t(const iterator_t& i) : m_cur(i.m_cur) { } iterator_t& operator=(const iterator_t& i) { m_cur = i.m_cur; return *this; } reference operator*() { return m_cur; } pointer operator->() { return& m_cur; } iterator_t& operator++() { if (m_cur.m_impl->m_next) m_cur.m_impl = gResourceIndex + m_cur.m_impl->m_next; else m_cur.m_impl = nullptr; return *this; } iterator_t operator++(int) { auto tmp(*this); this->operator++(); return tmp; } bool operator==(const iterator_t& rhs) const { return m_cur.m_impl == rhs.m_cur.m_impl; } bool operator!=(const iterator_t& rhs) const { return m_cur.m_impl != rhs.m_cur.m_impl; } private: value_type m_cur; }; using iterator = iterator_t; iterator begin() const { const rsrc_imp* impl = nullptr; if (m_impl and m_impl->m_child) impl = gResourceIndex + m_impl->m_child; return iterator(impl); } iterator end() const { return iterator(nullptr); } private: rsrc(const rsrc_imp* imp) : m_impl(imp) {} const rsrc_imp *m_impl; }; inline rsrc::rsrc(std::filesystem::path p) { m_impl = gResourceIndex; // using std::filesytem::path would have been natural here of course... auto pb = p.begin(); auto pe = p.end(); while (m_impl != nullptr and pb != pe) { auto name = *pb++; const rsrc_imp* impl = nullptr; for (rsrc child: *this) { if (child.name() == name) { impl = child.m_impl; break; } } m_impl = impl; } if (pb != pe) // not found m_impl = nullptr; } // -------------------------------------------------------------------- template class basic_streambuf : public std::basic_streambuf { public: typedef CharT char_type; typedef Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; /// \brief constructor taking a \a path to the resource in memory basic_streambuf(const std::string& path) : m_rsrc(path) { init(); } /// \brief constructor taking a \a rsrc basic_streambuf(const rsrc& rsrc) : m_rsrc(rsrc) { init(); } basic_streambuf(const basic_streambuf&) = delete; basic_streambuf(basic_streambuf&& rhs) : basic_streambuf(rhs.m_rsrc) { } basic_streambuf& operator=(const basic_streambuf&) = delete; basic_streambuf& operator=(basic_streambuf&& rhs) { swap(rhs); return *this; } void swap(basic_streambuf& rhs) { std::swap(m_begin, rhs.m_begin); std::swap(m_end, rhs.m_end); std::swap(m_current, rhs.m_current); } private: void init() { m_begin = reinterpret_cast(m_rsrc.data()); m_end = reinterpret_cast(m_rsrc.data() + m_rsrc.size()); m_current = m_begin; } int_type underflow() { if (m_current == m_end) return traits_type::eof(); return traits_type::to_int_type(*m_current); } int_type uflow() { if (m_current == m_end) return traits_type::eof(); return traits_type::to_int_type(*m_current++); } int_type pbackfail(int_type ch) { if (m_current == m_begin or (ch != traits_type::eof() and ch != m_current[-1])) return traits_type::eof(); return traits_type::to_int_type(*--m_current); } std::streamsize showmanyc() { assert(std::less_equal()(m_current, m_end)); return m_end - m_current; } pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which) { switch (dir) { case std::ios_base::beg: m_current = m_begin + off; break; case std::ios_base::end: m_current = m_end + off; break; case std::ios_base::cur: m_current += off; break; default: break; } if (m_current < m_begin) m_current = m_begin; if (m_current > m_end) m_current = m_end; return m_current - m_begin; } pos_type seekpos(pos_type pos, std::ios_base::openmode which) { m_current = m_begin + pos; if (m_current < m_begin) m_current = m_begin; if (m_current > m_end) m_current = m_end; return m_current - m_begin; } private: rsrc m_rsrc; const char_type* m_begin; const char_type* m_end; const char_type* m_current; }; using streambuf = basic_streambuf>; // -------------------------------------------------------------------- // class mrsrc::istream template class basic_istream : public std::basic_istream { public: typedef CharT char_type; typedef Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; private: using __streambuf_type = basic_streambuf; using __istream_type = std::basic_istream; __streambuf_type m_buffer; public: basic_istream(const std::string& path) : __istream_type(&m_buffer) , m_buffer(path) { this->init(&m_buffer); } basic_istream(rsrc& resource) : __istream_type(&m_buffer) , m_buffer(resource)\ { this->init(&m_buffer); } basic_istream(const basic_istream&) = delete; basic_istream(basic_istream&& rhs) : __istream_type(std::move(rhs)) , m_buffer(std::move(rhs.m_buffer)) { __istream_type::set_rdbuf(&m_buffer); } basic_istream& operator=(const basic_istream& ) = delete; basic_istream& operator=(basic_istream&& rhs) { __istream_type::operator=(std::move(rhs)); m_buffer = std::move(rhs.m_buffer); return *this; } void swap(basic_istream& rhs) { __istream_type::swap(rhs); m_buffer.swap(rhs.m_buffer); } __streambuf_type* rdbuf() const { return const_cast<__streambuf_type*>(&m_buffer); } }; using istream = basic_istream>; } // namespace mrsrc mrc-1.3.4/rsrc-test.cpp0000664000175000017500000000037514127025075014604 0ustar maartenmaarten#include #include #include "mrsrc.h" int main() { mrsrc::rsrc eerste("eerste"); if (eerste) std::cout << std::string(eerste.data(), eerste.size()) << std::endl; else std::cout << "not found" << std::endl; return 0; }mrc-1.3.4/rsrc/0000775000175000017500000000000014127025075013116 5ustar maartenmaartenmrc-1.3.4/rsrc/resource-1.txt0000664000175000017500000000006214127025075015642 0ustar maartenmaartenThis is the first line And this is the second linemrc-1.3.4/rsrc/resource-2.txt0000664000175000017500000000014614127025075015646 0ustar maartenmaartenThis is the first line And this is the second linemrc-1.3.4/rsrc/subdir/0000775000175000017500000000000014127025075014406 5ustar maartenmaartenmrc-1.3.4/rsrc/subdir/resource-3.txt0000664000175000017500000000002114127025075017127 0ustar maartenmaartenDit is resource 3mrc-1.3.4/rsrc/subdir/subsubdir/0000775000175000017500000000000014127025075016410 5ustar maartenmaartenmrc-1.3.4/rsrc/subdir/subsubdir/resource-4.txt0000664000175000017500000000002114127025075021132 0ustar maartenmaartenDit is resource 4