Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build from source #44

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
3 changes: 3 additions & 0 deletions .azure-pipelines/azure-pipelines-osx.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .ci_support/linux_aarch64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ docker_image:
- quay.io/condaforge/linux-anvil-comp7
target_platform:
- linux-aarch64
build_platform:
- linux-64
10 changes: 10 additions & 0 deletions .ci_support/osx_arm64_.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
MACOSX_DEPLOYMENT_TARGET:
- '11.0'
channel_sources:
- conda-forge/label/rust_dev,conda-forge
channel_targets:
- conda-forge main
macos_machine:
- arm64-apple-darwin20.0.0
target_platform:
- osx-arm64
7 changes: 7 additions & 0 deletions README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions conda-forge.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build_platform:
osx_arm64: osx_64
linux_aarch64: linux_64
conda_forge_output_validation: true
bot:
Expand Down
49 changes: 47 additions & 2 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,53 @@

set -exuo pipefail

mkdir -p $PREFIX/share
cp -r code-server $PREFIX/share/
export npm_config_build_from_source=true
if [[ "${target_platform}" == "osx-arm64" ]] || [[ "${target_platform}" == "linux-aarch64" ]]; then
export npm_config_arch=arm64
export npm_config_target_arch=arm64
else
export npm_config_arch=x64
export npm_config_target_arch=x64
fi

# Build from source
pushd code-server
git init .
if [[ "${target_platform}" == osx-* ]]; then
git config core.precomposeunicode false
fi
git add .
git config user.email "[email protected]"
git config user.name "Your Name"
git commit -m "Initial commit"
git tag ${PKG_VERSION}
if [[ "${target_platform}" == "osx-arm64" ]]; then
yarn
else
yarn --frozen-lockfile
fi
if [[ "${target_platform}" == linux-* ]]; then
# No need to build deb/rpm packages here.
sed -ie 's/release_nfpm$/echo 1/g' ci/build/build-packages.sh
fi
yarn build
yarn build:vscode
yarn release
yarn release:standalone
# TODO: Adjust the code-server script to reference node from PATH
# yarn test:standalone-release
yarn package
popd

# Install tarball into ${PREFIX}
mkdir -p ${PREFIX}/share
pushd code-server/release-packages
tar xf code-server-*.tar.gz
rm code-server-*.tar.gz
mv code-server-* code-server
cp -r code-server ${PREFIX}/share/
popd

mkdir -p ${PREFIX}/bin
mkdir -p ${PREFIX}/share/code-server/extensions
cat <<'EOF' >${PREFIX}/bin/code-server
Expand Down
34 changes: 24 additions & 10 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,38 @@ package:
version: {{ version|replace("-", "_") }}

source:
url: https://github.com/cdr/code-server/releases/download/v{{ version }}/code-server-{{ version }}-linux-amd64.tar.gz # [linux64]
sha256: f2648a4387c5a5be8666fb82a7b8a58274c45b91942251ab337e202e078ae8a5 # [linux64]
url: https://github.com/cdr/code-server/releases/download/v{{ version }}/code-server-{{ version }}-linux-arm64.tar.gz # [aarch64]
sha256: 95c6a3e0c079b4c3cca2a39369662e2fc72aa4c59c77401915368d6f11c7e49c # [aarch64]
url: https://github.com/cdr/code-server/releases/download/v{{ version }}/code-server-{{ version }}-macos-amd64.tar.gz # [osx]
sha256: 85a733c957b3ee5134ef4e1cffc4f5dc6034157e78d6c53c756134ac5a1be6bd # [osx]
url: https://github.com/cdr/code-server/archive/v{{ version }}.tar.gz
sha256: a23ea7376afd6ce6b2a99515aacc4489eeebacd789b6ccd10c17fe3eac51946f
#git_url: https://github.com/cdr/code-server
#git_rev: v{{ version }}
#git_depth: 1
folder: code-server
patches:
- osx-arm64.patch # [osx and arm64]

build:
number: 0
binary_relocation: false # [osx]
number: 1
skip: true # [win]

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- nodejs 12.* # [not (osx and arm64)]
- nodejs >=15 # [osx and arm64]
- git
- git-lfs
- jq
- yarn
- rsync
- pkg-config
host:
- nodejs 12.*
- libxkbfile # [linux]
- xorg-libx11 # [linux]
- xorg-kbproto # [linux]
run:
- nodejs 12.*
- nodejs 12.* # [not (osx and arm64)]
- nodejs >=15 # [osx and arm64]

test:
commands:
Expand Down
51 changes: 51 additions & 0 deletions recipe/osx-arm64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
diff --git a/ci/build/build-code-server.sh b/ci/build/build-code-server.sh
index 1ede7a88..5571c13d 100755
--- a/ci/build/build-code-server.sh
+++ b/ci/build/build-code-server.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-set -euo pipefail
+set -euxo pipefail

# Builds code-server into out and the frontend into dist.

diff --git a/ci/lib.sh b/ci/lib.sh
index 96a413f1..55afb67c 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -36,6 +36,9 @@ os() {

arch() {
case "$(uname -m)" in
+ arm64)
+ echo arm64
+ ;;
aarch64)
echo arm64
;;
diff --git a/lib/vscode/package.json b/lib/vscode/package.json
index 8c2943cd..33b72a23 100644
--- a/lib/vscode/package.json
+++ b/lib/vscode/package.json
@@ -185,7 +185,7 @@
"opn": "^6.0.0",
"optimist": "0.3.5",
"p-all": "^1.0.0",
- "playwright": "1.7.1",
+ "playwright": "1.8.0",
"pump": "^1.0.1",
"queue": "3.0.6",
"rcedit": "^1.1.0",
diff --git a/ci/dev/postinstall.sh b/ci/dev/postinstall.sh
index 0ffa772f..84d03d8f 100755
--- a/ci/dev/postinstall.sh
+++ b/ci/dev/postinstall.sh
@@ -11,7 +11,7 @@ main() {
cd ..

cd lib/vscode
- yarn ${CI+--frozen-lockfile}
+ yarn

symlink_asar
}