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

Improve the deployment script #598

Merged
merged 1 commit into from
Apr 5, 2018

Conversation

wilzbach
Copy link
Member

@wilzbach wilzbach commented Apr 5, 2018

Testing dlang-community/discussions#9 (comment)

As I don't have OSX, I simply added make release to the Travis script for now. Let's see if this works out of the box.

release.sh Outdated
unameOut="$(uname -s)"
case "$unameOut" in
Linux*) OS=linux; ;;
Darwin*) OS=osx; LDC_FLAGS+=("-macosx_version_min 10.7" "-lcrt1.o"); ;;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ldc2: Unknown command line argument '-macosx_version_min'.  Try: 'ldc2 -help'
ldc2: Did you mean '-dwarf-version'?
ldc2: Unknown command line argument '-lcrt1.o'.  Try: 'ldc2 -help'

:/

Copy link

@jacob-carlborg jacob-carlborg Apr 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wilzbach wilzbach force-pushed the osx-minimal-deployment branch 9 times, most recently from 959bd99 to 8a8e357 Compare April 5, 2018 07:32
@@ -76,26 +76,5 @@ report: all
dscanner --report src > src/dscanner-report.json
sonar-runner

.ONESHELL:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ONESHELL is only available in Make 3.82.
Travis uses 3.81 and there's no easy way to upgrade.

@@ -16,10 +16,10 @@ script: "./.travis.sh"
jobs:
include:
- stage: GitHub Release
if: tag IS present
d: ldc
#if: tag IS present
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently building the binaries on Travis is vastly more complicated than thought, so let's better constantly build them to avoid bad surprises on releases. Imho the ~1.5min are worth the mind peace.

if: tag IS present
d: ldc
#if: tag IS present
d: ldc-1.8.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locking the release compiler. Just in case there are any regressions coming up (I experienced some with the dlang-tour and it was a hell to figure out that the sudden failures were due to an automatic compiler upgrade)

@wilzbach wilzbach changed the title Reduce the minimal deployment target for OSX Improve the deployment script Apr 5, 2018
@wilzbach wilzbach added this to the 0.5.1 milestone Apr 5, 2018
@wilzbach
Copy link
Member Author

wilzbach commented Apr 5, 2018

@bbasile FYI: this is ready now. Would be nice if we can merge this before tagging 0.5.1 - thanks!

*) echo "Unknown ARCH: $ARCH"; exit 1
esac

archiveName="dscanner-$VERSION-$OS-$ARCH_SUFFIX.tar.gz"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick, binaries/packages for macOS usually don't contain the architecture. If multiple architectures are provided it's expected to be provided in a single universal binary.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we do the same for dub too (https://github.com/dlang/dub/releases, http://code.dlang.org/download) as it makes automated downloads easier.
I just saw that LDC has the same pattern: https://github.com/ldc-developers/ldc/releases

unameOut="$(uname -s)"
case "$unameOut" in
Linux*) OS=linux; LDC_FLAGS=("-flto=full" "-linker=gold" "-static") ;;
Darwin*) OS=osx; LDC_FLAGS+=("-L-macosx_version_min" "-L10.7" "-L-lcrt1.o"); ;;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick, I would prefer "macOS" over osx, since this is what the OS is called now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

@ghost ghost Apr 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please @wilzbach. He's right about the terminology. osx is a serie of Mac OS versions.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that's true that even for pre-defined D version identifiers osx is used....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, to be honest I don't feel strongly about it as long as we finally get the automated release builds working. We have been pushing this off for far too long ;-)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming is consistent with Dub's and LDC's releases:
But that's true that even for pre-defined D version identifiers osx is used....

That doesn't mean it's correct 😃. The predefined version identifier was arbitrary chosen by Walter even though darwin already existed in other compilers. Back then the official name was "Mac OS X", so naming it "OSX" was neither correct.

@ghost
Copy link

ghost commented Apr 5, 2018

@wilzbach there's still #575 that's planned for 0.5.1. It's simple, will do it today, the tag will follow then.

@wilzbach
Copy link
Member Author

wilzbach commented Apr 5, 2018

@bbasile I will merge this then, s.t. we can test it for 0.5.1
@jacob-carlborg If you feel strongly about the package name, we can always change it for 0.5.2 ;-)

@wilzbach wilzbach merged commit 6ca59c7 into dlang-community:master Apr 5, 2018
@wilzbach wilzbach deleted the osx-minimal-deployment branch April 5, 2018 10:03
@wilzbach
Copy link
Member Author

wilzbach commented Apr 5, 2018

Looks like this finally worked :)

image

I tested the Linux binary and it works fine - even on a 2.6.X kernel

So now we just need to figure out how to painlessly compile the Windows binaries.
Did someone try the Wine-built binary of DScanner that I posted here? If that works, it might be a feasible approach.
Otherwise I LDC supports cross-compiling since a while though it might require some work to get that working flawlessly in Docker (I saw on Slack that @jacob-carlborg gave this a shot recently) + there's the licensing problem.

@jacob-carlborg
Copy link

Otherwise I LDC supports cross-compiling since a while though it might require some work to get that working flawlessly in Docker (I saw on Slack that jacob-carlborg gave this a shot recently) + there's the licensing problem.

You don't need to run it in Docker. It simple enough to setup everything that is needed before building. This Docker image, compared with the one for macOS, did not require the multiarch/crossbuild base Docker image since LDC contains the cross-linker.

@jacob-carlborg
Copy link

If you feel strongly about the package name

I don't.

@jacob-carlborg
Copy link

Adding -L-dead_strip on macOS will reduce the binary size to almost a third. This corresponds to the --gc-sections flag that LDC uses by default on Linux. Not sure why the macOS flag is not enabled by default.

Adding -flto=full and running strip on the binary will get the size down to 3MB from the original 14MB.

@wilzbach
Copy link
Member Author

wilzbach commented Apr 6, 2018

You don't need to run it in Docker.

I know, but I was referring to downloading the VS libraries from Dropbox and copying the libs over.
That seems a bit fragile and like something I don't want to do for all X repositories as it seems like it might require small tweaks in the future.
I'm already not very well pleased about the duplication of the build script between D-Scanner, DCD and dfmt and thinking about moving the build script to tools ;-)

@jacob-carlborg
Copy link

Right. Perhaps a pre-packaged cross-compiler? Download and unpack. Event better if it can be upstreamed.

@jacob-carlborg
Copy link

So now we just need to figure out how to painlessly compile the Windows binaries.

@wilzbach If you don't want to learn PowerShell, you can use AppVeyor and install msys2 which bundles bash. I did some experiments and it's pretty straight forward [1]:

- cinst msys2 --params "/NoUpdate"
- bash -lic "echo 'asd'"

I'm not sure which tools are bundled but you can install additional tools using chocolatey [2] [3]. AppVeyor also has native support for GitHub releases [4].

[1] https://github.com/jacob-carlborg/dstep/blob/ea24360e5dbbdb8eebfbba869e4af1f42e9d18cc/appveyor.yml#L31-L38

[2] https://chocolatey.org/packages/curl
[3] https://www.appveyor.com/docs/build-configuration/#chocolatey
[4] https://www.appveyor.com/docs/deployment/github/

@wilzbach
Copy link
Member Author

@wilzbach If you don't want to learn PowerShell, you can use AppVeyor and install msys2 which bundles bash. I did some experiments and it's pretty straight forward [1]:

Thanks a lot for your pointers, but we already went through this and while annoying PowerShell isn't too hard. Even this repo has a appveyor.yml that builds and uploads the binary:

https://github.com/dlang-community/D-Scanner/blob/master/appveyor.yml

But AppVeyor was disabled, because I think (?) there have been too many random failures.
For now, we went with using Travis and Wine to build the Windows binaries:

#603

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants