Skip to content

Commit fd8446e

Browse files
committed
wip
1 parent 372e5f1 commit fd8446e

File tree

3 files changed

+47
-28
lines changed

3 files changed

+47
-28
lines changed

.devcontainer/devcontainer.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"dockerComposeFile": "../docker-compose.yml",
44
"service": "build",
55
"workspaceFolder": "/workspace",
6-
6+
77
"customizations": {
88
"vscode": {
99
"extensions": [
@@ -20,15 +20,12 @@
2020
}
2121
}
2222
},
23-
24-
"postCreateCommand": "/bin/bash -lc 'source /opt/emsdk/emsdk_env.sh && echo \"Emscripten environment ready!\"'",
25-
23+
24+
"postCreateCommand": "/bin/bash -lc 'if [ -f /opt/emsdk/emsdk_env.sh ]; then source /opt/emsdk/emsdk_env.sh; fi; echo \"Emscripten environment ready!\"'",
25+
2626
"remoteUser": "root",
27-
27+
2828
"features": {
2929
"ghcr.io/devcontainers/features/git:1": {}
3030
}
31-
}
32-
33-
34-
31+
}

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
* text=auto eol=lf
2+
3+
*.sh text eol=lf
4+
*.ac text eol=lf
5+
*.am text eol=lf
6+
*.m4 text eol=lf
7+
configure text eol=lf
8+
Makefile.am text eol=lf
9+
Makefile.in text eol=lf

Dockerfile

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
FROM ubuntu:22.04
22

3-
# 환경 변수 설정 (tzdata 설치 시 대화형 프롬프트 방지)
43
ENV DEBIAN_FRONTEND=noninteractive
54
ENV EMSDK=/opt/emsdk
65

7-
# 필수 도구 및 의존성 설치
6+
# ⬇️ dos2unix / gettext 추가 (gettext는 일부 프로젝트에서 필요)
87
RUN apt-get update && apt-get install -y \
98
git \
109
build-essential \
@@ -16,35 +15,49 @@ RUN apt-get update && apt-get install -y \
1615
python3-pip \
1716
cmake \
1817
ninja-build \
18+
dos2unix \
19+
gettext \
1920
&& rm -rf /var/lib/apt/lists/*
2021

21-
# Emscripten SDK 설치
2222
WORKDIR /opt
2323
RUN git clone https://github.com/emscripten-core/emsdk.git && \
2424
cd emsdk && \
2525
./emsdk install latest && \
2626
./emsdk activate latest
2727

28-
# Emscripten 환경 변수 설정
2928
ENV PATH="${EMSDK}/upstream/emscripten:${PATH}"
3029
ENV EMSDK_PYTHON=/usr/bin/python3
3130

32-
# 작업 디렉토리 설정
3331
WORKDIR /workspace
3432

35-
# 빌드 스크립트 생성
36-
RUN echo '#!/bin/bash\n\
37-
set -e\n\
38-
source /opt/emsdk/emsdk_env.sh\n\
39-
echo "Generating configure script..."\n\
40-
autoreconf -fiv\n\
41-
echo "Configuring with Emscripten..."\n\
42-
emconfigure ./configure --enable-emscripten --disable-doc\n\
43-
echo "Building..."\n\
44-
emmake make -j$(nproc) -k\n\
45-
echo "Build complete! Output files are in src/ directory."' > /usr/local/bin/build.sh && \
46-
chmod +x /usr/local/bin/build.sh
33+
# ⬇️ build.sh 강화: CRLF 정리 + libtoolize + autoreconf --install + -k 제거
34+
RUN echo '#!/usr/bin/env bash
35+
set -euo pipefail
36+
37+
# 0) Emscripten env
38+
[ -f /opt/emsdk/emsdk_env.sh ] && source /opt/emsdk/emsdk_env.sh
39+
40+
echo "==> Normalize line endings (CRLF -> LF)"
41+
git config core.autocrlf false || true
42+
if command -v dos2unix >/dev/null 2>&1; then
43+
# devcontainer는 호스트(Windows) 파일을 바인드 마운트하므로, 실행 시 LF로 정리
44+
find /workspace -type f ! -path "/workspace/.git/*" -exec dos2unix {} + || true
45+
fi
46+
47+
echo "==> Prepare Autotools (m4/, libtoolize, autoreconf)"
48+
mkdir -p m4
49+
rm -rf autom4te.cache config.status config.cache || true
50+
libtoolize --force --copy 2>/dev/null || glibtoolize --force --copy 2>/dev/null || true
51+
autoreconf --install --force --verbose
4752
48-
# 기본 명령어
49-
CMD ["/bin/bash"]
53+
echo "==> Configure (Emscripten)"
54+
emconfigure ./configure --enable-emscripten --disable-doc
55+
56+
echo "==> Build"
57+
# -k(keep going)는 실제 에러를 숨기므로 제거
58+
emmake make -j"$(nproc)"
59+
60+
echo "==> Build complete! Check ./src (or configured out dir)." ' > /usr/local/bin/build.sh && \
61+
chmod +x /usr/local/bin/build.sh
5062

63+
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)