Build: Switch to CMake :^)

Closes https://github.com/SerenityOS/serenity/issues/2080
This commit is contained in:
Sergey Bugaev 2020-05-06 18:40:06 +03:00 committed by Andreas Kling
parent 49727ffee4
commit 450a2a0f9c
Notes: sideshowbarker 2024-07-19 06:39:17 +09:00
236 changed files with 1774 additions and 2337 deletions

4
.gitignore vendored
View file

@ -22,7 +22,9 @@
*.cxxflags *.cxxflags
*.autosave *.autosave
Meta/Lagom/build Meta/Lagom/build
Root Build
build
CMakeFiles
Toolchain/Tarballs Toolchain/Tarballs
Toolchain/Build Toolchain/Build
Toolchain/Local Toolchain/Local

View file

@ -1,5 +1,5 @@
os: linux os: linux
dist: xenial dist: bionic
language: cpp language: cpp
@ -23,20 +23,26 @@ notifications:
before_install: before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq - sudo apt-get update -qq
- sudo apt-get install -y g++-8 libstdc++-8-dev cmake shellcheck libmpfr-dev libmpc-dev libgmp-dev e2fsprogs qemu-system-i386 qemu-utils - sudo apt-get install -y g++-8 libstdc++-8-dev shellcheck libmpfr-dev libmpc-dev libgmp-dev e2fsprogs qemu-system-i386 qemu-utils
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 90 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 90
- sudo python2 -m pip install cmake
- export PATH=/usr/local/bin/:$PATH
- cmake --version
script: script:
- export SERENITY_ROOT=$(pwd) - export SERENITY_ROOT=$(pwd)
- Meta/lint-shell-scripts.sh
- Meta/check-license-headers.sh
- cd Toolchain - cd Toolchain
- TRY_USE_LOCAL_TOOLCHAIN=y ./BuildIt.sh - TRY_USE_LOCAL_TOOLCHAIN=y ./BuildIt.sh
- cd ../Kernel - cd "$SERENITY_ROOT"
- ./makeall.sh - mkdir -p Build
- ../Meta/lint-shell-scripts.sh - cd Build
- ../Meta/check-license-headers.sh - cmake .. -DBUILD_LAGOM=1
- ../Meta/Lagom/build-js.sh - make
- cd ../Libraries/LibJS/Tests - make test
- ./run-tests - cd "$SERENITY_ROOT"/Libraries/LibJS/Tests
- cd ../../../Toolchain/Cache - ./run-tests.sh
- cd "$SERENITY_ROOT"/Toolchain/Cache
- du -ch * || true - du -ch * || true

View file

@ -1,5 +0,0 @@
install:
mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/AK/
cp ../AK/*.h $(SERENITY_BASE_DIR)/Root/usr/include/AK/
include ../Makefile.common

12
AK/Tests/CMakeLists.txt Normal file
View file

@ -0,0 +1,12 @@
file(GLOB AK_TEST_SOURCES "*.cpp")
foreach(source ${AK_TEST_SOURCES})
get_filename_component(name ${source} NAME_WE)
add_executable(${name} ${source})
target_link_libraries(${name} LagomCore)
add_test(
NAME ${name}
COMMAND ${name}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endforeach()

View file

@ -1,37 +0,0 @@
SHARED_TEST_SOURCES = \
../String.cpp \
../StringImpl.cpp \
../StringBuilder.cpp \
../StringView.cpp \
../StringUtils.cpp \
../LogStream.cpp \
../JsonValue.cpp \
../JsonParser.cpp \
../FlyString.cpp \
../FileSystemPath.cpp \
../URL.cpp \
../Utf8View.cpp
SRCS = $(wildcard *.cpp)
SHARED_TEST_OBJS = ${SHARED_TEST_SOURCES:.cpp=.host.o}
OBJS = ${SRCS:.cpp=.host.o} $(SHARED_TEST_OBJS)
APPS = ${SRCS:.cpp=}
EXTRA_CLEAN = $(APPS) *.o ../*.host.o
USE_HOST_CXX = 1
include ../../Makefile.common
CXXFLAGS = -std=c++17 -Wall -Wextra -ggdb3 -O2 -I../ -I../../
APPS_RUN = $(addsuffix .run,$(APPS))
test: $(APPS) $(APPS_RUN)
$(APPS_RUN): %.run:
./$*
$(APPS): %: %$(OBJ_SUFFIX).o $(SHARED_TEST_OBJS)
@echo "LINK $@"
$(QUIET) $(CXX) -o $@ $< $(SHARED_TEST_OBJS) $(LDFLAGS)
all: | $(APPS) $(APPS_RUN)

View file

@ -0,0 +1,12 @@
set(SOURCES
main.cpp
)
execute_process(COMMAND "git rev-parse --short HEAD" OUTPUT_VARIABLE GIT_COMMIT)
execute_process(COMMAND "git rev-parse --abbrev-ref HEAD" OUTPUT_VARIABLE GIT_BRANCH)
execute_process(COMMAND "git diff-index --quiet HEAD -- && echo tracked || echo untracked" OUTPUT_VARIABLE GIT_CHANGES)
add_definitions(-DGIT_COMMIT="${GIT_COMMIT}" -DGIT_BRANCH="${GIT_BRANCH}" -DGIT_CHANGES="${GIT_CHANGES}")
serenity_bin(About)
target_link_libraries(About LibGUI)

View file

@ -1,10 +0,0 @@
OBJS = \
main.o
PROGRAM = About
LIB_DEPS = GUI Gfx IPC Core
DEFINES += -DGIT_COMMIT=\"`git rev-parse --short HEAD`\" -DGIT_BRANCH=\"`git rev-parse --abbrev-ref HEAD`\"
include ../../Makefile.common

View file

@ -0,0 +1,11 @@
set(SOURCES
BookmarksBarWidget.cpp
DownloadWidget.cpp
InspectorWidget.cpp
main.cpp
Tab.cpp
WindowActions.cpp
)
serenity_bin(Browser)
target_link_libraries(Browser LibWeb LibProtocol LibGUI)

View file

@ -1,21 +0,0 @@
OBJS = \
BookmarksBarWidget.o \
DownloadWidget.o \
InspectorWidget.o \
Tab.o \
WindowActions.o \
main.o
PROGRAM = Browser
LIB_DEPS = Web JS Markdown TextCodec GUI Gfx IPC Protocol Core
main.cpp: ../../Libraries/LibWeb/CSS/PropertyID.h
../../Libraries/LibWeb/CSS/PropertyID.h:
@flock ../../Libraries/LibWeb $(MAKE) -C ../../Libraries/LibWeb
main.cpp: ../../Services/ProtocolServer/ProtocolClientEndpoint.h
../../Services/ProtocolServer/ProtocolClientEndpoint.h:
@flock ../../Services/ProtocolServer $(MAKE) -C $(dir $(@))
include ../../Makefile.common

View file

@ -0,0 +1,19 @@
add_subdirectory(About)
add_subdirectory(Browser)
add_subdirectory(Calculator)
add_subdirectory(Calendar)
add_subdirectory(Debugger)
add_subdirectory(DisplaySettings)
add_subdirectory(FileManager)
add_subdirectory(FontEditor)
add_subdirectory(Help)
add_subdirectory(HexEditor)
add_subdirectory(IRCClient)
add_subdirectory(PaintBrush)
add_subdirectory(Piano)
add_subdirectory(QuickShow)
add_subdirectory(SoundPlayer)
add_subdirectory(SystemMonitor)
add_subdirectory(Terminal)
add_subdirectory(TextEditor)
add_subdirectory(Welcome)

View file

@ -0,0 +1,9 @@
set(SOURCES
main.cpp
Calculator.cpp
CalculatorWidget.cpp
Keypad.cpp
)
serenity_bin(Calculator)
target_link_libraries(Calculator LibGUI)

View file

@ -1,11 +0,0 @@
OBJS = \
Calculator.o \
Keypad.o \
CalculatorWidget.o \
main.o
PROGRAM = Calculator
LIB_DEPS = GUI Gfx IPC Core
include ../../Makefile.common

View file

@ -0,0 +1,9 @@
set(SOURCES
AddEventDialog.cpp
Calendar.cpp
CalendarWidget.cpp
main.cpp
)
serenity_bin(Calendar)
target_link_libraries(Calendar LibGUI)

View file

@ -1,12 +0,0 @@
OBJS = \
Calendar.o \
CalendarWidget.o \
AddEventDialog.o \
main.o
PROGRAM = Calendar
LIB_DEPS = GUI Gfx IPC Core
include ../../Makefile.common

View file

@ -0,0 +1,6 @@
set(SOURCES
main.cpp
)
serenity_bin(Debugger)
target_link_libraries(Debugger LibCore LibDebug LibX86 LibLine)

View file

@ -1,8 +0,0 @@
OBJS = \
main.o
PROGRAM = Debugger
LIB_DEPS = Core X86 Debug Line
include ../../Makefile.common

View file

@ -0,0 +1,8 @@
set(SOURCES
DisplaySettings.cpp
main.cpp
MonitorWidget.cpp
)
serenity_bin(DisplaySettings)
target_link_libraries(DisplaySettings LibGUI)

View file

@ -1,10 +0,0 @@
OBJS = \
MonitorWidget.o \
DisplaySettings.o \
main.o \
PROGRAM = DisplaySettings
LIB_DEPS = GUI Gfx IPC Thread Pthread Core
include ../../Makefile.common

View file

@ -0,0 +1,9 @@
set(SOURCES
DirectoryView.cpp
FileUtils.cpp
main.cpp
PropertiesDialog.cpp
)
serenity_bin(FileManager)
target_link_libraries(FileManager LibGUI LibDesktop)

View file

@ -1,11 +0,0 @@
OBJS = \
DirectoryView.o \
FileUtils.o \
PropertiesDialog.o \
main.o
PROGRAM = FileManager
LIB_DEPS = GUI Gfx Desktop IPC Thread Pthread Core
include ../../Makefile.common

View file

@ -0,0 +1,11 @@
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(SOURCES
FontEditor.cpp
GlyphEditorWidget.cpp
GlyphMapWidget.cpp
main.cpp
)
serenity_bin(FontEditor)
target_link_libraries(FontEditor LibGUI LibGfx)

View file

@ -1,11 +0,0 @@
OBJS = \
FontEditor.o \
GlyphMapWidget.o \
GlyphEditorWidget.o \
main.o
PROGRAM = FontEditor
LIB_DEPS = GUI Gfx Core IPC
include ../../Makefile.common

View file

@ -0,0 +1,10 @@
set(SOURCES
History.cpp
main.cpp
ManualModel.cpp
ManualPageNode.cpp
ManualSectionNode.cpp
)
serenity_bin(Help)
target_link_libraries(Help LibWeb LibMarkdown LibGUI)

View file

@ -1,12 +0,0 @@
OBJS = \
ManualModel.o \
ManualSectionNode.o \
ManualPageNode.o \
History.o \
main.o
PROGRAM = Help
LIB_DEPS = GUI Web TextCodec JS Gfx Markdown IPC Protocol Thread Pthread Core
include ../../Makefile.common

View file

@ -0,0 +1,8 @@
set(SOURCES
HexEditor.cpp
HexEditorWidget.cpp
main.cpp
)
serenity_bin(HexEditor)
target_link_libraries(HexEditor LibGUI)

View file

@ -1,10 +0,0 @@
OBJS = \
HexEditor.o \
HexEditorWidget.o \
main.o
PROGRAM = HexEditor
LIB_DEPS = GUI Gfx IPC Thread Pthread Core
include ../../Makefile.common

View file

@ -0,0 +1,14 @@
set(SOURCES
IRCAppWindow.cpp
IRCChannel.cpp
IRCChannelMemberListModel.cpp
IRCClient.cpp
IRCLogBuffer.cpp
IRCQuery.cpp
IRCWindow.cpp
IRCWindowListModel.cpp
main.cpp
)
serenity_bin(IRCClient)
target_link_libraries(IRCClient LibWeb LibGUI)

View file

@ -1,16 +0,0 @@
OBJS = \
IRCClient.o \
IRCChannel.o \
IRCQuery.o \
IRCLogBuffer.o \
IRCAppWindow.o \
IRCWindow.o \
IRCWindowListModel.o \
IRCChannelMemberListModel.o \
main.o
PROGRAM = IRCClient
LIB_DEPS = Web TextCodec JS Markdown GUI Gfx Protocol IPC Thread Pthread Core
include ../../Makefile.common

View file

@ -1,3 +0,0 @@
SUBDIRS := $(patsubst %/Makefile,%/,$(wildcard */Makefile))
include ../Makefile.subdir

View file

@ -0,0 +1,23 @@
set(SOURCES
BucketTool.cpp
CreateNewLayerDialog.cpp
EllipseTool.cpp
EraseTool.cpp
Image.cpp
ImageEditor.cpp
Layer.cpp
LayerModel.cpp
LineTool.cpp
main.cpp
MoveTool.cpp
PaletteWidget.cpp
PenTool.cpp
PickerTool.cpp
RectangleTool.cpp
SprayTool.cpp
ToolboxWidget.cpp
Tool.cpp
)
serenity_bin(PaintBrush)
target_link_libraries(PaintBrush LibGUI LibGfx)

View file

@ -1,25 +0,0 @@
OBJS = \
BucketTool.o \
CreateNewLayerDialog.o \
EllipseTool.o \
EraseTool.o \
Image.o \
ImageEditor.o \
Layer.o \
LayerModel.o \
LineTool.o \
MoveTool.o \
PaletteWidget.o \
PenTool.o \
PickerTool.o \
RectangleTool.o \
SprayTool.o \
Tool.o \
ToolboxWidget.o \
main.o
PROGRAM = PaintBrush
LIB_DEPS = GUI Gfx IPC Thread Pthread Core
include ../../Makefile.common

View file

@ -0,0 +1,13 @@
set(SOURCES
AudioEngine.cpp
KeysWidget.cpp
KnobsWidget.cpp
main.cpp
MainWidget.cpp
RollWidget.cpp
SamplerWidget.cpp
WaveWidget.cpp
)
serenity_bin(Piano)
target_link_libraries(Piano LibAudio LibGUI)

View file

@ -1,15 +0,0 @@
OBJS = \
AudioEngine.o \
MainWidget.o \
WaveWidget.o \
RollWidget.o \
SamplerWidget.o \
KeysWidget.o \
KnobsWidget.o \
main.o
PROGRAM = Piano
LIB_DEPS = GUI Gfx Audio IPC Thread Pthread Core
include ../../Makefile.common

View file

@ -0,0 +1,7 @@
set(SOURCES
main.cpp
QSWidget.cpp
)
serenity_bin(QuickShow)
target_link_libraries(QuickShow LibGUI LibGfx)

View file

@ -1,9 +0,0 @@
OBJS = \
QSWidget.o \
main.o
PROGRAM = QuickShow
LIB_DEPS = GUI Gfx Protocol IPC Thread Pthread Core
include ../../Makefile.common

View file

@ -0,0 +1,9 @@
set(SOURCES
main.cpp
PlaybackManager.cpp
SampleWidget.cpp
SoundPlayerWidget.cpp
)
serenity_bin(SoundPlayer)
target_link_libraries(SoundPlayer LibAudio LibGUI)

View file

@ -1,11 +0,0 @@
OBJS = \
PlaybackManager.o \
SampleWidget.o \
SoundPlayerWidget.o \
main.o
PROGRAM = SoundPlayer
LIB_DEPS = GUI Gfx Audio IPC Thread Pthread Core
include ../../Makefile.common

View file

@ -0,0 +1,16 @@
set(SOURCES
DevicesModel.cpp
GraphWidget.cpp
main.cpp
MemoryStatsWidget.cpp
NetworkStatisticsWidget.cpp
ProcessFileDescriptorMapWidget.cpp
ProcessMemoryMapWidget.cpp
ProcessModel.cpp
ProcessStacksWidget.cpp
ProcessTableView.cpp
ProcessUnveiledPathsWidget.cpp
)
serenity_bin(SystemMonitor)
target_link_libraries(SystemMonitor LibGUI LibPCIDB)

View file

@ -1,18 +0,0 @@
OBJS = \
ProcessModel.o \
DevicesModel.o \
ProcessTableView.o \
MemoryStatsWidget.o \
GraphWidget.o \
ProcessStacksWidget.o \
ProcessMemoryMapWidget.o \
ProcessFileDescriptorMapWidget.o \
NetworkStatisticsWidget.o \
ProcessUnveiledPathsWidget.o \
main.o
PROGRAM = SystemMonitor
LIB_DEPS = GUI Gfx Protocol PCIDB IPC Thread Pthread Core
include ../../Makefile.common

View file

@ -0,0 +1,6 @@
set(SOURCES
main.cpp
)
serenity_bin(Terminal)
target_link_libraries(Terminal LibGUI LibVT)

View file

@ -1,8 +0,0 @@
OBJS = \
main.o
PROGRAM = Terminal
LIB_DEPS = GUI Gfx VT Desktop IPC Protocol Core
include ../../Makefile.common

View file

@ -0,0 +1,7 @@
set(SOURCES
main.cpp
TextEditorWidget.cpp
)
serenity_bin(TextEditor)
target_link_libraries(TextEditor LibWeb LibMarkdown LibGUI)

View file

@ -1,9 +0,0 @@
OBJS = \
TextEditorWidget.o \
main.o
PROGRAM = TextEditor
LIB_DEPS = Web TextCodec Markdown GUI Gfx VT Protocol IPC Thread Pthread Core JS
include ../../Makefile.common

View file

@ -0,0 +1,9 @@
set(SOURCES
BackgroundWidget.cpp
main.cpp
TextWidget.cpp
UnuncheckableButton.cpp
)
serenity_bin(Welcome)
target_link_libraries(Welcome LibGUI)

View file

@ -1,11 +0,0 @@
OBJS = \
main.o \
TextWidget.o \
BackgroundWidget.o \
UnuncheckableButton.o
PROGRAM = Welcome
LIB_DEPS = GUI Gfx IPC Core
include ../../Makefile.common

124
CMakeLists.txt Normal file
View file

@ -0,0 +1,124 @@
cmake_minimum_required (VERSION 3.17)
project (SerenityOS C CXX ASM)
enable_testing()
add_custom_target(image
COMMAND ${CMAKE_COMMAND} -E env "SERENITY_ROOT=${CMAKE_SOURCE_DIR}" ${CMAKE_SOURCE_DIR}/Meta/sync.sh
BYPRODUCTS ${CMAKE_BINARY_DIR}/_disk_image
USES_TERMINAL
)
add_custom_target(run
COMMAND ${CMAKE_SOURCE_DIR}/Meta/run.sh
USES_TERMINAL
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -std=c++2a")
include_directories(Libraries)
include_directories(.)
add_subdirectory(Meta/Lagom)
add_subdirectory(DevTools/IPCCompiler)
add_subdirectory(DevTools/FormCompiler)
add_subdirectory(Libraries/LibWeb/CodeGenerators)
add_subdirectory(AK/Tests)
function(serenity_lib_headers target_name)
file(GLOB_RECURSE headers RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
foreach(header ${headers})
get_filename_component(subdirectory ${header} DIRECTORY)
install(FILES ${header} DESTINATION usr/include/${target_name}/${subdirectory})
endforeach()
endfunction()
function(serenity_lib target_name fs_name)
serenity_lib_headers(${target_name})
add_library(${target_name} ${SOURCES} ${GENERATED_SOURCES})
install(TARGETS ${target_name} ARCHIVE DESTINATION usr/lib)
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
if(DEFINED GENERATED_SOURCES)
set_source_files_properties(${GENERATED_SOURCES} PROPERTIES GENERATED 1)
foreach(generated ${GENERATED_SOURCES})
get_filename_component(generated_name ${generated} NAME)
add_dependencies(${target_name} generate_${generated_name})
endforeach()
endif()
endfunction()
function(serenity_libc target_name fs_name)
serenity_lib_headers("")
add_library(${target_name} ${SOURCES})
install(TARGETS ${target_name} ARCHIVE DESTINATION usr/lib)
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
target_link_directories(LibC PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
endfunction()
function(serenity_bin target_name)
add_executable(${target_name} ${SOURCES})
install(TARGETS ${target_name} RUNTIME DESTINATION bin)
endfunction()
function(compile_ipc source output)
set(source ${CMAKE_CURRENT_SOURCE_DIR}/${source})
add_custom_command(
OUTPUT ${output}
COMMAND IPCCompiler ${source} > ${output}
VERBATIM
DEPENDS IPCCompiler
MAIN_DEPENDENCY ${source}
)
get_filename_component(output_name ${output} NAME)
add_custom_target(generate_${output_name} DEPENDS ${output})
endfunction()
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()
unset(CMAKE_SYSROOT)
set(CMAKE_STAGING_PREFIX ${CMAKE_BINARY_DIR}/Root)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Root)
set(CMAKE_INSTALL_DATAROOTDIR ${CMAKE_BINARY_DIR}/Root/res)
set(TOOLCHAIN_PATH ${CMAKE_SOURCE_DIR}/Toolchain/Local/bin)
set(TOOLCHAIN_PREFIX ${TOOLCHAIN_PATH}/i686-pc-serenity-)
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}gcc)
set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}ld)
set(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}ranlib)
set(CMAKE_STRIP ${TOOLCHAIN_PREFIX}strip)
set(CMAKE_AR ${TOOLCHAIN_PREFIX}ar)
#FIXME: -fstack-protector
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -Wno-sized-deallocation -fno-sized-deallocation -fno-exceptions -fno-rtti -Wno-address-of-packed-member -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough -Wno-nonnull-compare -Wno-deprecated-copy")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG -DSANITIZE_PTRS")
add_link_options(--sysroot ${CMAKE_BINARY_DIR}/Root)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconsumed")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-expansion-to-defined")
endif()
include_directories(Libraries/LibC)
include_directories(Services)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/Services)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/Libraries)
add_subdirectory(Kernel)
add_subdirectory(Libraries)
add_subdirectory(Services)
add_subdirectory(Applications)
add_subdirectory(Games)
add_subdirectory(DevTools)
add_subdirectory(MenuApplets)
add_subdirectory(Shell)
add_subdirectory(Demos)
add_subdirectory(Userland)

7
Demos/CMakeLists.txt Normal file
View file

@ -0,0 +1,7 @@
add_subdirectory(Cube)
add_subdirectory(DynamicLink)
add_subdirectory(Fire)
add_subdirectory(HelloWorld)
add_subdirectory(Mouse)
add_subdirectory(Screensaver)
add_subdirectory(WidgetGallery)

View file

@ -0,0 +1,6 @@
set(SOURCES
Cube.cpp
)
serenity_bin(Cube)
target_link_libraries(Cube LibGUI)

View file

@ -1,8 +0,0 @@
OBJS = \
Cube.o
PROGRAM = Cube
LIB_DEPS = GUI IPC Gfx Core
include ../../Makefile.common

View file

@ -0,0 +1,2 @@
add_subdirectory(LinkDemo)
add_subdirectory(LinkLib)

View file

@ -0,0 +1,6 @@
set(SOURCES
main.cpp
)
serenity_bin(LinkDemo)
target_link_libraries(LinkDemo LibC)

View file

@ -1,8 +0,0 @@
OBJS = \
main.o
PROGRAM = LinkDemo
SUBPROJECT_CXXFLAGS = -fPIC
include ../../../Makefile.common

View file

@ -0,0 +1,7 @@
set(SOURCES
DynamicLib.cpp
)
add_library(DynamicLib SHARED ${SOURCES})
target_link_libraries(DynamicLib LibC)
install(TARGETS DynamicLib DESTINATION usr/lib)

View file

@ -1,15 +0,0 @@
include ../../../Makefile.common
DYNLIBRARY = libDynamicLib.so
EXTRA_CLEAN = *.o *.so
all: $(DYNLIBRARY)
DynamicLib.o: DynamicLib.cpp
@echo "$(notdir $(CURDIR)): C++ $@"
$(QUIET) $(CXX) -DDEBUG -fPIC -isystem../../../ -o $@ -c $<
$(DYNLIBRARY): DynamicLib.o
@echo "$(notdir $(CURDIR)): DYLIB $@"
$(QUIET) $(CXX) -shared -o $(DYNLIBRARY) $<

View file

@ -1,3 +0,0 @@
SUBDIRS := $(wildcard */.)
include ../../Makefile.subdir

View file

@ -0,0 +1,6 @@
set(SOURCES
Fire.cpp
)
serenity_bin(Fire)
target_link_libraries(Fire LibGUI LibCore LibGfx)

View file

@ -1,8 +0,0 @@
OBJS = \
Fire.o
PROGRAM = Fire
LIB_DEPS = GUI IPC Gfx Core
include ../../Makefile.common

View file

@ -0,0 +1,6 @@
set(SOURCES
main.cpp
)
serenity_bin(HelloWorld)
target_link_libraries(HelloWorld LibGUI)

View file

@ -1,8 +0,0 @@
OBJS = \
main.o
PROGRAM = HelloWorld
LIB_DEPS = GUI IPC Gfx Core
include ../../Makefile.common

View file

@ -1,3 +0,0 @@
SUBDIRS := $(patsubst %/Makefile,%/,$(wildcard */Makefile))
include ../Makefile.subdir

View file

@ -0,0 +1,6 @@
set(SOURCES
main.cpp
)
serenity_bin(Mouse)
target_link_libraries(Mouse LibGUI LibGfx)

View file

@ -1,8 +0,0 @@
OBJS = \
main.o
PROGRAM = Mouse
LIB_DEPS = GUI IPC Gfx Core
include ../../Makefile.common

View file

@ -0,0 +1,6 @@
set(SOURCES
Screensaver.cpp
)
serenity_bin(Screensaver)
target_link_libraries(Screensaver LibGUI LibCore LibGfx)

View file

@ -1,8 +0,0 @@
OBJS = \
Screensaver.o
PROGRAM = Screensaver
LIB_DEPS = GUI IPC Gfx Core
include ../../Makefile.common

View file

@ -0,0 +1,6 @@
set(SOURCES
main.cpp
)
serenity_bin(WidgetGallery)
target_link_libraries(WidgetGallery LibGUI)

View file

@ -1,8 +0,0 @@
OBJS = \
main.o
PROGRAM = WidgetGallery
LIB_DEPS = GUI IPC Gfx Core
include ../../Makefile.common

4
DevTools/CMakeLists.txt Normal file
View file

@ -0,0 +1,4 @@
add_subdirectory(HackStudio)
add_subdirectory(Inspector)
add_subdirectory(ProfileViewer)
add_subdirectory(VisualBuilder)

View file

@ -0,0 +1,6 @@
set(SOURCES
main.cpp
)
add_executable(FormCompiler ${SOURCES})
target_link_libraries(FormCompiler LagomCore)

View file

@ -1,26 +0,0 @@
USE_HOST_CXX = 1
PROGRAM = FormCompiler
OBJS = \
main.o \
../../AK/FlyString.o \
../../AK/JsonParser.o \
../../AK/JsonValue.o \
../../AK/LogStream.o \
../../AK/String.o \
../../AK/StringBuilder.o \
../../AK/StringImpl.o \
../../AK/StringUtils.o \
../../AK/StringView.o \
../../Libraries/LibCore/IODevice.o \
../../Libraries/LibCore/File.o \
../../Libraries/LibCore/Object.o \
../../Libraries/LibCore/Event.o \
../../Libraries/LibCore/Socket.o \
../../Libraries/LibCore/LocalSocket.o \
../../Libraries/LibCore/LocalServer.o \
../../Libraries/LibCore/Notifier.o \
../../Libraries/LibCore/EventLoop.o
include ../../Makefile.common

View file

@ -0,0 +1,24 @@
set(SOURCES
CursorTool.cpp
Debugger/BacktraceModel.cpp
Debugger/Debugger.cpp
Debugger/DebugInfoWidget.cpp
Debugger/VariablesModel.cpp
Editor.cpp
EditorWrapper.cpp
FindInFilesWidget.cpp
FormEditorWidget.cpp
FormWidget.cpp
Locator.cpp
main.cpp
ProcessStateWidget.cpp
Project.cpp
ProjectFile.cpp
TerminalWrapper.cpp
Tool.cpp
WidgetTool.cpp
WidgetTreeModel.cpp
)
serenity_bin(HackStudio)
target_link_libraries(HackStudio LibWeb LibMarkdown LibGUI LibGfx LibCore LibVT LibDebug)

View file

@ -1,26 +0,0 @@
OBJS = \
Project.o \
ProjectFile.o \
TerminalWrapper.o \
FindInFilesWidget.o \
ProcessStateWidget.o \
FormEditorWidget.o \
FormWidget.o \
Editor.o \
EditorWrapper.o \
Locator.o \
Tool.o \
CursorTool.o \
WidgetTool.o \
WidgetTreeModel.o \
main.o \
Debugger/DebugInfoWidget.o \
Debugger/Debugger.o \
Debugger/VariablesModel.o \
Debugger/BacktraceModel.o
PROGRAM = HackStudio
LIB_DEPS = GUI Web TextCodec VT Desktop Protocol Markdown Gfx IPC Thread Pthread Core JS Debug
include ../../Makefile.common

View file

@ -0,0 +1,6 @@
set(SOURCES
main.cpp
)
add_executable(IPCCompiler ${SOURCES})
target_link_libraries(IPCCompiler LagomCore)

View file

@ -1,26 +0,0 @@
USE_HOST_CXX = 1
PROGRAM = IPCCompiler
OBJS = \
main.o \
../../AK/FlyString.o \
../../AK/JsonParser.o \
../../AK/JsonValue.o \
../../AK/LogStream.o \
../../AK/String.o \
../../AK/StringBuilder.o \
../../AK/StringImpl.o \
../../AK/StringUtils.o \
../../AK/StringView.o \
../../Libraries/LibCore/IODevice.o \
../../Libraries/LibCore/File.o \
../../Libraries/LibCore/Object.o \
../../Libraries/LibCore/Event.o \
../../Libraries/LibCore/Socket.o \
../../Libraries/LibCore/LocalSocket.o \
../../Libraries/LibCore/Notifier.o \
../../Libraries/LibCore/LocalServer.o \
../../Libraries/LibCore/EventLoop.o
include ../../Makefile.common

View file

@ -0,0 +1,10 @@
set(SOURCES
main.cpp
RemoteObject.cpp
RemoteObjectGraphModel.cpp
RemoteObjectPropertyModel.cpp
RemoteProcess.cpp
)
serenity_bin(Inspector)
target_link_libraries(Inspector LibGUI)

View file

@ -1,12 +0,0 @@
OBJS = \
RemoteObjectGraphModel.o \
RemoteObjectPropertyModel.o \
RemoteProcess.o \
RemoteObject.o \
main.o
PROGRAM = Inspector
LIB_DEPS = GUI Gfx IPC Core
include ../../Makefile.common

View file

@ -1,3 +0,0 @@
SUBDIRS := $(patsubst %/Makefile,%/,$(wildcard */Makefile))
include ../Makefile.subdir

View file

@ -0,0 +1,10 @@
set(SOURCES
DisassemblyModel.cpp
main.cpp
Profile.cpp
ProfileModel.cpp
ProfileTimelineWidget.cpp
)
serenity_bin(ProfileViewer)
target_link_libraries(ProfileViewer LibGUI LibX86)

View file

@ -1,12 +0,0 @@
OBJS = \
DisassemblyModel.o \
Profile.o \
ProfileModel.o \
ProfileTimelineWidget.o \
main.o
PROGRAM = ProfileViewer
LIB_DEPS = GUI Gfx IPC Core X86
include ../../Makefile.common

View file

@ -0,0 +1,12 @@
set(SOURCES
main.cpp
VBForm.cpp
VBPropertiesWindow.cpp
VBProperty.cpp
VBWidget.cpp
VBWidgetPropertyModel.cpp
VBWidgetRegistry.cpp
)
serenity_bin(VisualBuilder)
target_link_libraries(VisualBuilder LibGUI)

View file

@ -1,14 +0,0 @@
OBJS = \
VBForm.o \
VBWidget.o \
VBWidgetRegistry.o \
VBWidgetPropertyModel.o \
VBProperty.o \
VBPropertiesWindow.o \
main.o
PROGRAM = VisualBuilder
LIB_DEPS = GUI Gfx IPC Core
include ../../Makefile.common

View file

@ -5,7 +5,7 @@ Make sure you have all the dependencies installed:
**Debian / Ubuntu** **Debian / Ubuntu**
```bash ```bash
sudo apt install build-essential curl libmpfr-dev libmpc-dev libgmp-dev e2fsprogs qemu-system-i386 qemu-utils sudo apt install build-essential cmake curl libmpfr-dev libmpc-dev libgmp-dev e2fsprogs qemu-system-i386 qemu-utils
``` ```
On Docker, install these as well: On Docker, install these as well:
@ -15,12 +15,12 @@ sudo apt install wget genext2fs
**Fedora** **Fedora**
```bash ```bash
sudo dnf install curl mpfr-devel libmpc-devel gmp-devel e2fsprogs @"C Development Tools and Libraries" @Virtualization sudo dnf install curl cmake mpfr-devel libmpc-devel gmp-devel e2fsprogs @"C Development Tools and Libraries" @Virtualization
``` ```
**Arch Linux / Manjaro** **Arch Linux / Manjaro**
```bash ```bash
sudo pacman -S base-devel curl mpfr libmpc gmp e2fsprogs qemu qemu-arch-extra sudo pacman -S base-devel cmake curl mpfr libmpc gmp e2fsprogs qemu qemu-arch-extra
``` ```
Ensure your gcc version is >= 8 with `gcc --version`. Otherwise, install it (on Ubuntu) with: Ensure your gcc version is >= 8 with `gcc --version`. Otherwise, install it (on Ubuntu) with:
@ -61,16 +61,22 @@ Notes:
pkg_add bash gmp gcc git flock gmake sudo pkg_add bash gmp gcc git flock gmake sudo
``` ```
When building with `make`, `gmake` must be used. The `makeall.sh` script will do this automatically when building on OpenBSD.
### Build ### Build
> Before starting, make sure that you have configured your global identity for git, or the first script will fail after running for a bit. > Before starting, make sure that you have configured your global identity for git, or the first script will fail after running for a bit.
Go into the `Toolchain/` directory and run the **BuildIt.sh** script. Go into the `Toolchain/` directory and run the **BuildIt.sh** script.
Once you've built the toolchain, go into the `Kernel/` directory, then run Once you've built the toolchain, create a directory for the build to live in (for example, `Build/`), and run the CMake build:
**./makeall.sh**, and if nothing breaks too much, take it for a spin by using ```
**./run**. $ mkdir Build && cd Build
$ cmake ..
$ make
$ make install
```
This will compile all of SerenityOS and install the built files into `Root/` inside the build tree. `make install` actually pulls in the regular `make` (`make all`) automatically, so there isn't really a need to run it exlicitly. You may also want ask `make` to build things in parallel by using `-j`, optionally specifying the maximum number of jobs to run.
Now to build a disk image, run `make image`, and if nothing breaks too much, take it for a spin by using `make run`.
Note that the `anon` user is able to become `root` without password by default, as a development convenience. Note that the `anon` user is able to become `root` without password by default, as a development convenience.
To prevent this, remove `anon` from the `wheel` group and he will no longer be able to run `/bin/su`. To prevent this, remove `anon` from the `wheel` group and he will no longer be able to run `/bin/su`.
@ -79,9 +85,9 @@ On Linux, QEMU is significantly faster if it's able to use KVM. The run script w
Bare curious users may even consider sourcing suitable hardware to [install Serenity on a physical PC.](https://github.com/SerenityOS/serenity/blob/master/INSTALL.md) Bare curious users may even consider sourcing suitable hardware to [install Serenity on a physical PC.](https://github.com/SerenityOS/serenity/blob/master/INSTALL.md)
Later on, when you `git pull` to get the latest changes, there's no need to rebuild the toolchain. You can simply rerun **./makeall.sh** in the `Kernel/` directory and you'll be good to **./run** again. Later on, when you `git pull` to get the latest changes, there's no need to rebuild the toolchain. You can simply run `make install`, `make image`, `make run` again. CMake will only rebuild those parts that have been updated.
You can even re-compile only parts of the system. Imagine you changed something in the **WindowServer**. Then run `make -C ../Services/WindowServer` (from the `Kernel/` directory) followed by **./sync.sh** to update the disk image. Then you can start the system with **./run** again. You may also want to replace `make` with `ninja` in the above (use `cmake .. -G Ninja` when configuring the build) for some additional build speed benefits.
#### Ports #### Ports
To add a package from the ports collection to Serenity, for example curl, go into `Ports/curl/` and run **./package.sh**. The sourcecode for the package will be downloaded and the package will be built. After that, run **./sync.sh** from the `Kernel/` directory to update the disk image. The next time you start Serenity with **./run**, `curl` will be available. To add a package from the ports collection to Serenity, for example curl, go into `Ports/curl/` and run **./package.sh**. The sourcecode for the package will be downloaded and the package will be built. After that, run **./sync.sh** from the `Kernel/` directory to update the disk image. The next time you start Serenity with **./run**, `curl` will be available.

3
Games/CMakeLists.txt Normal file
View file

@ -0,0 +1,3 @@
add_subdirectory(Minesweeper)
add_subdirectory(Snake)
add_subdirectory(Solitaire)

View file

@ -1,3 +0,0 @@
SUBDIRS := $(patsubst %/Makefile,%/,$(wildcard */Makefile))
include ../Makefile.subdir

View file

@ -0,0 +1,7 @@
set(SOURCES
Field.cpp
main.cpp
)
serenity_bin(Minesweeper)
target_link_libraries(Minesweeper LibGUI)

View file

@ -1,9 +0,0 @@
OBJS = \
Field.o \
main.o
PROGRAM = Minesweeper
LIB_DEPS = GUI IPC Gfx Core
include ../../Makefile.common

View file

@ -0,0 +1,7 @@
set(SOURCES
main.cpp
SnakeGame.cpp
)
serenity_bin(Snake)
target_link_libraries(Snake LibGUI)

View file

@ -1,9 +0,0 @@
OBJS = \
SnakeGame.o \
main.o
PROGRAM = Snake
LIB_DEPS = GUI IPC Gfx Core
include ../../Makefile.common

View file

@ -0,0 +1,9 @@
set(SOURCES
Card.cpp
CardStack.cpp
main.cpp
SolitaireWidget.cpp
)
serenity_bin(Solitaire)
target_link_libraries(Solitaire LibGUI LibGfx LibCore)

View file

@ -1,11 +0,0 @@
OBJS = \
SolitaireWidget.o\
CardStack.o\
Card.o\
main.o
PROGRAM = Solitaire
LIB_DEPS = GUI Gfx IPC Core
include ../../Makefile.common

181
Kernel/CMakeLists.txt Normal file
View file

@ -0,0 +1,181 @@
set(KERNEL_SOURCES
ACPI/DMIDecoder.cpp
ACPI/DynamicParser.cpp
ACPI/Initialize.cpp
ACPI/MultiProcessorParser.cpp
ACPI/Parser.cpp
Arch/i386/CPU.cpp
CMOS.cpp
CommandLine.cpp
Devices/BlockDevice.cpp
Devices/BXVGADevice.cpp
Devices/CharacterDevice.cpp
Devices/Device.cpp
Devices/DiskPartition.cpp
Devices/EBRPartitionTable.cpp
Devices/FullDevice.cpp
Devices/GPTPartitionTable.cpp
Devices/KeyboardDevice.cpp
Devices/MBRPartitionTable.cpp
Devices/MBVGADevice.cpp
Devices/NullDevice.cpp
Devices/PATAChannel.cpp
Devices/PATADiskDevice.cpp
Devices/PCSpeaker.cpp
Devices/PS2MouseDevice.cpp
Devices/RandomDevice.cpp
Devices/SB16.cpp
Devices/SerialDevice.cpp
Devices/VMWareBackdoor.cpp
Devices/ZeroDevice.cpp
DoubleBuffer.cpp
FileSystem/Custody.cpp
FileSystem/DevPtsFS.cpp
FileSystem/Ext2FileSystem.cpp
FileSystem/FIFO.cpp
FileSystem/FileBackedFileSystem.cpp
FileSystem/File.cpp
FileSystem/FileDescription.cpp
FileSystem/FileSystem.cpp
FileSystem/Inode.cpp
FileSystem/InodeFile.cpp
FileSystem/InodeWatcher.cpp
FileSystem/ProcFS.cpp
FileSystem/TmpFS.cpp
FileSystem/VirtualFileSystem.cpp
Heap/kmalloc.cpp
Heap/SlabAllocator.cpp
init.cpp
Interrupts/APIC.cpp
Interrupts/GenericInterruptHandler.cpp
Interrupts/InterruptManagement.cpp
Interrupts/IOAPIC.cpp
Interrupts/IRQHandler.cpp
Interrupts/PIC.cpp
Interrupts/SharedIRQHandler.cpp
Interrupts/SpuriousInterruptHandler.cpp
Interrupts/UnhandledInterruptHandler.cpp
KBufferBuilder.cpp
KSyms.cpp
Lock.cpp
Net/E1000NetworkAdapter.cpp
Net/IPv4Socket.cpp
Net/LocalSocket.cpp
Net/LoopbackAdapter.cpp
Net/NetworkAdapter.cpp
Net/NetworkTask.cpp
Net/Routing.cpp
Net/RTL8139NetworkAdapter.cpp
Net/Socket.cpp
Net/TCPSocket.cpp
Net/UDPSocket.cpp
PCI/Access.cpp
PCI/Device.cpp
PCI/Initializer.cpp
PCI/IOAccess.cpp
PCI/MMIOAccess.cpp
PerformanceEventBuffer.cpp
Process.cpp
Profiling.cpp
Ptrace.cpp
Random.cpp
RTC.cpp
Scheduler.cpp
SharedBuffer.cpp
Syscall.cpp
Tasks/FinalizerTask.cpp
Tasks/SyncTask.cpp
Thread.cpp
ThreadTracer.cpp
Time/HardwareTimer.cpp
Time/HPETComparator.cpp
Time/HPET.cpp
Time/PIT.cpp
TimerQueue.cpp
Time/RTC.cpp
Time/TimeManagement.cpp
TTY/MasterPTY.cpp
TTY/PTYMultiplexer.cpp
TTY/SlavePTY.cpp
TTY/TTY.cpp
TTY/VirtualConsole.cpp
VM/AnonymousVMObject.cpp
VM/ContiguousVMObject.cpp
VM/InodeVMObject.cpp
VM/MemoryManager.cpp
VM/PageDirectory.cpp
VM/PhysicalPage.cpp
VM/PhysicalRegion.cpp
VM/PrivateInodeVMObject.cpp
VM/ProcessPagingScope.cpp
VM/PurgeableVMObject.cpp
VM/RangeAllocator.cpp
VM/Region.cpp
VM/SharedInodeVMObject.cpp
VM/VMObject.cpp
WaitQueue.cpp
)
set(AK_SOURCES
../AK/FileSystemPath.cpp
../AK/FlyString.cpp
../AK/JsonParser.cpp
../AK/JsonValue.cpp
../AK/LogStream.cpp
../AK/String.cpp
../AK/StringBuilder.cpp
../AK/StringImpl.cpp
../AK/StringUtils.cpp
../AK/StringView.cpp
)
set(ELF_SOURCES
../Libraries/LibELF/Image.cpp
../Libraries/LibELF/Loader.cpp
../Libraries/LibELF/Validation.cpp
)
set(BARE_METAL_SOURCES
../Libraries/LibBareMetal/Output/Console.cpp
../Libraries/LibBareMetal/Output/kprintf.cpp
../Libraries/LibBareMetal/StdLib.cpp
)
set(SOURCES
${KERNEL_SOURCES}
${AK_SOURCES}
${ELF_SOURCES}
${BARE_METAL_SOURCES}
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKERNEL")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pie -fPIE -ffreestanding -fbuiltin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-80387 -mno-mmx -mno-sse -mno-sse2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-asynchronous-unwind-tables")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib -nostdinc -nostdinc++")
add_link_options(LINKER:-T ${CMAKE_CURRENT_BINARY_DIR}/linker.ld -nostdlib)
add_library(boot OBJECT Arch/i386/Boot/boot.S)
file(GENERATE OUTPUT linker.ld INPUT linker.ld)
if (${CMAKE_HOST_SYSTEM_NAME} MATCHES SerenityOS)
include_directories(/usr/local/include/c++/9.3.0/)
include_directories(/usr/local/include/c++/9.3.0/i686-pc-serenity/)
else()
include_directories(../Toolchain/Local/i686-pc-serenity/include/c++/9.3.0/)
include_directories(../Toolchain/Local/i686-pc-serenity/include/c++/9.3.0/i686-pc-serenity/)
endif()
add_executable(Kernel ${SOURCES})
target_link_libraries(Kernel gcc stdc++)
add_dependencies(Kernel boot)
install(TARGETS Kernel RUNTIME DESTINATION boot)
add_custom_command(
TARGET Kernel
COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/mkmap.sh
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kernel.map DESTINATION res)
add_subdirectory(Modules)

View file

@ -26,12 +26,12 @@
#pragma once #pragma once
#include "KeyCode.h"
#include <AK/CircularQueue.h> #include <AK/CircularQueue.h>
#include <AK/DoublyLinkedList.h> #include <AK/DoublyLinkedList.h>
#include <AK/Types.h> #include <AK/Types.h>
#include <Kernel/Devices/CharacterDevice.h> #include <Kernel/Devices/CharacterDevice.h>
#include <Kernel/Interrupts/IRQHandler.h> #include <Kernel/Interrupts/IRQHandler.h>
#include <Kernel/KeyCode.h>
namespace Kernel { namespace Kernel {

View file

@ -24,10 +24,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "ProcFS.h"
#include "KSyms.h"
#include "Process.h"
#include "Scheduler.h"
#include <AK/JsonArraySerializer.h> #include <AK/JsonArraySerializer.h>
#include <AK/JsonObject.h> #include <AK/JsonObject.h>
#include <AK/JsonObjectSerializer.h> #include <AK/JsonObjectSerializer.h>
@ -38,11 +34,13 @@
#include <Kernel/FileSystem/Custody.h> #include <Kernel/FileSystem/Custody.h>
#include <Kernel/FileSystem/FileBackedFileSystem.h> #include <Kernel/FileSystem/FileBackedFileSystem.h>
#include <Kernel/FileSystem/FileDescription.h> #include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/FileSystem/ProcFS.h>
#include <Kernel/FileSystem/VirtualFileSystem.h> #include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/Heap/kmalloc.h> #include <Kernel/Heap/kmalloc.h>
#include <Kernel/Interrupts/GenericInterruptHandler.h> #include <Kernel/Interrupts/GenericInterruptHandler.h>
#include <Kernel/Interrupts/InterruptManagement.h> #include <Kernel/Interrupts/InterruptManagement.h>
#include <Kernel/KBufferBuilder.h> #include <Kernel/KBufferBuilder.h>
#include <Kernel/KSyms.h>
#include <Kernel/Module.h> #include <Kernel/Module.h>
#include <Kernel/Net/LocalSocket.h> #include <Kernel/Net/LocalSocket.h>
#include <Kernel/Net/NetworkAdapter.h> #include <Kernel/Net/NetworkAdapter.h>
@ -50,7 +48,9 @@
#include <Kernel/Net/TCPSocket.h> #include <Kernel/Net/TCPSocket.h>
#include <Kernel/Net/UDPSocket.h> #include <Kernel/Net/UDPSocket.h>
#include <Kernel/PCI/Access.h> #include <Kernel/PCI/Access.h>
#include <Kernel/Process.h>
#include <Kernel/Profiling.h> #include <Kernel/Profiling.h>
#include <Kernel/Scheduler.h>
#include <Kernel/TTY/TTY.h> #include <Kernel/TTY/TTY.h>
#include <Kernel/VM/MemoryManager.h> #include <Kernel/VM/MemoryManager.h>
#include <Kernel/VM/PurgeableVMObject.h> #include <Kernel/VM/PurgeableVMObject.h>

View file

@ -26,7 +26,7 @@
#include <AK/PrintfImplementation.h> #include <AK/PrintfImplementation.h>
#include <AK/StdLibExtras.h> #include <AK/StdLibExtras.h>
#include <KBufferBuilder.h> #include <Kernel/KBufferBuilder.h>
#include <stdarg.h> #include <stdarg.h>
namespace Kernel { namespace Kernel {

View file

@ -1,171 +0,0 @@
OBJS = \
../AK/FileSystemPath.o \
../AK/FlyString.o \
../AK/JsonParser.o \
../AK/JsonValue.o \
../AK/LogStream.o \
../AK/String.o \
../AK/StringBuilder.o \
../AK/StringImpl.o \
../AK/StringUtils.o \
../AK/StringView.o \
../Libraries/LibELF/Image.o \
../Libraries/LibELF/Loader.o \
../Libraries/LibELF/Validation.o \
../Libraries/LibBareMetal/Output/Console.o \
../Libraries/LibBareMetal/Output/kprintf.o \
../Libraries/LibBareMetal/StdLib.o \
Arch/i386/CPU.o \
CommandLine.o \
Interrupts/InterruptManagement.o \
Interrupts/APIC.o \
Interrupts/IOAPIC.o \
Interrupts/PIC.o \
Interrupts/GenericInterruptHandler.o \
Interrupts/UnhandledInterruptHandler.o \
Interrupts/SpuriousInterruptHandler.o \
Interrupts/IRQHandler.o \
Interrupts/SharedIRQHandler.o \
CMOS.o \
Time/PIT.o \
Time/TimeManagement.o \
Time/HardwareTimer.o \
Time/RTC.o \
Time/HPET.o \
Time/HPETComparator.o \
Devices/BXVGADevice.o \
Devices/BlockDevice.o \
Devices/CharacterDevice.o \
Devices/Device.o \
Devices/DiskPartition.o \
Devices/FullDevice.o \
Devices/GPTPartitionTable.o \
Devices/EBRPartitionTable.o \
Devices/KeyboardDevice.o \
Devices/MBRPartitionTable.o \
Devices/MBVGADevice.o \
Devices/NullDevice.o \
Devices/PATAChannel.o \
Devices/PATADiskDevice.o \
Devices/PCSpeaker.o \
Devices/PS2MouseDevice.o \
Devices/RandomDevice.o \
Devices/SB16.o \
Devices/SerialDevice.o \
Devices/ZeroDevice.o \
Devices/VMWareBackdoor.o \
DoubleBuffer.o \
FileSystem/Custody.o \
FileSystem/DevPtsFS.o \
FileSystem/Ext2FileSystem.o \
FileSystem/FileBackedFileSystem.o \
FileSystem/FIFO.o \
FileSystem/File.o \
FileSystem/FileDescription.o \
FileSystem/FileSystem.o \
FileSystem/Inode.o \
FileSystem/InodeFile.o \
FileSystem/InodeWatcher.o \
FileSystem/ProcFS.o \
FileSystem/TmpFS.o \
FileSystem/VirtualFileSystem.o \
Heap/SlabAllocator.o \
Heap/kmalloc.o \
KBufferBuilder.o \
KSyms.o \
Lock.o \
Net/E1000NetworkAdapter.o \
Net/IPv4Socket.o \
Net/LocalSocket.o \
Net/LoopbackAdapter.o \
Net/NetworkAdapter.o \
Net/NetworkTask.o \
Net/RTL8139NetworkAdapter.o \
Net/Routing.o \
Net/Socket.o \
Net/TCPSocket.o \
Net/UDPSocket.o \
PCI/Access.o \
PCI/IOAccess.o \
PCI/MMIOAccess.o \
PCI/Initializer.o \
PCI/Device.o \
PerformanceEventBuffer.o \
Process.o \
ThreadTracer.o \
Profiling.o \
RTC.o \
Random.o \
Scheduler.o \
SharedBuffer.o \
Syscall.o \
Tasks/FinalizerTask.o \
Tasks/SyncTask.o \
TimerQueue.o \
TTY/MasterPTY.o \
TTY/PTYMultiplexer.o \
TTY/SlavePTY.o \
TTY/TTY.o \
TTY/VirtualConsole.o \
Thread.o \
VM/AnonymousVMObject.o \
VM/ContiguousVMObject.o \
VM/InodeVMObject.o \
VM/MemoryManager.o \
VM/PageDirectory.o \
VM/PhysicalPage.o \
VM/PhysicalRegion.o \
VM/PurgeableVMObject.o \
VM/PrivateInodeVMObject.o \
VM/ProcessPagingScope.o \
VM/RangeAllocator.o \
VM/Region.o \
VM/SharedInodeVMObject.o \
VM/VMObject.o \
ACPI/DMIDecoder.o \
ACPI/DynamicParser.o \
ACPI/Initialize.o \
ACPI/MultiProcessorParser.o \
ACPI/Parser.o \
WaitQueue.o \
init.o \
Ptrace.o
OBJ_SUFFIX = .kernel
MODULE_OBJS = TestModule$(OBJ_SUFFIX).o
EXTRA_OBJS = Arch/i386/Boot/boot.ao
KERNEL = 1
PROGRAM = kernel
SUBPROJECT_CXXFLAGS += -pie -fPIE -ffreestanding -fbuiltin -mno-80387 -mno-mmx -mno-sse -mno-sse2 -fno-asynchronous-unwind-tables
SUBPROJECT_CXXFLAGS += -nostdlib -nostdinc -nostdinc++ $(SERENITY_KERNEL_CUSTOM_CXXFLAGS)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),SerenityOS)
SUBPROJECT_CXXFLAGS += -I/usr/local/include/c++/9.3.0/
SUBPROJECT_CXXFLAGS += -I/usr/local/include/c++/9.3.0/i686-pc-serenity/
else
SUBPROJECT_CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/9.3.0/
SUBPROJECT_CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/9.3.0/i686-pc-serenity/
endif
LDFLAGS += -Wl,-T linker.ld -nostdlib -lgcc -lstdc++ $(SERENITY_KERNEL_CUSTOM_LDFLAGS)
all: $(PROGRAM) $(MODULE_OBJS) kernel.map
kernel.map: kernel
@echo "MKMAP $@"
$(QUIET) sh mkmap.sh
EXTRA_CLEAN += kernel.map
install:
mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/Kernel/
cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/Kernel/
include ../Makefile.common

View file

@ -0,0 +1,8 @@
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
function(serenity_kernel_module name sources)
add_library(${name} STATIC ${sources})
install(FILES $<TARGET_OBJECTS:${name}> DESTINATION mod)
endfunction()
serenity_kernel_module(TestModule TestModule.cpp)

View file

@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "Process.h" #include <Kernel/Process.h>
#include <Kernel/TTY/TTY.h> #include <Kernel/TTY/TTY.h>
#include <LibC/errno_numbers.h> #include <LibC/errno_numbers.h>
#include <LibC/signal_numbers.h> #include <LibC/signal_numbers.h>

View file

@ -24,14 +24,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "CMOS.h"
#include "Process.h"
#include <AK/Assertions.h> #include <AK/Assertions.h>
#include <AK/Memory.h> #include <AK/Memory.h>
#include <AK/StringView.h> #include <AK/StringView.h>
#include <Kernel/Arch/i386/CPU.h> #include <Kernel/Arch/i386/CPU.h>
#include <Kernel/CMOS.h>
#include <Kernel/FileSystem/Inode.h> #include <Kernel/FileSystem/Inode.h>
#include <Kernel/Multiboot.h> #include <Kernel/Multiboot.h>
#include <Kernel/Process.h>
#include <Kernel/VM/AnonymousVMObject.h> #include <Kernel/VM/AnonymousVMObject.h>
#include <Kernel/VM/ContiguousVMObject.h> #include <Kernel/VM/ContiguousVMObject.h>
#include <Kernel/VM/MemoryManager.h> #include <Kernel/VM/MemoryManager.h>

View file

@ -1,228 +0,0 @@
#!/bin/sh
set -e
wheel_gid=1
tty_gid=2
phys_gid=3
audio_gid=4
window_uid=13
window_gid=13
die() {
echo "die: $*"
exit 1
}
if [ "$(id -u)" != 0 ]; then
die "this script needs to run as root"
fi
umask 0022
printf "creating initial filesystem structure... "
for dir in bin etc proc mnt tmp; do
mkdir -p mnt/$dir
done
chmod 1777 mnt/tmp
echo "done"
printf "setting up device nodes... "
mkdir -p mnt/dev
mkdir -p mnt/dev/pts
mknod mnt/dev/fb0 b 29 0
chmod 660 mnt/dev/fb0
chown 0:$phys_gid mnt/dev/fb0
mknod mnt/dev/tty0 c 4 0
mknod mnt/dev/tty1 c 4 1
mknod mnt/dev/tty2 c 4 2
mknod mnt/dev/tty3 c 4 3
mknod mnt/dev/ttyS0 c 4 64
mknod mnt/dev/ttyS1 c 4 65
mknod mnt/dev/ttyS2 c 4 66
mknod mnt/dev/ttyS3 c 4 67
for tty in 0 1 2 3 S0 S1 S2 S3; do
chmod 620 mnt/dev/tty$tty
chown 0:$tty_gid mnt/dev/tty$tty
done
mknod mnt/dev/random c 1 8
mknod mnt/dev/null c 1 3
mknod mnt/dev/zero c 1 5
mknod mnt/dev/full c 1 7
# random, is failing (randomly) on fuse-ext2 on macos :)
chmod 666 mnt/dev/random || true
chmod 666 mnt/dev/null
chmod 666 mnt/dev/zero
chmod 666 mnt/dev/full
mknod mnt/dev/keyboard c 85 1
chmod 440 mnt/dev/keyboard
chown 0:$phys_gid mnt/dev/keyboard
mknod mnt/dev/mouse c 10 1
chmod 440 mnt/dev/mouse
chown 0:$phys_gid mnt/dev/mouse
mknod mnt/dev/audio c 42 42
chmod 220 mnt/dev/audio
chown 0:$audio_gid mnt/dev/audio
mknod mnt/dev/ptmx c 5 2
chmod 666 mnt/dev/ptmx
mknod mnt/dev/hda b 3 0
mknod mnt/dev/hdb b 3 1
mknod mnt/dev/hdc b 4 0
mknod mnt/dev/hdd b 4 1
for hd in a b c d; do
chmod 600 mnt/dev/hd$hd
done
ln -s /proc/self/fd/0 mnt/dev/stdin
ln -s /proc/self/fd/1 mnt/dev/stdout
ln -s /proc/self/fd/2 mnt/dev/stderr
echo "done"
printf "installing base system... "
cp -R ../Base/* mnt/
cp -R ../Root/* mnt/
cp kernel.map mnt/res/
chmod 400 mnt/res/kernel.map
chmod 660 mnt/etc/WindowServer/WindowServer.ini
chown $window_uid:$window_gid mnt/etc/WindowServer/WindowServer.ini
echo "/bin/sh" > mnt/etc/shells
echo "done"
printf "installing users... "
mkdir -p mnt/root
mkdir -p mnt/home/anon
mkdir -p mnt/home/anon/Desktop
mkdir -p mnt/home/anon/Downloads
mkdir -p mnt/home/nona
cp ../ReadMe.md mnt/home/anon/
cp -r ../Libraries/LibJS/Tests mnt/home/anon/js-tests
chmod 700 mnt/root
chmod 700 mnt/home/anon
chmod 700 mnt/home/nona
chown -R 0:0 mnt/root
chown -R 100:100 mnt/home/anon
chown -R 200:200 mnt/home/nona
echo "done"
printf "installing userland... "
if [ "$(uname -s)" = "Darwin" ]; then
find ../Userland/ -type f -perm +111 -exec cp {} mnt/bin/ \;
elif [ "$(uname -s)" = "OpenBSD" ] || [ "$(uname -s)" = "FreeBSD" ]; then
find ../Userland/ -type f -perm -555 -exec cp {} mnt/bin/ \;
else
find ../Userland/ -type f -executable -exec cp {} mnt/bin/ \;
fi
chown 0:$wheel_gid mnt/bin/su
chown 0:$phys_gid mnt/bin/shutdown
chown 0:$phys_gid mnt/bin/reboot
chmod 4750 mnt/bin/su
chmod 4755 mnt/bin/ping
chmod 4750 mnt/bin/reboot
chmod 4750 mnt/bin/shutdown
echo "done"
printf "installing applications... "
cp ../Applications/About/About mnt/bin/About
cp ../Applications/FileManager/FileManager mnt/bin/FileManager
cp ../Applications/FontEditor/FontEditor mnt/bin/FontEditor
cp ../Applications/IRCClient/IRCClient mnt/bin/IRCClient
cp ../Applications/SystemMonitor/SystemMonitor mnt/bin/SystemMonitor
cp ../Applications/Terminal/Terminal mnt/bin/Terminal
cp ../Applications/TextEditor/TextEditor mnt/bin/TextEditor
cp ../Applications/HexEditor/HexEditor mnt/bin/HexEditor
cp ../Applications/PaintBrush/PaintBrush mnt/bin/PaintBrush
cp ../Applications/QuickShow/QuickShow mnt/bin/QuickShow
cp ../Applications/Piano/Piano mnt/bin/Piano
cp ../Applications/Calculator/Calculator mnt/bin/Calculator
cp ../Applications/Calendar/Calendar mnt/bin/Calendar
cp ../Applications/SoundPlayer/SoundPlayer mnt/bin/SoundPlayer
cp ../Applications/DisplaySettings/DisplaySettings mnt/bin/DisplaySettings
cp ../Applications/Welcome/Welcome mnt/bin/Welcome
cp ../Applications/Help/Help mnt/bin/Help
cp ../Applications/Browser/Browser mnt/bin/Browser
cp ../Applications/Debugger/Debugger mnt/bin/sdb
cp ../Games/Solitaire/Solitaire mnt/bin/Solitaire
cp ../Demos/HelloWorld/HelloWorld mnt/bin/HelloWorld
cp ../Demos/WidgetGallery/WidgetGallery mnt/bin/WidgetGallery
cp ../Demos/Cube/Cube mnt/bin/Cube
cp ../Demos/Screensaver/Screensaver mnt/bin/Screensaver
cp ../Demos/Fire/Fire mnt/bin/Fire
cp ../Demos/LibGfxDemo/LibGfxDemo mnt/bin/LibGfxDemo
cp ../Demos/Mouse/Mouse mnt/bin/Mouse
cp ../Demos/DynamicLink/LinkDemo/LinkDemo mnt/bin/LinkDemo
cp ../DevTools/HackStudio/HackStudio mnt/bin/HackStudio
cp ../DevTools/VisualBuilder/VisualBuilder mnt/bin/VisualBuilder
cp ../DevTools/Inspector/Inspector mnt/bin/Inspector
cp ../DevTools/ProfileViewer/ProfileViewer mnt/bin/ProfileViewer
cp ../Games/Minesweeper/Minesweeper mnt/bin/Minesweeper
cp ../Games/Snake/Snake mnt/bin/Snake
cp ../Services/DHCPClient/DHCPClient mnt/bin/DHCPClient
cp ../Services/LookupServer/LookupServer mnt/bin/LookupServer
cp ../Services/SystemServer/SystemServer mnt/bin/SystemServer
cp ../Services/WindowServer/WindowServer mnt/bin/WindowServer
cp ../Services/AudioServer/AudioServer mnt/bin/AudioServer
cp ../Services/TTYServer/TTYServer mnt/bin/TTYServer
cp ../Services/Taskbar/Taskbar mnt/bin/Taskbar
cp ../Services/TelnetServer/TelnetServer mnt/bin/TelnetServer
cp ../Services/ProtocolServer/ProtocolServer mnt/bin/ProtocolServer
cp ../Services/SystemMenu/SystemMenu mnt/bin/SystemMenu
cp ../Services/NotificationServer/NotificationServer mnt/bin/NotificationServer
cp ../Services/WebServer/WebServer mnt/bin/WebServer
cp ../Services/LaunchServer/LaunchServer mnt/bin/LaunchServer
cp ../Shell/Shell mnt/bin/Shell
cp ../MenuApplets/Audio/Audio.MenuApplet mnt/bin/
cp ../MenuApplets/ResourceGraph/ResourceGraph.MenuApplet mnt/bin/
cp ../MenuApplets/Clock/Clock.MenuApplet mnt/bin/
cp ../MenuApplets/UserName/UserName.MenuApplet mnt/bin
echo "done"
printf "installing dynamic libraries... "
cp ../Demos/DynamicLink/LinkLib/libDynamicLib.so mnt/usr/lib
echo "done"
printf "installing shortcuts... "
ln -s FileManager mnt/bin/fm
ln -s HelloWorld mnt/bin/hw
ln -s IRCClient mnt/bin/irc
ln -s Minesweeper mnt/bin/ms
ln -s Shell mnt/bin/sh
ln -s Snake mnt/bin/sn
ln -s Taskbar mnt/bin/tb
ln -s VisualBuilder mnt/bin/vb
ln -s WidgetGallery mnt/bin/wg
ln -s TextEditor mnt/bin/te
ln -s HexEditor mnt/bin/he
ln -s PaintBrush mnt/bin/pb
ln -s QuickShow mnt/bin/qs
ln -s Piano mnt/bin/pi
ln -s SystemDialog mnt/bin/sd
ln -s Calculator mnt/bin/calc
ln -s Calendar mnt/bin/calendar
ln -s Inspector mnt/bin/ins
ln -s SoundPlayer mnt/bin/sp
ln -s Help mnt/bin/help
ln -s Browser mnt/bin/br
ln -s HackStudio mnt/bin/hs
ln -s SystemMonitor mnt/bin/sm
ln -s ProfileViewer mnt/bin/pv
ln -s WebServer mnt/bin/ws
ln -s Solitaire mnt/bin/sl
echo "done"
mkdir -p mnt/boot/
chmod 700 mnt/boot/
cp kernel mnt/boot/
chmod 600 mnt/boot/kernel
mkdir -p mnt/mod/
chmod 700 mnt/mod/
cp TestModule.kernel.o mnt/mod/TestModule.o
chmod 600 mnt/mod/*.o
# Run local sync script, if it exists
if [ -f sync-local.sh ]; then
sh sync-local.sh
fi

View file

@ -8,7 +8,7 @@ SECTIONS
.text ALIGN(4K) : AT (ADDR(.text) - 0xc0000000) .text ALIGN(4K) : AT (ADDR(.text) - 0xc0000000)
{ {
Arch/i386/Boot/boot.ao $<TARGET_OBJECTS:boot>
*(.multiboot) *(.multiboot)
start_of_kernel_text = .; start_of_kernel_text = .;
*(.text) *(.text)

Some files were not shown because too many files have changed in this diff Show more