Skip to content

Commit

Permalink
LibC+LibRegex: Move regex_defs.h from LibC to LibRegex
Browse files Browse the repository at this point in the history
This is needed to avoid including LibC headers in Lagom builds.
  • Loading branch information
implicitfield authored and awesomekling committed Jun 27, 2023
1 parent ec636a4 commit 7d19abd
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
12 changes: 9 additions & 3 deletions Toolchain/BuildClang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,20 @@ popd
# === COPY HEADERS ===

SRC_ROOT=$($REALPATH "$DIR"/..)
FILES=$(find "$SRC_ROOT"/Kernel/API "$SRC_ROOT"/Userland/Libraries/LibC -name '*.h' -print)

FILES=$(find \
"$SRC_ROOT"/Kernel/API \
"$SRC_ROOT"/Userland/Libraries/LibC \
"$SRC_ROOT"/Userland/Libraries/LibRegex/RegexDefs.h \
-name '*.h' -print)
for arch in $ARCHS; do
mkdir -p "$BUILD/${arch}clang"
pushd "$BUILD/${arch}clang"
mkdir -p Root/usr/include/
for header in $FILES; do
target=$(echo "$header" | "$SED" -e "s|$SRC_ROOT/Userland/Libraries/LibC||" -e "s|$SRC_ROOT/Kernel/|Kernel/|")
target=$(echo "$header" | "$SED" \
-e "s|$SRC_ROOT/Userland/Libraries/LibC||" \
-e "s|$SRC_ROOT/Kernel/|Kernel/|" \
-e "s|$SRC_ROOT/Userland/Libraries/LibRegex/|LibRegex/|")
buildstep "system_headers" "$INSTALL" -D "$header" "Root/usr/include/$target"
done
popd
Expand Down
4 changes: 3 additions & 1 deletion Toolchain/BuildGNU.sh
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,14 @@ pushd "$DIR/Build/$ARCH"
"$SRC_ROOT"/Kernel/API \
"$SRC_ROOT"/Kernel/Arch \
"$SRC_ROOT"/Userland/Libraries/LibC \
"$SRC_ROOT"/Userland/Libraries/LibRegex/RegexDefs.h \
-name '*.h' -print)
for header in $FILES; do
target=$(echo "$header" | sed \
-e "s|$SRC_ROOT/AK/|AK/|" \
-e "s|$SRC_ROOT/Userland/Libraries/LibC||" \
-e "s|$SRC_ROOT/Kernel/|Kernel/|")
-e "s|$SRC_ROOT/Kernel/|Kernel/|" \
-e "s|$SRC_ROOT/Userland/Libraries/LibRegex/|LibRegex/|")
buildstep "system_headers" mkdir -p "$(dirname "Root/usr/include/$target")"
buildstep "system_headers" $INSTALL "$header" "Root/usr/include/$target"
done
Expand Down
2 changes: 1 addition & 1 deletion Userland/Libraries/LibC/regex.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#pragma once

#include "bits/regex_defs.h"
#include <LibRegex/RegexDefs.h>
#include <stddef.h>
#include <sys/cdefs.h>
#include <sys/types.h>
Expand Down
File renamed without changes.
6 changes: 1 addition & 5 deletions Userland/Libraries/LibRegex/RegexError.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@

#pragma once

#include "RegexDefs.h"
#include <AK/StringView.h>
#include <AK/Types.h>
#ifdef AK_OS_SERENITY
# include <bits/regex_defs.h>
#else
# include <LibC/bits/regex_defs.h>
#endif

namespace regex {

Expand Down
6 changes: 1 addition & 5 deletions Userland/Libraries/LibRegex/RegexOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@

#pragma once

#include "RegexDefs.h"
#include <AK/Types.h>
#include <stdio.h>
#ifdef AK_OS_SERENITY
# include <bits/regex_defs.h>
#else
# include <LibC/bits/regex_defs.h>
#endif

namespace regex {

Expand Down

0 comments on commit 7d19abd

Please sign in to comment.