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

fix(build): correctly set target-specific variable values #741

Closed
wants to merge 1 commit into from

Conversation

vegerot
Copy link
Contributor

@vegerot vegerot commented Oct 2, 2023

fix(build): correctly set target-specific variable values

Summary:
Previously, the HGNAME and OSS variables were not being set correctly when
building with make oss. In my version of GNU Make on Ubuntu 22.04:

GNU Make 4.3
Built for x86_64-pc-linux-gnu

instead of the OSS variable being set to true and HGNAME being set to
sl, the OSS variable was being set to true HGNAME=sl. This was causing
the eden binary to be built with the default HGNAME value of hg.

Here is a minimal example of the issue:

HG_NAME = hg
oss: OSS=true HG_NAME=sl
oss: local

local:
	@echo "OSS is $(OSS)"
	@echo "Building for $(HG_NAME)"

On my machine make oss prints

OSS is true HG_NAME=sl
Building for hg

However,

HG_NAME = hg
oss: OSS=true
oss: HG_NAME=sl
oss: local

local:
	@echo "OSS is $(OSS)"
	@echo "Building for $(HG_NAME)"

prints

OSS is true
Building for sl

Test Plan:

  1. On Ubuntu 22.04 and GNU Make 4.3, build sapling with make oss
  2. should see an error like
running build_mo
rm -f hg
cp build/scripts-3*/hg hg
cp: cannot stat 'build/scripts-3*/hg': No such file or directory
make: *** [Makefile:85: local] Error 1
  1. apply this patch and repeat step 1
  2. sl should build successfully

Summary:
Previously, the `HGNAME` and `OSS` variables were not being set correctly when
building with `make oss`.  In my version of GNU Make on Ubuntu 22.04:
```
GNU Make 4.3
Built for x86_64-pc-linux-gnu
```
instead of the `OSS` variable being set to `true` and `HGNAME` being set to
`sl`, the `OSS` variable was being set to `true HGNAME=sl`. This was causing
the eden binary to be built with the default `HGNAME` value of `hg`.

Here is a minimal example of the issue:

```makefile
HG_NAME = hg
oss: OSS=true HG_NAME=sl
oss: local

local:
	@echo "OSS is $(OSS)"
	@echo "Building for $(HG_NAME)"
```

On my machine `make oss` prints

```
OSS is true HG_NAME=sl
Building for hg
```

However,

```makefile
HG_NAME = hg
oss: OSS=true
oss: HG_NAME=sl
oss: local

local:
	@echo "OSS is $(OSS)"
	@echo "Building for $(HG_NAME)"
```

prints

```
OSS is true
Building for sl
```

Test Plan:
1. On Ubuntu 22.04 and GNU Make 4.3, build sapling with `make oss`
2. should see an error like

```bash
running build_mo
rm -f hg
cp build/scripts-3*/hg hg
cp: cannot stat 'build/scripts-3*/hg': No such file or directory
make: *** [Makefile:85: local] Error 1
```

3. apply this patch and repeat step 1
4. `sl` should build successfully
Copy link
Contributor

@zzl0 zzl0 left a comment

Choose a reason for hiding this comment

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

Thanks for fixing it

@facebook-github-bot
Copy link
Contributor

@zzl0 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@zzl0 merged this pull request in b5afbbe.

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

Successfully merging this pull request may close these issues.

3 participants