Skip to content

Commit

Permalink
[ci skip] Merge branch 'master' into iosbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
bassosimone committed Oct 12, 2023
2 parents d3423c7 + ea4ef4e commit 655e5dc
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 44 deletions.
156 changes: 124 additions & 32 deletions internal/cmd/buildtool/android_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,12 +754,6 @@ func TestAndroidBuildCdepsOpenSSL(t *testing.T) {
"DESTDIR=" + faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm",
"install_dev",
},
}, {
Env: []string{},
Argv: []string{
"rm", "-rf",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig",
},
}, {
Env: []string{},
Argv: []string{
Expand Down Expand Up @@ -815,12 +809,6 @@ func TestAndroidBuildCdepsOpenSSL(t *testing.T) {
"DESTDIR=" + faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64",
"install_dev",
},
}, {
Env: []string{},
Argv: []string{
"rm", "-rf",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig",
},
}, {
Env: []string{},
Argv: []string{
Expand Down Expand Up @@ -876,12 +864,6 @@ func TestAndroidBuildCdepsOpenSSL(t *testing.T) {
"DESTDIR=" + faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386",
"install_dev",
},
}, {
Env: []string{},
Argv: []string{
"rm", "-rf",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig",
},
}, {
Env: []string{},
Argv: []string{
Expand Down Expand Up @@ -937,12 +919,6 @@ func TestAndroidBuildCdepsOpenSSL(t *testing.T) {
"DESTDIR=" + faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64",
"install_dev",
},
}, {
Env: []string{},
Argv: []string{
"rm", "-rf",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig",
},
}},
}}

Expand Down Expand Up @@ -1045,6 +1021,7 @@ func TestAndroidBuildCdepsLibevent(t *testing.T) {
"CXXFLAGS=-fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -fpic -mthumb -Oz -DANDROID",
"-I"+faketopdir+"/internal/cmd/buildtool/internal/libtor/android/arm/include",
),
"PKG_CONFIG_PATH=" + faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig",
},
Argv: []string{
"./configure",
Expand Down Expand Up @@ -1077,8 +1054,36 @@ func TestAndroidBuildCdepsLibevent(t *testing.T) {
Env: []string{},
Argv: []string{
"rm",
"-rf",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig/libevent.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig/libevent_core.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig/libevent_extra.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig/libevent_openssl.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig/libevent_pthreads.pc",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1195,6 +1200,7 @@ func TestAndroidBuildCdepsLibevent(t *testing.T) {
"CXXFLAGS=-fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -fpic -O2 -DANDROID",
"-I"+faketopdir+"/internal/cmd/buildtool/internal/libtor/android/arm64/include",
),
"PKG_CONFIG_PATH=" + faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig",
},
Argv: []string{
"./configure",
Expand Down Expand Up @@ -1227,8 +1233,36 @@ func TestAndroidBuildCdepsLibevent(t *testing.T) {
Env: []string{},
Argv: []string{
"rm",
"-rf",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig/libevent.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig/libevent_core.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig/libevent_extra.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig/libevent_openssl.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig/libevent_pthreads.pc",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1345,6 +1379,7 @@ func TestAndroidBuildCdepsLibevent(t *testing.T) {
"CXXFLAGS=-fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -fPIC -O2 -DANDROID -mstackrealign",
"-I"+faketopdir+"/internal/cmd/buildtool/internal/libtor/android/386/include",
),
"PKG_CONFIG_PATH=" + faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig",
},
Argv: []string{
"./configure",
Expand Down Expand Up @@ -1377,8 +1412,36 @@ func TestAndroidBuildCdepsLibevent(t *testing.T) {
Env: []string{},
Argv: []string{
"rm",
"-rf",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig/libevent.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig/libevent_core.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig/libevent_extra.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig/libevent_openssl.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig/libevent_pthreads.pc",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1495,6 +1558,7 @@ func TestAndroidBuildCdepsLibevent(t *testing.T) {
"CXXFLAGS=-fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -fPIC -O2 -DANDROID",
"-I"+faketopdir+"/internal/cmd/buildtool/internal/libtor/android/amd64/include",
),
"PKG_CONFIG_PATH=" + faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig",
},
Argv: []string{
"./configure",
Expand Down Expand Up @@ -1527,8 +1591,36 @@ func TestAndroidBuildCdepsLibevent(t *testing.T) {
Env: []string{},
Argv: []string{
"rm",
"-rf",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig/libevent.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig/libevent_core.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig/libevent_extra.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig/libevent_openssl.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig/libevent_pthreads.pc",
},
}, {
Env: []string{},
Expand Down
16 changes: 13 additions & 3 deletions internal/cmd/buildtool/cdepslibevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func cdepsLibeventBuildMain(globalEnv *cBuildEnv, deps buildtoolmodel.Dependenci
}
envp := cBuildExportAutotools(cBuildMerge(globalEnv, localEnv))

// On iOS, we need PKG_CONFIG_PATH to convince libevent to use the OpenSSL we built but]
// always letting libevent's configure be pkgconfig aware would probably be fine
// On iOS, we need PKG_CONFIG_PATH to convince libevent to use the OpenSSL we built and
// always letting libevent's configure use pkgconfig is actually fine.
envp.Append("PKG_CONFIG_PATH", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig"))

argv := runtimex.Try1(shellx.NewArgv("./configure"))
Expand All @@ -63,7 +63,17 @@ func cdepsLibeventBuildMain(globalEnv *cBuildEnv, deps buildtoolmodel.Dependenci
must.Run(log.Log, "make", "V=1", "-j", strconv.Itoa(runtime.NumCPU()))
must.Run(log.Log, "make", "DESTDIR="+globalEnv.DESTDIR, "install")
must.Run(log.Log, "rm", "-rf", filepath.Join(globalEnv.DESTDIR, "bin"))
must.Run(log.Log, "rm", "-rf", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig"))

// We used to delete the whole pkgconfig directory but libevent's build needs OpenSSL's
// pkgconfig, so removing the whole directory means rebuilding libevent requires building
// OpenSSL because its pkgconfig is also removed. We discovered this need when working
// on the https://github.com/ooni/probe-cli/pull/1366 MVP. To keep the build idempotent,
// let's be more gentle and just remove libevent's pkgconfig files instead.
must.Run(log.Log, "rm", "-f", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig", "libevent.pc"))
must.Run(log.Log, "rm", "-f", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig", "libevent_core.pc"))
must.Run(log.Log, "rm", "-f", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig", "libevent_extra.pc"))
must.Run(log.Log, "rm", "-f", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig", "libevent_openssl.pc"))
must.Run(log.Log, "rm", "-f", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig", "libevent_pthreads.pc"))

// we just need libevent.a
must.Run(log.Log, "rm", "-rf", filepath.Join(globalEnv.DESTDIR, "lib", "libevent.la"))
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/buildtool/cdepsopenssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func cdepsOpenSSLBuildMain(globalEnv *cBuildEnv, deps buildtoolmodel.Dependencie

must.Run(log.Log, "make", "DESTDIR="+globalEnv.DESTDIR, "install_dev")

// FIXME: we need to explain this change
// We used to delete the pkgconfig but it turns out this is important for libevent iOS builds, which
// means now we need to keep it. See https://github.com/ooni/probe-cli/pull/1369 for details.
//must.Run(log.Log, "rm", "-rf", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig"))
}
39 changes: 31 additions & 8 deletions internal/cmd/buildtool/linuxcdeps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,6 @@ func TestLinuxCdepsBuildMain(t *testing.T) {
"DESTDIR=" + faketopdir + "/" + sysDepDestDir,
"install_dev",
},
}, {
Env: []string{},
Argv: []string{
"rm", "-rf",
faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig",
},
}},
}, {
name: "we can build libevent",
Expand Down Expand Up @@ -195,6 +189,7 @@ func TestLinuxCdepsBuildMain(t *testing.T) {
faketopdir,
sysDepDestDir,
),
"PKG_CONFIG_PATH=" + faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig",
},
Argv: []string{
"./configure",
Expand Down Expand Up @@ -226,8 +221,36 @@ func TestLinuxCdepsBuildMain(t *testing.T) {
Env: []string{},
Argv: []string{
"rm",
"-rf",
faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig",
"-f",
faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig/libevent.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig/libevent_core.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig/libevent_extra.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig/libevent_openssl.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig/libevent_pthreads.pc",
},
}, {
Env: []string{},
Expand Down

0 comments on commit 655e5dc

Please sign in to comment.