Skip to content

Commit e77799d

Browse files
committed
adding packages
0 parents  commit e77799d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+429
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

README.md

Lines changed: 1 addition & 0 deletions

packages/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*/*/*
2+
*.pkg.tar.gz
3+
!*/*/metadata.json
4+
!*/*/build.sh
5+
!*/*/environment
6+
!*/*/run
7+
!*/*/compile
8+
!*/*/test.*

packages/Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
PACKAGES=$(subst /,-,$(shell find * -maxdepth 1 -mindepth 1 -type d))
2+
BUILD_PLATFORM=$(or ${PLATFORM},baremetal-$(shell grep -oP "^ID=\K.+" /etc/os-release))
3+
4+
help:
5+
@echo "If you want to build all packages, run $`make build-all$`"
6+
@echo
7+
@echo "Run $`make [language]-[version].pkg.tar.gz$` to build a specific language"
8+
9+
build build-all: $(addsuffix .pkg.tar.gz, ${PACKAGES})
10+
11+
12+
define PKG_RULE
13+
$(1).pkg.tar.gz: $(subst -,/,$(1)) $(subst -,/,$(1))/pkg-info.json
14+
cd $$< && chmod +x ./build.sh && ./build.sh
15+
rm -f $$@
16+
17+
tar czf $$@ -C $$< .
18+
endef
19+
20+
$(foreach pkg,$(PACKAGES),$(eval $(call PKG_RULE,$(pkg))))
21+
22+
%/pkg-info.json: %/metadata.json
23+
jq '.build_platform="${BUILD_PLATFORM}"' $< > $@
24+

packages/README.md

Lines changed: 13 additions & 0 deletions

packages/gcc/13.2.0/build.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
[[ -d "bin" ]] && exit 0
4+
PREFIX=$(realpath $(dirname $0))
5+
6+
mkdir -p build obj
7+
8+
cd build
9+
10+
curl "https://ftp.gnu.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.gz" -o gcc.tar.gz
11+
12+
tar xzf gcc.tar.gz --strip-components=1
13+
14+
./contrib/download_prerequisites
15+
16+
cd ../obj
17+
18+
# === autoconf based ===
19+
../build/configure --prefix "$PREFIX" --enable-languages=c,c++ --disable-multilib --disable-bootstrap
20+
21+
make -j$(nproc)
22+
make install -j$(nproc)
23+
cd ../
24+
rm -rf build obj
25+
26+
# Download bits/stdc++.h file
27+
mkdir -p "$PREFIX/include/bits"
28+
curl "https://raw.githubusercontent.com/gcc-mirror/gcc/master/libstdc%2B%2B-v3/include/precompiled/stdc%2B%2B.h" -o "$PREFIX/include/bits/stdc++.h"

packages/gcc/13.2.0/compile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
case "${CODE_LANGUAGE}" in
4+
c)
5+
rename 's/$/\.c/' "$@" # Add .c extension
6+
gcc -std=c11 *.c -lm
7+
;;
8+
c++)
9+
rename 's/$/\.cpp/' "$@" # Add .cpp extension
10+
g++ -std=c++17 *.cpp
11+
;;
12+
*)
13+
echo "How did you get here? (${CODE_LANGUAGE})"
14+
exit 1
15+
;;
16+
esac
17+
18+
chmod +x a.out

packages/gcc/13.2.0/environment

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
export PATH=$PWD/bin:$PATH
4+
export LD_LIBRARY_PATH="$PWD/lib:$PWD/lib64"

packages/gcc/13.2.0/metadata.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"language": "gcc",
3+
"version": "13.2.0",
4+
"provides": [
5+
{
6+
"language": "c",
7+
"aliases": [
8+
"gcc"
9+
]
10+
},
11+
{
12+
"language": "c++",
13+
"aliases": [
14+
"cpp",
15+
"g++"
16+
]
17+
}
18+
]
19+
}

packages/gcc/13.2.0/run

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
./a.out "$@"

0 commit comments

Comments
 (0)