rename libuserland to libstage2

This commit is contained in:
Andrew Kelley 2020-02-16 19:16:08 -05:00
parent c25742010d
commit 20f3b0efff
12 changed files with 30 additions and 30 deletions

View File

@ -434,8 +434,8 @@ find_package(Threads)
# CMake doesn't let us create an empty executable, so we hang on to this one separately. # CMake doesn't let us create an empty executable, so we hang on to this one separately.
set(ZIG_MAIN_SRC "${CMAKE_SOURCE_DIR}/src/main.cpp") set(ZIG_MAIN_SRC "${CMAKE_SOURCE_DIR}/src/main.cpp")
# This is our shim which will be replaced by libuserland written in Zig. # This is our shim which will be replaced by libstage2 written in Zig.
set(ZIG0_SHIM_SRC "${CMAKE_SOURCE_DIR}/src/userland.cpp") set(ZIG0_SHIM_SRC "${CMAKE_SOURCE_DIR}/src/stage2.cpp")
if(ZIG_ENABLE_MEM_PROFILE) if(ZIG_ENABLE_MEM_PROFILE)
set(ZIG_SOURCES_MEM_PROFILE "${CMAKE_SOURCE_DIR}/src/mem_profile.cpp") set(ZIG_SOURCES_MEM_PROFILE "${CMAKE_SOURCE_DIR}/src/mem_profile.cpp")
@ -599,38 +599,38 @@ set_target_properties(zig0 PROPERTIES
target_link_libraries(zig0 compiler) target_link_libraries(zig0 compiler)
if(MSVC) if(MSVC)
set(LIBUSERLAND "${CMAKE_BINARY_DIR}/userland.lib") set(LIBSTAGE2 "${CMAKE_BINARY_DIR}/stage2.lib")
else() else()
set(LIBUSERLAND "${CMAKE_BINARY_DIR}/libuserland.a") set(LIBSTAGE2 "${CMAKE_BINARY_DIR}/libstage2.a")
endif() endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(LIBUSERLAND_RELEASE_ARG "") set(LIBSTAGE2_RELEASE_ARG "")
else() else()
set(LIBUSERLAND_RELEASE_ARG --release-fast --strip) set(LIBSTAGE2_RELEASE_ARG --release-fast --strip)
endif() endif()
if(WIN32) if(WIN32)
set(LIBUSERLAND_WINDOWS_ARGS "-lntdll") set(LIBSTAGE2_WINDOWS_ARGS "-lntdll")
else() else()
set(LIBUSERLAND_WINDOWS_ARGS "") set(LIBSTAGE2_WINDOWS_ARGS "")
endif() endif()
set(BUILD_LIBUSERLAND_ARGS "build-lib" set(BUILD_LIBSTAGE2_ARGS "build-lib"
--override-lib-dir "${CMAKE_SOURCE_DIR}/lib" --override-lib-dir "${CMAKE_SOURCE_DIR}/lib"
--cache on --cache on
--output-dir "${CMAKE_BINARY_DIR}" --output-dir "${CMAKE_BINARY_DIR}"
${LIBUSERLAND_RELEASE_ARG} ${LIBSTAGE2_RELEASE_ARG}
"src-self-hosted/stage1.zig" "src-self-hosted/stage2.zig"
--disable-gen-h --disable-gen-h
--bundle-compiler-rt --bundle-compiler-rt
-fPIC -fPIC
-lc -lc
${LIBUSERLAND_WINDOWS_ARGS} ${LIBSTAGE2_WINDOWS_ARGS}
) )
add_custom_target(zig_build_libuserland ALL add_custom_target(zig_build_libstage2 ALL
COMMAND zig0 ${BUILD_LIBUSERLAND_ARGS} COMMAND zig0 ${BUILD_LIBSTAGE2_ARGS}
DEPENDS zig0 DEPENDS zig0
BYPRODUCTS "${LIBUSERLAND}" BYPRODUCTS "${LIBSTAGE2}"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
) )
add_executable(zig "${ZIG_MAIN_SRC}") add_executable(zig "${ZIG_MAIN_SRC}")
@ -639,13 +639,13 @@ set_target_properties(zig PROPERTIES
COMPILE_FLAGS ${EXE_CFLAGS} COMPILE_FLAGS ${EXE_CFLAGS}
LINK_FLAGS ${EXE_LDFLAGS} LINK_FLAGS ${EXE_LDFLAGS}
) )
target_link_libraries(zig compiler "${LIBUSERLAND}") target_link_libraries(zig compiler "${LIBSTAGE2}")
if(MSVC) if(MSVC)
target_link_libraries(zig ntdll.lib) target_link_libraries(zig ntdll.lib)
elseif(MINGW) elseif(MINGW)
target_link_libraries(zig ntdll) target_link_libraries(zig ntdll)
endif() endif()
add_dependencies(zig zig_build_libuserland) add_dependencies(zig zig_build_libstage2)
install(TARGETS zig DESTINATION bin) install(TARGETS zig DESTINATION bin)

View File

@ -19,9 +19,9 @@ if(_result)
message(":: ERROR: ${_result}") message(":: ERROR: ${_result}")
message(":: (execute_process)") message(":: (execute_process)")
string(REPLACE ";" " " s_INSTALL_LIBUSERLAND_ARGS "${ZIG_INSTALL_ARGS}") string(REPLACE ";" " " s_INSTALL_LIBSTAGE2_ARGS "${ZIG_INSTALL_ARGS}")
message("::") message("::")
message(":: argv: ${zig_EXE} ${s_INSTALL_LIBUSERLAND_ARGS}") message(":: argv: ${zig_EXE} ${s_INSTALL_LIBSTAGE2_ARGS}")
set(_args ${zig_EXE} ${ZIG_INSTALL_ARGS}) set(_args ${zig_EXE} ${ZIG_INSTALL_ARGS})
list(LENGTH _args _len) list(LENGTH _args _len)

View File

@ -5,7 +5,7 @@
* See http://opensource.org/licenses/MIT * See http://opensource.org/licenses/MIT
*/ */
#include "userland.h" #include "stage2.h"
#include "cache_hash.hpp" #include "cache_hash.hpp"
#include "all_types.hpp" #include "all_types.hpp"
#include "buffer.hpp" #include "buffer.hpp"

View File

@ -18,7 +18,7 @@
#include "target.hpp" #include "target.hpp"
#include "util.hpp" #include "util.hpp"
#include "zig_llvm.h" #include "zig_llvm.h"
#include "userland.h" #include "stage2.h"
#include "dump_analysis.hpp" #include "dump_analysis.hpp"
#include "softfloat.hpp" #include "softfloat.hpp"
#include "mem_profile.hpp" #include "mem_profile.hpp"

View File

@ -11,7 +11,7 @@
#include "parser.hpp" #include "parser.hpp"
#include "errmsg.hpp" #include "errmsg.hpp"
#include "target.hpp" #include "target.hpp"
#include "userland.h" #include "stage2.h"
#include <stdio.h> #include <stdio.h>

View File

@ -8,7 +8,7 @@
#ifndef ERROR_HPP #ifndef ERROR_HPP
#define ERROR_HPP #define ERROR_HPP
#include "userland.h" #include "stage2.h"
const char *err_str(Error err); const char *err_str(Error err);

View File

@ -14,7 +14,7 @@
#include "heap.hpp" #include "heap.hpp"
#include "os.hpp" #include "os.hpp"
#include "target.hpp" #include "target.hpp"
#include "userland.h" #include "stage2.h"
#include "glibc.hpp" #include "glibc.hpp"
#include "dump_analysis.hpp" #include "dump_analysis.hpp"
#include "mem_profile.hpp" #include "mem_profile.hpp"

View File

@ -1,7 +1,7 @@
// This file is a shim for zig1. The real implementations of these are in // This file is a shim for zig1. The real implementations of these are in
// src-self-hosted/stage1.zig // src-self-hosted/stage1.zig
#include "userland.h" #include "stage2.h"
#include "util.hpp" #include "util.hpp"
#include "zig_llvm.h" #include "zig_llvm.h"
#include <stdio.h> #include <stdio.h>

View File

@ -5,8 +5,8 @@
* See http://opensource.org/licenses/MIT * See http://opensource.org/licenses/MIT
*/ */
#ifndef ZIG_USERLAND_H #ifndef ZIG_STAGE2_H
#define ZIG_USERLAND_H #define ZIG_STAGE2_H
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
@ -25,7 +25,7 @@
#endif #endif
// ABI warning: the types and declarations in this file must match both those in // ABI warning: the types and declarations in this file must match both those in
// userland.cpp and src-self-hosted/stage1.zig. // stage2.cpp and src-self-hosted/stage2.zig.
// ABI warning // ABI warning
enum Error { enum Error {

View File

@ -6,7 +6,7 @@
*/ */
#include "util.hpp" #include "util.hpp"
#include "userland.h" #include "stage2.h"
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>

View File

@ -8,7 +8,7 @@
#ifndef ZIG_ZIG_CLANG_H #ifndef ZIG_ZIG_CLANG_H
#define ZIG_ZIG_CLANG_H #define ZIG_ZIG_CLANG_H
#include "userland.h" #include "stage2.h"
#include <inttypes.h> #include <inttypes.h>
#include <stdbool.h> #include <stdbool.h>