all: Reorder directory structure
All checks were successful
Build and test / build (push) Successful in 1m56s

Why are command-line utilities stored in "apps"?
And why are apps like "editor" or "terminal" top-level directories?
Command-line utilities now go in "utils".
GUI stuff now goes in "gui".
This includes: libui -> gui/libui, wind -> gui/wind, GUI apps -> gui/apps, editor&terminal -> gui/apps...
System services go in "system".
This commit is contained in:
apio 2024-07-21 13:24:46 +02:00
parent 829f455129
commit 140910763e
Signed by: apio
GPG Key ID: B8A7D06E42258954
100 changed files with 92 additions and 65 deletions

View File

@ -45,12 +45,10 @@ endif()
add_subdirectory(libluna) add_subdirectory(libluna)
add_subdirectory(libos) add_subdirectory(libos)
add_subdirectory(libui) add_subdirectory(gui)
add_subdirectory(libc) add_subdirectory(libc)
add_subdirectory(kernel) add_subdirectory(kernel)
add_subdirectory(apps) add_subdirectory(utils)
add_subdirectory(tests) add_subdirectory(tests)
add_subdirectory(shell) add_subdirectory(shell)
add_subdirectory(wind) add_subdirectory(system)
add_subdirectory(terminal)
add_subdirectory(editor)

View File

@ -1,56 +0,0 @@
function(luna_app SOURCE_FILE APP_NAME)
add_executable(${APP_NAME} ${SOURCE_FILE})
target_compile_options(${APP_NAME} PRIVATE -Os ${COMMON_FLAGS} -Wno-write-strings)
add_dependencies(${APP_NAME} libc)
target_include_directories(${APP_NAME} PRIVATE ${LUNA_BASE}/usr/include)
target_link_libraries(${APP_NAME} PRIVATE os)
install(TARGETS ${APP_NAME} DESTINATION ${LUNA_BASE}/usr/bin)
endfunction()
add_executable(preinit preinit.cpp)
target_compile_options(preinit PRIVATE -Os ${COMMON_FLAGS} -Wno-write-strings)
add_dependencies(preinit libc)
target_include_directories(preinit PRIVATE ${LUNA_BASE}/usr/include)
install(TARGETS preinit DESTINATION ${LUNA_ROOT}/initrd/bin)
luna_app(init.cpp init)
luna_app(env.cpp env)
luna_app(su.cpp su)
luna_app(cat.cpp cat)
luna_app(date.cpp date)
luna_app(edit.cpp edit)
luna_app(ls.cpp ls)
luna_app(chown.cpp chown)
luna_app(chmod.cpp chmod)
luna_app(mkdir.cpp mkdir)
luna_app(rm.cpp rm)
luna_app(stat.cpp stat)
luna_app(uname.cpp uname)
luna_app(base64.cpp base64)
luna_app(login.cpp login)
luna_app(mount.cpp mount)
luna_app(umount.cpp umount)
luna_app(ps.cpp ps)
luna_app(time.cpp time)
luna_app(ln.cpp ln)
luna_app(mktemp.cpp mktemp)
luna_app(sysfuzz.cpp sysfuzz)
luna_app(cp.cpp cp)
luna_app(kill.cpp kill)
luna_app(gol.cpp gol)
target_link_libraries(gol PUBLIC ui)
luna_app(touch.cpp touch)
luna_app(free.cpp free)
luna_app(about.cpp about)
target_link_libraries(about PUBLIC ui)
luna_app(taskbar.cpp taskbar)
target_link_libraries(taskbar PUBLIC ui)
luna_app(2048.cpp 2048)
target_link_libraries(2048 PUBLIC ui)
luna_app(clock.cpp clock)
target_link_libraries(clock PUBLIC ui)
luna_app(startui.cpp startui)
luna_app(launch.cpp launch)
luna_app(run.cpp run)
luna_app(sha256sum.cpp sha256sum)
luna_app(arch.cpp arch)

View File

@ -90,7 +90,7 @@ After the kernel stage of the boot process, the system looks like this:
``` ```
## Stage 2: preinit ## Stage 2: preinit
_Relevant files: [apps/preinit.cpp](../apps/preinit.cpp)_ _Relevant files: [system/preinit.cpp](../system/preinit.cpp)_
Luna's userspace init process is split into two programs: `/bin/preinit`, which resides on the initial ramdisk, and `/usr/bin/init`, which resides on the root partition. Luna's userspace init process is split into two programs: `/bin/preinit`, which resides on the initial ramdisk, and `/usr/bin/init`, which resides on the root partition.
@ -133,7 +133,7 @@ After the preinit stage of the boot process, the system looks like this:
``` ```
## Stage 3: init ## Stage 3: init
_Relevant files: [apps/init.cpp](../apps/init.cpp#L406)_ _Relevant files: [system/init.cpp](../system/init.cpp#L406)_
`/usr/bin/init` is the actual init system. It is in charge of starting user-defined services. `/usr/bin/init` is the actual init system. It is in charge of starting user-defined services.
@ -178,7 +178,7 @@ After the init stage of the boot process, the system looks like this:
_Note: startui is PID 13 because the `00-home` service is a shell script, which starts a few subprocesses. Since Luna does not allow for PID reuse right now, startui ends up with PID 13._ _Note: startui is PID 13 because the `00-home` service is a shell script, which starts a few subprocesses. Since Luna does not allow for PID reuse right now, startui ends up with PID 13._
## Stage 4: startui ## Stage 4: startui
_Relevant files: [apps/startui.cpp](../apps/startui.cpp), [wind/main.cpp](../wind/main.cpp)_ _Relevant files: [system/startui.cpp](../system/startui.cpp), [gui/wind/main.cpp](../gui/wind/main.cpp)_
`/usr/bin/startui` starts a graphical user session. `/usr/bin/startui` starts a graphical user session.

15
gui/CMakeLists.txt Normal file
View File

@ -0,0 +1,15 @@
function(luna_service SOURCE_FILE APP_NAME)
add_executable(${APP_NAME} ${SOURCE_FILE})
target_compile_options(${APP_NAME} PRIVATE -Os ${COMMON_FLAGS} -Wno-write-strings)
add_dependencies(${APP_NAME} libc)
target_include_directories(${APP_NAME} PRIVATE ${LUNA_BASE}/usr/include)
target_link_libraries(${APP_NAME} PRIVATE os)
install(TARGETS ${APP_NAME} DESTINATION ${LUNA_BASE}/usr/bin)
endfunction()
add_subdirectory(libui)
add_subdirectory(wind)
add_subdirectory(apps)
luna_service(launch.cpp launch)
luna_service(run.cpp run)

17
gui/apps/CMakeLists.txt Normal file
View File

@ -0,0 +1,17 @@
function(luna_app SOURCE_FILE APP_NAME)
add_executable(${APP_NAME} ${SOURCE_FILE})
target_compile_options(${APP_NAME} PRIVATE -Os ${COMMON_FLAGS} -Wno-write-strings)
add_dependencies(${APP_NAME} libc)
target_include_directories(${APP_NAME} PRIVATE ${LUNA_BASE}/usr/include)
target_link_libraries(${APP_NAME} PRIVATE os ui)
install(TARGETS ${APP_NAME} DESTINATION ${LUNA_BASE}/usr/bin)
endfunction()
luna_app(about.cpp about)
luna_app(taskbar.cpp taskbar)
luna_app(2048.cpp 2048)
luna_app(clock.cpp clock)
luna_app(gol.cpp gol)
add_subdirectory(editor)
add_subdirectory(terminal)

17
system/CMakeLists.txt Normal file
View File

@ -0,0 +1,17 @@
function(luna_service SOURCE_FILE APP_NAME)
add_executable(${APP_NAME} ${SOURCE_FILE})
target_compile_options(${APP_NAME} PRIVATE -Os ${COMMON_FLAGS} -Wno-write-strings)
add_dependencies(${APP_NAME} libc)
target_include_directories(${APP_NAME} PRIVATE ${LUNA_BASE}/usr/include)
target_link_libraries(${APP_NAME} PRIVATE os)
install(TARGETS ${APP_NAME} DESTINATION ${LUNA_BASE}/usr/bin)
endfunction()
add_executable(preinit preinit.cpp)
target_compile_options(preinit PRIVATE -Os ${COMMON_FLAGS} -Wno-write-strings)
add_dependencies(preinit libc)
target_include_directories(preinit PRIVATE ${LUNA_BASE}/usr/include)
install(TARGETS preinit DESTINATION ${LUNA_ROOT}/initrd/bin)
luna_service(init.cpp init)
luna_service(startui.cpp startui)

View File

@ -14,6 +14,6 @@ mkdir -p $LUNA_BASE/usr/include/moon
cp --preserve=timestamps -RT libc/include/ $LUNA_BASE/usr/include cp --preserve=timestamps -RT libc/include/ $LUNA_BASE/usr/include
cp --preserve=timestamps -RT libluna/include/luna/ $LUNA_BASE/usr/include/luna cp --preserve=timestamps -RT libluna/include/luna/ $LUNA_BASE/usr/include/luna
cp --preserve=timestamps -RT libui/include/ui/ $LUNA_BASE/usr/include/ui cp --preserve=timestamps -RT gui/libui/include/ui/ $LUNA_BASE/usr/include/ui
cp --preserve=timestamps -RT libos/include/os/ $LUNA_BASE/usr/include/os cp --preserve=timestamps -RT libos/include/os/ $LUNA_BASE/usr/include/os
cp --preserve=timestamps -RT kernel/src/api/ $LUNA_BASE/usr/include/moon cp --preserve=timestamps -RT kernel/src/api/ $LUNA_BASE/usr/include/moon

36
utils/CMakeLists.txt Normal file
View File

@ -0,0 +1,36 @@
function(luna_utility SOURCE_FILE APP_NAME)
add_executable(${APP_NAME} ${SOURCE_FILE})
target_compile_options(${APP_NAME} PRIVATE -Os ${COMMON_FLAGS} -Wno-write-strings)
add_dependencies(${APP_NAME} libc)
target_include_directories(${APP_NAME} PRIVATE ${LUNA_BASE}/usr/include)
target_link_libraries(${APP_NAME} PRIVATE os)
install(TARGETS ${APP_NAME} DESTINATION ${LUNA_BASE}/usr/bin)
endfunction()
luna_utility(env.cpp env)
luna_utility(su.cpp su)
luna_utility(cat.cpp cat)
luna_utility(date.cpp date)
luna_utility(edit.cpp edit)
luna_utility(ls.cpp ls)
luna_utility(chown.cpp chown)
luna_utility(chmod.cpp chmod)
luna_utility(mkdir.cpp mkdir)
luna_utility(rm.cpp rm)
luna_utility(stat.cpp stat)
luna_utility(uname.cpp uname)
luna_utility(base64.cpp base64)
luna_utility(login.cpp login)
luna_utility(mount.cpp mount)
luna_utility(umount.cpp umount)
luna_utility(ps.cpp ps)
luna_utility(time.cpp time)
luna_utility(ln.cpp ln)
luna_utility(mktemp.cpp mktemp)
luna_utility(sysfuzz.cpp sysfuzz)
luna_utility(cp.cpp cp)
luna_utility(kill.cpp kill)
luna_utility(touch.cpp touch)
luna_utility(free.cpp free)
luna_utility(sha256sum.cpp sha256sum)
luna_utility(arch.cpp arch)